views:

91

answers:

0

Hello,

I'm attempting to make a motion chart like the one provided by the Google Visualization API[1], in C#, with Winforms.

I've managed to get most of it working by using a chart containing multiple series, with one series per time period, and the series containing all the datapoints for that time period. I have a function that "Animates" the chart, by setting the enabled property of the current series to false, and enabling the next one, rinse, repeat.

I have trails working by hooking into the Chart's PostPaint event, and then using DrawCurve to draw the trail. All of this works as intended, although, the code isn't as nice as it could be.

Unfortunately, I have a big problem: when switching between series, the bubbles essentially "jump" locations, and this looks quite bad, in comparison to the nice smooth flow of bubbles with google's motion chart. I'm trying to figure out how I can do the same.

I have two ideas right now: a) Have another function that takes two series, and generates a set of new series for each datapoint to "transition" between series A, and series B. This is ugly, and performance wise, will be quite bad, in my opinion. b) Hook into the chart's pre-paint event, go through the currently enabled series, and the last series prior to that, and manually paint a transition between the last series and this one for each DataPoint. I have no idea about how best to do this.

If anyone can suggest an alternative(without using WPF), or a library that'll handle the transition for me, or, tell me how best to achieve what I want I'd be very grateful.

Thank you!

[1]: Google Motion Chart Example