0
我正在嘗試使用javascripts amcharts顯示條形圖。但是,只有第一條記錄纔會顯示在Firefox中,Chrome和IE中的輸出是可以的。其餘的數據不會顯示在圖表上。類別和數值軸顯示多條記錄的存在,但只有第一個條出現。請幫忙。Amcharts條形圖僅顯示Firefox中的第一條記錄
以下是我的代碼供大家參考。
var lineChartData = [{
title: new Date(2009, 10, 2),
value: 1816},
{
title: new Date(2009, 10, 3),
value: 2680},
{
title: new Date(2009, 10, 4),
value: 1448},
{
title: new Date(2009, 10, 5),
value: 1848},
{
title: new Date(2009, 10, 6),
value: 1130},
{
title: new Date(2009, 10, 9),
value: 1095},
{
title: new Date(2009, 10, 10),
value: 990},
{
title: new Date(2009, 10, 11),
value: 13580},
{
title: new Date(2009, 10, 12),
value: 1709},
{
title: new Date(2009, 10, 13),
value: 1378},
{
title: new Date(2009, 10, 16),
value: 1378},
{
title: new Date(2009, 10, 17),
value: 1571},
{
title: new Date(2009, 10, 18),
value: 5079},
{
title: new Date(2009, 10, 19),
value: 5079},
{
title: new Date(2009, 10, 20),
value: 1744},
{
title: new Date(2009, 10, 23),
value: 1728},
{
title: new Date(2009, 10, 24),
value: 1584},
{
title: new Date(2009, 10, 25),
value: 3788},
{
title: new Date(2009, 10, 26),
value: 3788 },
{
title: new Date(2009, 10, 27),
value: 13963},
{
title: new Date(2009, 10, 30),
value: 13963},
{
title: new Date(2009, 11, 1),
value: 1642},
{
title: new Date(2009, 11, 2),
value: 1642},
{
title: new Date(2009, 11, 3),
value: 10681},
{
title: new Date(2009, 11, 4),
value: 1322}];
var chart = new AmCharts.AmSerialChart();
chart.autoMarginOffset = 0;
chart.marginRight = 0;
chart.dataProvider = lineChartData;
chart.categoryField = "title";
// this single line makes the chart a bar chart,
// try to set it to false - your bars will turn to columns
chart.rotate = true;
// the following two lines makes chart 3D
chart.depth3D = 20;
chart.angle = 30;
// AXES
// Category
var categoryAxis = chart.categoryAxis;
categoryAxis.gridPosition = "start";
categoryAxis.axisColor = "#DADADA";
categoryAxis.fillAlpha = 1;
categoryAxis.gridAlpha = 0;
categoryAxis.fillColor = "#FAFAFA";
// value
var valueAxis = new AmCharts.ValueAxis();
valueAxis.axisColor = "#DADADA";
valueAxis.title = "Income in millions, USD";
valueAxis.gridAlpha = 0.1;
chart.addValueAxis(valueAxis);
// GRAPH
var graph = new AmCharts.AmGraph();
graph.title = "Income";
graph.valueField = "value";
graph.type = "column";
graph.balloonText = "Income in [[category]]:[[value]]";
graph.lineAlpha = 0;
graph.fillColors = "#bf1c25";
graph.fillAlphas = 1;
chart.addGraph(graph);
chart.write("chartdiv");