We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

Update color of column series based on values?

Thread ID:

Created:

Updated:

Platform:

Replies:

126173 Sep 28,2016 09:52 AM Oct 3,2016 08:18 AM Xamarin.Forms 3
loading
Tags: SfChart
Matthew Sebastian
Asked On September 28, 2016 09:52 AM

We are looking to use the graph component as a live ui warning for the users of our application. We live update the values of a column series, and are looking to color code each item based on a limit, for example 0-100 red, 100-200 green, 200-300 yellow.

I had constructed SeriesBrushes = List<Color>, one per item in our graph. I can set the color initially, but they don't seem to ever change when modified

      <chart:SfChart.Series>
        <chart:ColumnSeries x:Name="popSeries" ItemsSource="{Binding Data}" XBindingPath="Name"
                            YBindingPath="Pop" LegendIcon="Rectangle" Label="Population"
                            ListenPropertyChange="{Binding ListenUpdateChange}"  EnableTooltip="True">
          <chart:ColumnSeries.ColorModel>
            <chart:ChartColorModel Palette="Custom" CustomBrushes="{Binding SeriesBrushes}">
            </chart:ChartColorModel>
          </chart:ColumnSeries.ColorModel>
        </chart:ColumnSeries>
      </chart:SfChart.Series>

Should this work, or is their a better way to programatically change the color of an item in a series live?

Yuvaraj Palanisamy [Syncfusion]
Replied On September 29, 2016 11:50 PM

Hi Matthew Sebastian, 
 
We have prepared a sample as per your requirement. Please find the sample from the below location, 
 
  
Thanks, 
Yuvaraj 
  
  


Matthew Sebastian
Replied On September 30, 2016 10:17 AM

It seems that reassigning the colormodel on each update is what I needed to fix my problem.

I modified the provided sample to change individual points and update their color on the timer. In the meanwhile, I had also reproduced the chart we needed by using a stackedcolumn chart with 3 series, and only using one series per column at a time.

I've attached the modified sample just for reference

Attachment: ModifiedSample_fc20f5ae.7z

Jaikrishna Chandrasekar [Syncfusion]
Replied On October 3, 2016 08:18 AM

Hi Matthew,

We had modified a sample by adding 3 stacking column series and it can be download from the below location

Sample: http://www.syncfusion.com/downloads/support/forum/126173/ze/ModifiedSample_21344766240  

Note: If the provided sample would not meet your requirement, please provide us more details about your requirement, which will help us to provide a better solution.

Regards,
Jaikrishna C

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;