jChartFX not animating

615 Views Asked by At

I am using jchartfx to generate charts. The graph demos on jchartfx website load animated. 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/

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

There are 1 best solutions below

0
On

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