Custom Axis Annotation

In some situations you may need to create custom axis annotation. The following scenarios can be useful for creating custom axis annotation:

      When the ItemsSource property is a collection of numbers or DateTime values the chart uses these values as axis labels. The following code uses the ItemsSource property to create the custom Y-axis labels:

      C#

Here is what the chart appears like after adding the preceding code:

 

      When the ItemsSource property is a collection of KeyValuePair<object, double> or KeyValuePair<object, DateTime> the chart creates axis label based on the provided pairs of values. For example, the following code uses the KeyValuePair to create the custom axis annotation for the Y axis:

      C#

Here is what the chart appears like after adding the preceding code:

 

 

      You can use the ItemsValueBinding and ItemsLabelBinding properties to create axis labels using arbitrary collection as data source, like in the following code:

      C#

Here is what the chart appears like after adding the preceding code:

 


Send us comments about this topic.
Copyright © GrapeCity, inc. All rights reserved.