2

我正在使用 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>
4

1 回答 1

3

我已经想通了,我需要添加以下行:

chart1.getAnimations().getLoad().setEnabled(true);

并确保我包含 jchartfx.animation.js 文件

于 2013-11-07T19:48:03.053 回答