2D points custom coloring

A forum dedicated to WinForms version of LightningChart Ultimate.

Moderator: Queue Moderators

Post Reply
Andre03931
Posts: 4
Joined: Tue Aug 09, 2016 10:04 am

2D points custom coloring

Post by Andre03931 » Fri Aug 12, 2016 1:58 pm

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.

User avatar
ArctionPasi
Posts: 1367
Joined: Tue Mar 26, 2013 10:57 pm
Location: Finland
Contact:

Re: 2D points custom coloring

Post by ArctionPasi » Fri Aug 12, 2016 2:56 pm

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 ;)
LightningChart Support Team, PT

Andre03931
Posts: 4
Joined: Tue Aug 09, 2016 10:04 am

Re: 2D points custom coloring

Post by Andre03931 » Fri Aug 12, 2016 6:27 pm

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.

User avatar
ArctionPasi
Posts: 1367
Joined: Tue Mar 26, 2013 10:57 pm
Location: Finland
Contact:

Re: 2D points custom coloring

Post by ArctionPasi » Fri Aug 12, 2016 6:36 pm

Please use chart.BeginUpdate() ... chart.EndUpdate around your code, otherwise it will refresh on every marker adding and property change, causing major slowdown.
LightningChart Support Team, PT

Andre03931
Posts: 4
Joined: Tue Aug 09, 2016 10:04 am

Re: 2D points custom coloring

Post by Andre03931 » Sat Aug 13, 2016 4:05 pm

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

User avatar
ArctionPasi
Posts: 1367
Joined: Tue Mar 26, 2013 10:57 pm
Location: Finland
Contact:

Re: 2D points custom coloring

Post by ArctionPasi » Sun Aug 14, 2016 7:27 pm

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.
LightningChart Support Team, PT

Andre03931
Posts: 4
Joined: Tue Aug 09, 2016 10:04 am

Re: 2D points custom coloring

Post by Andre03931 » Mon Aug 15, 2016 10:54 am

Thank you for your help.
I will try to contact the support by e-mail with my problem.

Post Reply