如何使用 dataLoader 在 amCharts 中添加里程碑
How to add milestones in amCharts using dataLoader
有没有办法通过数据库的数据馈送来实现新的里程碑?我检查了下面的示例,但无法弄清楚
https://www.amcharts.com/kbase/time-line-chart-date-based-milestones/
我使用 "dataLoader" 将值输入图表 我可以在 table 中为里程碑创建一个新列 问题是如何更新它?
该示例中的里程碑是 guides
, so they don't normally get updated in any process that modifies the chart's dataProvider. You can use the complete
callback 到 create/update 您的图表指南:
AmCharts.makeChart("chartdiv", {
// ...
dataLoader: {
url: "...",
complete: function(chart) {
//add/modify guide objects through chart.valueAxes[0].guides or
//directly to the chart object through chart.guides
chart.valueAxes[0].guides = [{
"value": new Date(2016, 2, 5),
"label": "MILESTONE #1",
"position": "top",
"fontSize": 15,
"tickLength": 15
},
// .. etc
];
chart.validateData(); //redraw chart
}
},
// ...
});
有没有办法通过数据库的数据馈送来实现新的里程碑?我检查了下面的示例,但无法弄清楚
https://www.amcharts.com/kbase/time-line-chart-date-based-milestones/
我使用 "dataLoader" 将值输入图表 我可以在 table 中为里程碑创建一个新列 问题是如何更新它?
该示例中的里程碑是 guides
, so they don't normally get updated in any process that modifies the chart's dataProvider. You can use the complete
callback 到 create/update 您的图表指南:
AmCharts.makeChart("chartdiv", {
// ...
dataLoader: {
url: "...",
complete: function(chart) {
//add/modify guide objects through chart.valueAxes[0].guides or
//directly to the chart object through chart.guides
chart.valueAxes[0].guides = [{
"value": new Date(2016, 2, 5),
"label": "MILESTONE #1",
"position": "top",
"fontSize": 15,
"tickLength": 15
},
// .. etc
];
chart.validateData(); //redraw chart
}
},
// ...
});