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

2 posts, 0 answers
  1. Sudha
    Sudha avatar
    3 posts
    Member since:
    Apr 2017

    Posted 11 Apr Link to this post


    I was trying to apply palette for each column a unique color similar to pie 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");


  2. Lance | Tech Support Engineer, Sr.
    Lance | Tech Support Engineer, Sr. avatar
    457 posts

    Posted 12 Apr Link to this post

    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.

    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
Back to Top