|
Responsive over many LineLayer on WPF realtime chart |
| Posted by Joe on Nov-10-2025 10:17 |
|
Hi Peter
I am using C# WPFChartViewer for realtime chart. Overall realtime chart is working well, and I need to generate over 200 linecharts on top of exisiting realtime charts.
Program works fine when initially, needed line charts are generated less than 30 or so, but when quantitiies of generated line charts are over 50, overal program responsiveness gets slow. The more linecharts, the slower program becomes.
is there any limits on how many LineLayer charts should be used on realtime chart ? or is there a solution on how to make the program maintain it's fast response just like when there are small numbers of line charts?
Below is the code for line charts generation part
// live identification related variables, in member variable area
static int max_identification_no = 250;
private LineLayer[] live_id_layer = new LineLayer[max_identification_no];
private void drawChart(WPFChartViewer viewer)
{
//// other codes .............
/// code for line_layer generation
/// max_live_number increases as time goes, up to around 200
for (loop_i = 1; loop_i <= max_live_number; loop_i++)
{
live_identification_x_ar[loop_i] = new double[2] { tx_layer_start_x, tx_layer_end_x };
live_identification_y_ar[loop_i] = new double[2] { tx_y_start_value, tx_y_end_value };
live_id_layer[loop_i] = c.addLineLayer(live_identification_y_ar[loop_i], 0x3333FF);
live_id_layer[loop_i].setXData(live_buy_identification_x_ar[loop_i]);
live_id_layer[loop_i].setLineWidth(6);
live_id_layer[loop_i].setUseYAxis2();
}
///// other codes .............
} |
Re: Responsive over many LineLayer on WPF realtime chart |
| Posted by Peter Kwan on Nov-10-2025 19:36 |
|
Hi Joe,
Your code creates many line layers, which each layer contain 1 line segment. All the line styles are identical (same color, same width, use same axis).
Instead, you can consider to create one line layer to contain all the line segments. The x and y arrays are like:
{ x0, x1, Chart.NoValue, x2, x3, Chart.NoValue, x4, x5, Chart.NoValue, ....}
{ y0, y1, Chart.NoValue, y2, y3, Chart.NoValue, y4, y5, Chart.NoValue, ....}
The Chart.NoValue entry ensures the line segments will not join together, so it looks like separate line segments. This works as long as the lines are of the same style and use the same axis.
Another thing to look is the tooltips (if you code use them). Try remove the tooltip line (the getHTMLImageMap line) to see if it makes any difference.
Best Regards
Peter Kwan |
Re: Responsive over many LineLayer on WPF realtime chart |
| Posted by Joe on Nov-11-2025 08:57 |
|
Hi Peter
Thanks for the great idea. I didn't know there is a alternative method to integrate all line layers like your suggestion. I'll implment your method and get back to you with the results. |
Re: Responsive over many LineLayer on WPF realtime chart |
| Posted by Joe on Nov-19-2025 15:28 |
|
Hi Peter.
By implmenting your suggestion, problem of slow response of the system is resolved.
Now it is working relatively ok, without heavy and slow response.
Thanks for helping to solve this issue! |
|