Sliding series styles shift upon Points.RemoveAt(0)

Hi there, I have a chart series to which a new point is added every second. The symbol is colored using 

series.Styles[series.Points.Count-1].Symbol.Color=e.g. red or green. When the series length reaches the display window width in terms of X units, the first point is removed by RemoveAt(0) to prevent the series from growing to infinity. This is good, but the styles shift and suppose every even point was red, now every odd point switches to red from green.

How can I preserve the colors? ( E.g. candles don't change color ).     


5 Replies

NT Nitheeshkumar Thangaraj Syncfusion Team August 30, 2023 07:58 AM UTC

Hi Gyorgy,


Rather than using series. Styles for applying colors, you can achieve your requirement by utilizing a color palette based on series points. You can find detailed information and guidance in the respected User Guide (UG) link provided below:


UserGuide Link


If you encounter any issues with the provided response or need further assistance, please feel free to reach out, and we will be happy to provide a better solution.


Regards,

Nitheeshkumar



GG Gyorgy Gorog August 30, 2023 08:30 AM UTC

Nitheeshkumar, this seems to solve the problem for one series, but I have more than one and at least one has alternating symbol shapes too (triangle and inverted triangle). Meanwhile I am trying this but it does not work: 

private void ShiftSeries( ChartSeries series ) {

    series.Points.RemoveAt(0);

    for( int i = 0; i < series.Points.Count - 1; i++ )

        series.Styles[i].Symbol = series.Styles[i+1].Symbol;

}




NT Nitheeshkumar Thangaraj Syncfusion Team August 31, 2023 10:55 AM UTC

Hi Gyorgy,


Currently, our development team is investigating your query. We will thoroughly validate it and provide an update within two business days (September 04, 2023).


Regards,

Nitheeshkumar.



GG Gyorgy Gorog September 4, 2023 06:04 PM UTC

Nitheeshkumar, from my side there is no urgency as I solved the problem with system.Charting. For a general audience, pls consider if you want to address it at all. If you do, I am willing to test your solution.

Thanks for your efforts.



NT Nitheeshkumar Thangaraj Syncfusion Team September 5, 2023 11:27 AM UTC

Hi Gyorgy,


We happy to hear that you can achieve this requirement, and as discussed this with our development team. The most recommended solution is to change the symbol based on the segment color, and we have provided the user guide link below for reference. We will consider this case in the future. Thank you for the update.


https://help.syncfusion.com/windowsforms/chart/chart-appearance#applying-custom-color-to-segment



Regards,

Nitheeshkumar.


Loader.
Up arrow icon