Page 1 of 1

2D points custom coloring

Posted: Fri Aug 12, 2016 1:58 pm
by Andre03931
Hello!

I'm using WinForms 2D chart with PointLineSeries as a scatter plot (Trial version).
And I need each point to have its own color depending on some parameter's value (not point's coordinates).
I couldn't achieve this with Palette.

Could you suggest me if it is possible to do this.
Thanks.

Re: 2D points custom coloring

Posted: Fri Aug 12, 2016 2:56 pm
by ArctionPasi
Hi!

You can achieve that best by placing SeriesEventMarker on each data point location. You can give individual color and shape for every marker, and you can have thousands of them in the chart. To hide the label of the marker, set marker.Label.Visible = False.

I hope this helps ;)

Re: 2D points custom coloring

Posted: Fri Aug 12, 2016 6:27 pm
by Andre03931
Thanks for the quick response.

Using SeriesEventMarker instead of SeriesPoint helped me to solve the problem with the color of the point, but significantly reduced the performance.
So much so that the application starts to have lags after 5-10 seconds.

I have 10 charts and i need to add 50 points and move them along axisX during 10 minutes.
But with SeriesEventMarker my application can not withstand the load even with one chart not speaking about 10 charts.
But if i use SeriesPoint performance is really good!

I used this code to test SeriesEventMarker:

Code: Select all

private void timer1_Tick(object sender, EventArgs e)
{
    Random rand = new Random();

    for (int i = 0; i < 50; i++)
    {
        SeriesEventMarker sem = new SeriesEventMarker();

        sem.XValue = 0;
        sem.YValue = rand.Next(0, 90);

        sem.MoveByMouse = false;

        sem.Label.Visible = false;

        sem.Symbol.Color1 = (i % 3 == 0) ? Color.Aqua : (i % 2 == 0) ? Color.Red : Color.Blue;

        sem.Symbol.Shape = Shape.Circle;

        fpls1.SeriesEventMarkers.Add(sem);
    }

    for(int i = 0; i < fpls1.SeriesEventMarkers.Count; i++)
        fpls1.SeriesEventMarkers[i].XValue += 10;
}
Maybe I'm doing something wrong?

To be honest, it would be great If I could use Palette based on my parameter's value (not coordinates one).

Thanks.

Re: 2D points custom coloring

Posted: Fri Aug 12, 2016 6:36 pm
by ArctionPasi
Please use chart.BeginUpdate() ... chart.EndUpdate around your code, otherwise it will refresh on every marker adding and property change, causing major slowdown.

Re: 2D points custom coloring

Posted: Sat Aug 13, 2016 4:05 pm
by Andre03931
Even if I use chart.BeginUpdate() ... chart.EndUpdate() my application does not handle the load.

Maybe there is another way add points with individual color and not lose performance?

Link to my project:
https://drive.google.com/open?id=0B0omc ... 3hib2l4cTg

Re: 2D points custom coloring

Posted: Sun Aug 14, 2016 7:27 pm
by ArctionPasi
Hello,

thanks for sending the project. I used 9 charts, and pushed like 3000 markers in each chart. Yes, it gets slow with this marker amount. I was expecting pretty much a number like that.

Currently there's no other solution to color each data point individually.

Could you please contact our support by e-mail, introduce yourself, and ask about availability of custom point coloring built-in to the series. I briefly investigated our code and it looks coloring for requires work and API changes, but performance should be totally different from the 'markers' approach.

Re: 2D points custom coloring

Posted: Mon Aug 15, 2016 10:54 am
by Andre03931
Thank you for your help.
I will try to contact the support by e-mail with my problem.