如何传递 Morris Donut 值中的字符串
How to pass the string in Morris Donut value
如何在数据数组值下传递莫里斯甜甜圈中的字符串。我有一个像这样的莫里斯甜甜圈 Donut 1 And this is my code. I want like this Donut. Donut 2
Morris.Donut({
element: 'donut-example',
data: [
<?php foreach ($pay as $r_pay): ?>
{label: 'Level Name: <?= $r_pay['level_id']; ?>',value: '<?=$r_pay['total']; ?>'},
<?php endforeach; ?>
]
});
在Morris Documentation中表示除了element
和data
还可以加上formatter
其中
will translate a y-value into a label for the centre of the donut.
这是一个例子:
Morris.Donut({
element: 'donut-example',
data: [
{label: "Download Sales", value: 12},
{label: "In-Store Sales", value: 30},
{label: "Mail-Order Sales", value: 20}
],
formatter: function (y, data) { return 'Due Amount: ' + y }
});
产生这个:
如何在数据数组值下传递莫里斯甜甜圈中的字符串。我有一个像这样的莫里斯甜甜圈 Donut 1 And this is my code. I want like this Donut. Donut 2
Morris.Donut({
element: 'donut-example',
data: [
<?php foreach ($pay as $r_pay): ?>
{label: 'Level Name: <?= $r_pay['level_id']; ?>',value: '<?=$r_pay['total']; ?>'},
<?php endforeach; ?>
]
});
在Morris Documentation中表示除了element
和data
还可以加上formatter
其中
will translate a y-value into a label for the centre of the donut.
这是一个例子:
Morris.Donut({
element: 'donut-example',
data: [
{label: "Download Sales", value: 12},
{label: "In-Store Sales", value: 30},
{label: "Mail-Order Sales", value: 20}
],
formatter: function (y, data) { return 'Due Amount: ' + y }
});
产生这个: