How to display different colors of each point without using a PolarEvent Marker

A forum dedicated to WPF version of LightningChart Ultimate.

Moderator: Queue Moderators

Post Reply
jeonhui
Posts: 4
Joined: Mon Sep 16, 2019 4:02 am

How to display different colors of each point without using a PolarEvent Marker

Post by jeonhui » Mon Sep 23, 2019 12:08 pm

Hello?
First, I am sorry for my poor English.
I am developing a Polar Chart using ViewPolar.
However, there was a problem.
I want to change the color of the area in Sector as shown below.
There is no big problem in recognizing the data in the Sector.
By referring to the Scatter Points Selection in the demo application, the PolarEventMarker was created at the data location within the sector. And changed the color of the generated PolarEventMarker.
There was no problem when using less data. But my program has to display up to 65536 data.
More data in sectors increases the number of PolarEventMarkers to be created.
In this case, I face a performance problem. So I'm going to change the way I develop.
I set the PolarSeriesPoint value.
Set the set PolarSeriesPoint to Points on the PointLineSeriesPolar.
PolarSeriesPoint can set each value, but not color.
I can change color in PointStyle of PointLineSeriesPolar. However, all of PointLineSeriesPolar's points color changes.
Is there a way to color each point without using the PolarEventMarker?
Or, even with the PolarEventMarker, Is there a way to display 65536 PolarEventMarkers without performance issues?
Could you let me know if there's anything I don't know?
I attach a picture so that you can understand my question.
This is a picture of my application.


1.png
1.png (107.47 KiB) Viewed 4051 times
1-2.png
1-2.png (148.67 KiB) Viewed 4051 times


In the above cases, the data are all the same location. However, there are other cases in my software.
The picture below is an example.


2.png
2.png (198.86 KiB) Viewed 4051 times



I hope my intentions are well conveyed.
I know you're busy, but thank you for your time.

Arction_LasseP
Posts: 141
Joined: Wed Mar 27, 2019 1:05 pm

Re: How to display different colors of each point without using a PolarEvent Marker

Post by Arction_LasseP » Tue Sep 24, 2019 7:42 am

Hello Jeonhui,

EventMarkers use more resources than standard data points which is why they are not optimal to use when there are tens of thousands of points. Therefore, using just multicolored SeriesPoints is recommended. The problem is that PointLineSeriesPolar doesn't currently support individual point coloring as for example PointLineSeries in ViewXY does. There is ColorStyle -property which allows coloring the Series based on Amplitude, Angle or Value -fields of the data points, but the coloring only applies to the line, not the points.

Displaying different colors can still be achieved by using multiple series, in this case two with different point colors are enough (disable ShowInLegendBox if you only want to show one series there). Store the data points to an array, and then whenever you define a new sector, divide the data points between the two series based on if they are inside the sector or not. Here is a simple example about dividing the points:

Code: Select all

private PolarSeriesPoint[] points = null; // Insert your data points to an array like this


_chart.ViewPolar.PointLineSeries[0].Clear(); // Clear the existing data points
_chart.ViewPolar.PointLineSeries[1].Clear();

foreach (PolarSeriesPoint pn in points) // Dividing the points between the two series
            {
                if (pn.Amplitude >= sector.MinAmplitude && pn.Amplitude <= sector.MaxAmplitude && 
                pn.Angle >= sector.BeginAngle && pn.Angle <= sector.EndAngle)
                {
                    _chart.ViewPolar.PointLineSeries[1].AddPoints(new PolarSeriesPoint[1] { new PolarSeriesPoint(pn.Angle, pn.Amplitude) }, false);
                }
                else
                {
                    _chart.ViewPolar.PointLineSeries[0].AddPoints(new PolarSeriesPoint[1] { new PolarSeriesPoint(pn.Angle, pn.Amplitude) }, false);
                }
            }

Hope this helps.
Best regards,
Lasse

Post Reply