This is a migrated thread and some comments may be shown as answers.
How to Use Line and ScatterPoint Palette?
1 Answer 9 Views
This is a migrated thread and some comments may be shown as answers.
Ingrid
Top achievements
Rank 1
Ingrid asked on 25 Sep 2018, 06:55 AM

Hello,

I have 3 chart series on my page, bar, line, and scatterpoint.
I successfully make the bar to be coloured (5 colours) as i programmed. But there is no PaletteMode property on LineSeries and ScatterPointSeries.
Why and How the code should be?

Here is my code,
this code only make the line and scatterpoint series 1 color, while my _viewmodel.CustomPalette has actually 5 colours (with 5 items).

 

 

01.void setChartData()
02.{
03.    chartView.Children.Clear();
04. 
05. 
06.    string itemSource = "_SummaryList";
07.    string categoryBinding = "Short_Name";
08.    string valueBinding = _viewmodel.ChartValue;
09. 
10.    var hAxis = new CategoricalAxis();
11.    hAxis.LabelFontSize = 6;
12. 
13.    var vAxis = new NumericalAxis();
14.    vAxis.LabelFontSize = 7;
15.    vAxis.LabelFormat = "#,#.#";
16. 
17.    var chart = new RadCartesianChart
18.    {
19.        HorizontalAxis = hAxis,
20.        VerticalAxis = vAxis,
21.        VerticalOptions = LayoutOptions.FillAndExpand,
22.        HorizontalOptions = LayoutOptions.FillAndExpand
23.    };
24. 
25.    switch (_viewmodel.ChartType)
26.    {
27.        case "Bar":
28.            var bar = new BarSeries();
29.            bar.SetBinding(ChartSeries.ItemsSourceProperty, new Binding(itemSource));
30.            bar.ValueBinding = new PropertyNameDataPointBinding(valueBinding);
31.            bar.CategoryBinding = new PropertyNameDataPointBinding(categoryBinding);
32.            bar.PaletteMode = SeriesPaletteMode.DataPoint;
33.            bar.ShowLabels = true;
34.            chart.Series.Add(bar);
35.            chart.Palette = _viewmodel.CustomPalette;
36.            break;
37.        case "Line":
38.            var lines = new LineSeries();
39.            lines.SetBinding(ChartSeries.ItemsSourceProperty, new Binding(itemSource));
40.            lines.ValueBinding = new PropertyNameDataPointBinding(valueBinding);
41.            lines.CategoryBinding = new PropertyNameDataPointBinding(categoryBinding);
42.            lines.ShowLabels = true;
43.            chart.Series.Add(lines);
44.            chart.Palette = _viewmodel.CustomPalette;
45.            break;
46.        case "Point":
47.            var point = new ScatterPointSeries();
48.            point.SetBinding(ChartSeries.ItemsSourceProperty, new Binding(itemSource));
49.            point.YValueBinding = new PropertyNameDataPointBinding(valueBinding);
50.            point.XValueBinding = new PropertyNameDataPointBinding(categoryBinding);
51.            point.ShowLabels = true;
52.            chart.Series.Add(point);
53.            chart.Palette = _viewmodel.CustomPalette;
54.            break;
55.    }
56. 
57.    chartView.Children.Add(chart);
58.}

1 Answer, 1 is accepted

Sort by
0
Yana
Telerik team
answered on 27 Sep 2018, 12:49 PM
Hi Ingrid,

Indeed, PaletteMode property is available only for BarSeries.  Actually, I am not sure how such a property would be applicable to LineSeries, could you elaborate more on this?

As to the ScatterPointSeries - I would suggest you log a feature request for this in our public feedback portal at the link below:
https://feedback.telerik.com/Project/168/Feedback/List/All%20Feedback

In this way we could track the demand and plan it accordingly.

Regards,
Yana
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
Ingrid
Top achievements
Rank 1
Answers by
Yana
Telerik team
Share this question
or