我认为 jQuery 对于使用 amCharts 不是强制性的。使用 jQuery 和 amCharts 有什么好处?
关于 amCharts 中使用的数据,是否有更“少编码”的方式将数据传递给它(而不是一遍又一遍地重复使用的列)?
var chartData = [{
country: "USA",
visits: 4025,
color: "#FF0F00"
}, {
country: "China",
visits: 1882,
color: "#FF6600"
}, { etc....
最后,是否有一种更聪明的方法来构建图表,而不是一遍又一遍地定义每个 ONE(动态生成图表的问题)?
`
// second graph
graph = new AmCharts.AmGraph();
graph.title = "North America";
graph.labelText = "[[value]]";
graph.valueField = "namerica";
graph.type = "column";
graph.lineAlpha = 0;
graph.fillAlphas = 1;
graph.lineColor = "#D8E0BD";
chart.addGraph(graph);
// thirdt graph
graph = new AmCharts.AmGraph();
graph.title = "Asia-Pacific";
graph.labelText = "[[value]]";
graph.valueField = "asia";
graph.type = "column";
graph.lineAlpha = 0;
graph.fillAlphas = 1;
graph.lineColor = "#B3DBD4";
chart.addGraph(graph);
// fourth graph
graph = new AmCharts.AmGraph();
graph.title = "Latin America";
graph.labelText = "[[value]]";
graph.valueField = "lamerica";
graph.type = "column";
graph.lineAlpha = 0;
graph.fillAlphas = 1;
graph.lineColor = "#69A55C";
chart.addGraph(graph);
// fifth graph
graph = new AmCharts.AmGraph();
graph.title = "Middle-East";
graph.labelText = "[[value]]";
graph.valueField = "meast";
graph.type = "column";
graph.lineAlpha = 0;
graph.fillAlphas = 1;
graph.lineColor = "#B5B8D3";
chart.addGraph(graph);
// sixth graph
graph = new AmCharts.AmGraph();
graph.title = "Africa";
graph.labelText = "[[value]]";
graph.valueField = "africa";
graph.type = "column";
graph.lineAlpha = 0;
graph.fillAlphas = 1;
graph.lineColor = "#F4E23B";
chart.addGraph(graph);
`
谢谢