这是我关于stackoverflow的第一个问题。
我正在尝试通过onclick事件渲染序列图表。 (请参阅JSfiddle - http://jsfiddle.net/w408kcmp/)。
JS:
var expIConfig;
var expIData = [{
"period": "Week 1",
"inflows": 5,
"outflows": 10
}];
expIConfig = {
"type": "serial",
"theme": "none",
"dataProvider": expIData,
"startDuration": 1,
"colors": ['#77ED84', '#FA6F0C'],
"graphs": [{
"balloonText": "Inflows during [[category]]: <b>[[value]]</b>",
"fillAlphas": 0.9,
"lineAlpha": 0.2,
"title": "Inflows",
"type": "column",
"valueField": "inflows"
}, {
"balloonText": "Outflows during [[category]]: <b>[[value]]</b>",
"fillAlphas": 0.9,
"lineAlpha": 0.2,
"title": "Outflows",
"type": "column",
"clustered": false,
"columnWidth": 0.5,
"valueField": "outflows"
}],
"plotAreaFillAlphas": 0.1,
"categoryField": "period",
"categoryAxis": {
"gridPosition": "start",
"labelRotation": 25
}
};
function renderChart() {
expIConfig.dataProvider = expIData;
expIChart = AmCharts.makeChart("chartdiv1", expIConfig, expIData);
}
HTML:
<button onclick="renderChart()">Render</button>
<div id="chartdiv1" style="width:300px;height:325px;"></div>
资源:
<script type="text/javascript" src="http://www.amcharts.com/lib/3/amcharts.js"></script>
<script type="text/javascript" src="http://www.amcharts.com/lib/3/serial.js"></script>
<script type="text/javascript" src="http://www.amcharts.com/lib/3/themes/none.js"></script>
我收到了上述错误。有类似问题的其他人(不是amCharts相关表明它可能是由于在serial.js之后加载amcharts.js,但是,我的脚本按指定的顺序加载:amcharts.js - &gt; serial.js - &gt; none.js.
非常感谢任何帮助。
非常感谢。