我使用Amcharts在柱形图中表示我的值。 这是我的代码片段:
chart = new AmCharts.AmSerialChart();
chart.dataProvider = chartData;
chart.categoryField = "Title";
chart.startDuration = 1;
chart.valueAxes= [{
"gridThickness":0,
}];
chart.categoryAxis.gridThickness= 0;
// AXES
// category
var categoryAxis = chart.categoryAxis;
categoryAxis.labelRotation = 0;
categoryAxis.gridPosition = "start";
// value
var graph = new AmCharts.AmGraph();
graph.valueField = "value";
graph.balloonText = "[[category]]: <b>[[value]]</b>";
graph.type = "column";
graph.lineAlpha = 0;
graph.fillAlphas = 0.8;
chart.addGraph(graph);
chart.depth3D = 15;
chart.angle = 30;
var chartCursor = new AmCharts.ChartCursor();
chartCursor.cursorAlpha = 0;
chartCursor.zoomable = false;
chartCursor.categoryBalloonEnabled = false;
chart.addChartCursor(chartCursor);
chart.creditsPosition = "top-right";
chart.write("chartdiv");
我的问题是,每当我悬停列时,都不会出现气球文字。而是在控制台中我得到如下错误:
未捕获的TypeError:无法读取未定义的属性'precision' amcharts.js:21 AmCharts.formatNumber amcharts.js:21 AmCharts.formatValue amcharts.js:28 AmCharts.AmSerialChart.AmCharts.Class.formatString serial.js:25 AmCharts.ChartCursor.AmCharts.Class.updateCursor amcharts.js:178 AmCharts.ChartCursor.AmCharts.Class.setPosition amcharts.js:170 AmCharts.ChartCursor.AmCharts.Class.detectMovement amcharts.js:161 (匿名函数)
我添加了serial.js
和amcharts.js
。但是我仍然继续犯错,这使我无法显示气球文字。我现在该怎么办?