我正在使用jchartfx生成图表。 jchartfx网站上的图表演示加载动画。我的图形代码如下,问题是我的图形似乎没有动画,只是直接加载。
这是一个jsfiddle:http://jsfiddle.net/3LkG3/
我的代码有什么问题阻止了动画加载?
<script type="text/javascript" src="http://www.jchartfx.com/libs/v7/current/js/jchartfx.system.js"></script>
<script type="text/javascript" src="http://www.jchartfx.com/libs/v7/current/js/jchartfx.coreBasic.js"></script>
<div id="ChartDiv" style="width:600px;height:400px"></div>
<script type="text/javascript" language="javascript">
loadChart();
var chart1;
function loadChart()
{
chart1 = new cfx.Chart();
chart1.getAxisY().setMin(0);
chart1.getAxisY().setMax(100);
var series = chart1.getSeries().getItem(0);
series.setGallery(cfx.Gallery.Line);
var data = [
{ "Month": "Jan", "A": 40, "B": 12, "C": 6, "D": 8 },
{ "Month": "Feb", "A": 54, "B": 19, "C": 11, "D": 19 },
{ "Month": "Mar", "A": 63, "B": 29, "C": 15, "D": 22 },
{ "Month": "Apr", "A": 75, "B": 31, "C": 19, "D": 43 },
{ "Month": "May", "A": 81, "B": 70, "C": 35, "D": 47 },
{ "Month": "Jun", "A": 92, "B": 90, "C": 60, "D": 98 }
];
chart1.setDataSource(data);
var divHolder = document.getElementById('ChartDiv');
chart1.create(divHolder);
}
</script>
答案 0 :(得分:3)
我已经弄明白了,我需要添加以下内容:
chart1.getAnimations().getLoad().setEnabled(true);
并确保我包含jchartfx.animation.js文件