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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

ColumnSeries chart color

Thread ID:





119662 Jul 20,2015 01:45 PM UTC Jul 21,2015 06:24 AM UTC Windows Phone 1
Tags: Chart
Asked On July 20, 2015 01:45 PM UTC


I need to implenment a chart that if the value is possitive the bar color should be green, if the value is negative the color should be red, here is the data model:

    class DataModel
        public DateTime DataDate { get; set; }
        public float DataValue{ get; set; }
        public Color Foregroud
                if (DataValue> 0)
                    return Colors.Green;
                    return Colors.Red;

and here is the xaml:

        <Charts:SfChart x:Name="cMainIO" Grid.Row="1">
                <Charts:CategoryAxis x:Name="Primaryx" LabelFormat="MM/dd" />
            <!--SecondaryAxis with range customization-->
                <Charts:NumericalAxis RangePadding="Round" StartRangeFromZero="False" />
            <Charts:ColumnSeries ItemsSource="{Binding}" XBindingPath="DataDate" YBindingPath="DataValue" Interior="{Binding Foregroud, Mode=OneWay}" />

When I run the app the color of bars are still blue,

How to fix it?

Rachel A [Syncfusion]
Replied On July 21, 2015 06:24 AM UTC

Hi William,

Thank you for contacting Syncfusion support.

Query: How to implement a chart that if the value is positive the bar color should be green, if the value is negative the color should be red?

We can achieve your requirement using CustomTemplate property in ColumnSeries which allows customize the series.

Please find the output image as shown below.

We have prepared sample for you reference and please find the sample in the below location.

Sample: ColumnSeriesInterior

Please refer the below documentation for more information.

Link: http://help.syncfusion.com/ug/wpf/Documents/customizeseries.htm

Please let us know if you require any further assistance.

Rachel. A


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.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon 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.Close Icon