Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic LineChart LineSeries ScatterType performance issue (Read 3714 times)
PNJ
YaBB Newbies
*
Offline



Posts: 5
Location: Rotterdam
Joined: Mar 23rd, 2016
LineChart LineSeries ScatterType performance issue
Mar 23rd, 2016 at 4:27pm
Print Post  
Hi,

I have a LineChart with a LineSeries with the option ScatterType.
The performance is OK (not great) up-to 1000 scatter-points. If I display the graph with 3600 point (1 hour of data with 1 point per second) the build up of the graph becomes very slow. It takes more than 5 seconds to display the finished graph.
What can I do to improve the response time?

Kind regards,
Paul,
the Netherlands
  

Kinds regards,
Paul,
the Netherlands
Back to top
 
IP Logged
 
Slavcho
God Member
*****
Offline


tech.support

Posts: 3147
Joined: Oct 19th, 2005
Re: LineChart LineSeries ScatterType performance issue
Reply #1 - Mar 24th, 2016 at 8:47am
Print Post  
Hi Paul,

Try freezing all brushes used to draw line and scatter graphics. I tested following code in MultiAxis sample project, adding the Freeze() call seems to make it almost two times faster -

Code
Select All
Loaded += (s, e) =>
{
	var series = new LineSeries();
	var range = Enumerable.Range(0, 3600);
	series.XData = new DoubleCollection(
		range.Select(n => n / 360.0));
	series.YData = new DoubleCollection(
		range.Select(n => 30 * Math.Cos(n)));
	series.ScatterType = ScatterType.Square;

	var b = new SolidColorBrush(Colors.Orange);
	b.Freeze();
	series.Strokes.Add(b);
	series.ScatterStrokes.Add(b);
	series.ScatterFills.Add(b);

	lineChart.Series.Add(series);
}; 



We'll also check if calling Freeze on the FrameworkElements created to show line and scatter graphics will improve it further.

Regards,
Slavcho
Mindfusion
  
Back to top
 
IP Logged
 
Slavcho
God Member
*****
Offline


tech.support

Posts: 3147
Joined: Oct 19th, 2005
Re: LineChart LineSeries ScatterType performance issue
Reply #2 - Mar 24th, 2016 at 1:25pm
Print Post  
We've done some optimizations in the control's code, you can find new assemblies here -

https://mindfusion.eu/_samples/linechart.zip

Apart from freezing brushes, you could also remove ChartEffect assignments if you use any, to get less visual elements created. With that and frozen elements, the chart seems to appear in 1-2 seconds with all 3600 points visible.

In the sample project from archive above you can also see another approach you could implement - show only a subset of the points by specifying smaller axis ranges, and let users scroll to see more of them.

Regards,
Slavcho
Mindfusion
  
Back to top
 
IP Logged
 
PNJ
YaBB Newbies
*
Offline



Posts: 5
Location: Rotterdam
Joined: Mar 23rd, 2016
Re: LineChart LineSeries ScatterType performance issue
Reply #3 - Mar 29th, 2016 at 11:29am
Print Post  
Hi Slavcho,

Thanks, big improvement!
  

Kinds regards,
Paul,
the Netherlands
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint