简体   繁体   English

jChartFX没有动画

[英]jChartFX not animating

I am using jchartfx to generate charts. 我正在使用jchartfx生成图表。 The graph demos on jchartfx website load animated. jchartfx网站上的图形演示加载了动画。 My graph code is below and the problem is that my graph doesn't seem to animate and just loads straight away. 我的图形代码在下面,问题是我的图形似乎没有动画,只能立即加载。

Here's a jsfiddle: http://jsfiddle.net/3LkG3/ 这是一个jsfiddle: http : //jsfiddle.net/3LkG3/

Any ideas what's wrong with my code that is preventing the animated load? 有什么想法可以阻止动画加载的代码出了什么问题吗?

<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>

i've figured it out, i need to add the following line: 我想通了,我需要添加以下行:

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

and make sure i include the jchartfx.animation.js file 并确保我包括jchartfx.animation.js文件

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM