This is a migrated thread and some comments may be shown as answers.

Point Color

3 Answers 74 Views
Chart
This is a migrated thread and some comments may be shown as answers.
Ruben
Top achievements
Rank 1
Ruben asked on 04 Sep 2017, 06:19 PM
Is there a way to have a different colors for different point on a single line for TKChartLineSeries?

3 Answers, 1 is accepted

Sort by
0
Stefan Nenchev
Telerik team
answered on 06 Sep 2017, 08:40 AM
Hi Ruben,

We have a demo in the iOS Samples application that shows how to create custom point labels. I believe with the proper modifications it will fit your requirement. Please have a look at it, you can find it in your local Telerik UI for Xamarin installation. Simply navigate to the Examples/iOS folder and have a look at the Chart/PointLabels/CustomPointLabel implementation once you have opened the solution.

Regards,
Stefan Nenchev
Progress Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Ruben
Top achievements
Rank 1
answered on 06 Sep 2017, 12:55 PM

Thanks for the reply. However, my question is about points themselves, not point labels. I already figured out how to have different colors for points on a single series but now can't find a way to do the same for point shapes? Can I have points of different shapes on a single series?

0
Stefan Nenchev
Telerik team
answered on 08 Sep 2017, 08:56 AM
Hello Ruben,

You can change the color of the points as well by overriding the PaletteItemForPoint(shown in the demo - CustomPointLabels.cs):

public override TKChartPaletteItem PaletteItemForPoint (TKChart chart, nuint index, TKChartSeries series)
            {
                if (series.Index == (nuint)this.selectedSeriesIndex && index == (nuint)this.selectedDataPointIndex) {
                    return new TKChartPaletteItem (new TKStroke (UIColor.Black, 2.0f), new TKSolidFill (UIColor.White));
                }
 
                if (series.Index == 0) {
                    return new TKChartPaletteItem (new TKSolidFill (new UIColor ((float)(108 / 255.0), (float)(181 / 255.0), (float)(250 / 255.0), (float)1.0)));
                }
 
                return new TKChartPaletteItem (new TKSolidFill(UIColor.Green));
            }
You can return different palette item according to your custom logic.

Unfortunately, it would not be possible to assign different shapes for the points of the same series.

Have a great weekend.

Regards,
Stefan Nenchev
Progress Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
Chart
Asked by
Ruben
Top achievements
Rank 1
Answers by
Stefan Nenchev
Telerik team
Ruben
Top achievements
Rank 1
Share this question
or