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

Bar Series colors for each column and ChartTrackBallBehavior not working - Xamarin.Forms

1 Answer 209 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Sudha
Top achievements
Rank 1
Sudha asked on 11 Apr 2017, 02:11 PM

Hi,

I was trying to apply palette for each column a unique color similar to chart.  And also ChartTrackBallBehavior is not working, what am I doing wrong here? P.S. I'm using trial version.

Code in C#:-

var barChart = new RadCartesianChart
                    {
                        HeightRequest = 300,
                        HorizontalAxis = new CategoricalAxis(),
                        VerticalAxis = new NumericalAxis
                        {
                            Minimum = 0,
                            Maximum =100
                        },
                        Palette = customColor,
                        SelectionPalette = customSelectedColor,

                    };

                    barChart.Behaviors.Add(new ChartTrackBallBehavior
                    {
                        ShowTrackInfo = true,
                    });
                    var series = new BarSeries
                    {
                        ItemsSource = ChartData
                    };
                    series.CategoryBinding = new PropertyNameDataPointBinding("Name");
                    series.ValueBinding = new PropertyNameDataPointBinding("Value");

                    barChart.Series.Add(series);

1 Answer, 1 is accepted

Sort by
0
Lance | Manager Technical Support
Telerik team
answered on 12 Apr 2017, 06:59 PM
Hi Sudha,

When you set a palette, it assigns a color per series, not per data point.

For example, let's say you have a custom palette of Blue, Green and Yellow. Then, you add a BarSeries with three bars. They'll all be Blue because it's first color in your custom palette. The only exception to this is the PieSeries type, which uses a different color for each data point.

What you can do is create a new series for every data point, this will apply each color to each series in order. You can find a small demo of this attached to Victor's reply here.

Regarding the TrackBallBehavior, I cannot determine the problem from the code you've provided. Please review this page in the documentation to ensure you've implemented it properly.

Regards,
Lance | Tech Support Engineer, Sr.
Telerik by Progress
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
General Discussions
Asked by
Sudha
Top achievements
Rank 1
Answers by
Lance | Manager Technical Support
Telerik team
Share this question
or