Page 1 of 1

Animating the Trends Graphs

Posted: Fri 29 May 2015 4:11 pm
by Smithee
Afternoon all -

A quick question thats stumping me. I have a realtime data graph online at:

http://weather.casa.ucl.ac.uk/hourgraph.htm - it animates in.

I am now just putting in place the trends page (the formatting is all over the shop at the moment)

http://weather.casa.ucl.ac.uk/trends.htm

However, i cant seem to get the animate code to work - anyone know how to get the graphs to load over time (ie so the rainfall bar charts pop up).

Andy

Re: Animating the Trends Graphs

Posted: Sat 30 May 2015 12:27 pm
by mcrossley
Apparently animation is not available if you use .setData() on a series.

Re: Animating the Trends Graphs

Posted: Sat 30 May 2015 1:23 pm
by steve
It looks like doing setVisible(false) before the setData(), and setVisible(true, true) after it, gets the animation working.

Re: Animating the Trends Graphs

Posted: Sat 30 May 2015 5:28 pm
by mcrossley
Hmm, doesn't seem to do anything for me? But using setVisible(true,false) on the series,then calling chart.redraw() ends up with a blank plot!

Re: Animating the Trends Graphs

Posted: Sat 30 May 2015 5:35 pm
by steve
Ah, OK. I didn't actually try it, I just found it on stackoverflow :lol:

Re: Animating the Trends Graphs

Posted: Sat 30 May 2015 6:40 pm
by mcrossley
The best I can do so far is addSeries() when the data fetched, but it only animates the 'seeker' (not sure what the correct term is) graph below the main graph.

Re: Animating the Trends Graphs

Posted: Sat 30 May 2015 6:55 pm
by steve
This shows the 'setVisible' solution - http://jsfiddle.net/UTC6e/1/

I don't know why it doesn't work with the Cumulus charts.

Re: Animating the Trends Graphs

Posted: Sat 30 May 2015 7:36 pm
by mcrossley
It's a Highcharts vs. Highstock thing I think.

Re: Animating the Trends Graphs

Posted: Sun 31 May 2015 6:29 am
by steve
Ah, right.

Re: Animating the Trends Graphs

Posted: Sun 31 May 2015 8:54 am
by Smithee
Thats a shame - thanks for looking into it though, you guys are great at support and finding solutions.

Andy

Re: Animating the Trends Graphs

Posted: Sun 31 May 2015 9:23 am
by Smithee
If you switch back to highcharts then animations run on the line graphs - the column charts need the setVisible - i have a test on Sun Hours, although it seems to load in from the top? So near but not quite yet.

http://weather.casa.ucl.ac.uk/trends.htm

chart = new Highcharts.Chart(options);
chart.showLoading();

$.ajax({
url: 'sunhours.json',
dataType: 'json',
success: function (resp) {
chart.hideLoading();
chart.series[0].setVisible(false);
chart.series[0].setData(resp.sunhours);
chart.series[0].setVisible(true, true);
}

Is there a license issue with going back to highcharts?

Andy

Re: Animating the Trends Graphs

Posted: Sun 31 May 2015 9:35 am
by steve
Smithee wrote:Is there a license issue with going back to highcharts?
No, the licensing is the same - i.e free for non-commercial use as long as you give an attribution.