AxisBase.QualitativeScaleComparer Property

Gets or sets the Comparer class object used to compare deferred-axis qualitative scale values.

Namespace: DevExpress.XtraCharts

Assembly: DevExpress.XtraCharts.v21.2.dll


public IComparer QualitativeScaleComparer { get; set; }

Property Value

Type Description

An object of the class that implements the IComparer interface.


How to implement a custom sort order

To implement a custom sort order for qualitative scale values, assign the AxisBase.QualitativeScaleComparer property to an object of a class that implements the IComparer interface.


A complete sample project is available in the following repository:

using System;
using System.Collections;

namespace QualitativeScaleCustomSortOrderSample {
    class NumberComparer : IComparer {
        public int Compare(object x, object y) {
            int iX = NumberConverter.ToInt(x);
            int iY = NumberConverter.ToInt(y);
            return iX - iY;

    class NumberConverter {
        public static int ToInt(object o) {
            string stringNumber = o as string;
            int number = 0;
            if (stringNumber == null) return -1;
            if (Int32.TryParse(stringNumber, out number))
                return number;
            switch (stringNumber.ToLower()) {
                case "one": return 1;
                case "two": return 2;
                case "three": return 3;
            return number;
private void OnLoad(object sender, EventArgs e) {
    XYDiagram diagram = chart.Diagram as XYDiagram;
    if (diagram == null) return;
    diagram.AxisX.QualitativeScaleComparer = new NumberComparer();

How to sort multiple series with different point arguments

This example shows how to use the CaseInsensitiveComparer class to sort multiple series with different point arguments.

private void Form1_Load(System.Object sender, System.EventArgs e){
  chartNewCusts.SeriesTemplate.ValueScaleType = ScaleType.Numerical;
  chartNewCusts.SeriesTemplate.LegendTextPattern = "{V:n}";
  chartNewCusts.SeriesTemplate.CrosshairLabelPattern = "{S} : {V}";
  chartNewCusts.SeriesTemplate.Label.EnableAntialiasing = DevExpress.Utils.DefaultBoolean.True;
  chartNewCusts.SeriesTemplate.Label.Shadow.Visible = false;
  chartNewCusts.SeriesTemplate.Label.TextColor = Color.Black;
  chartNewCusts.SeriesTemplate.Label.ResolveOverlappingMode = ResolveOverlappingMode.HideOverlapped;
  chartNewCusts.SeriesTemplate.LabelsVisibility = DevExpress.Utils.DefaultBoolean.True;
  chartNewCusts.SeriesTemplate.Label.TextPattern = "{V:n0}";
  chartNewCusts.DataSource = GetSales();
  chartNewCusts.SeriesSorting = SortingMode.Ascending;
  chartNewCusts.SeriesDataMember = "GroupField";
  chartNewCusts.SeriesTemplate.ArgumentDataMember = "MonthYear";
  chartNewCusts.SeriesTemplate.ValueDataMembers.AddRange(new string[] { "NewCustCount" });
  XYDiagram diagram = chartNewCusts.Diagram as XYDiagram;
  if (diagram == null)
  diagram.AxisX.QualitativeScaleComparer = new CaseInsensitiveComparer();
    (XYDiagram)chartNewCusts.Diagram.AxisY.Label.TextPattern = "{V:n0}";
    (XYDiagram)chartNewCusts.Diagram.AxisY.Label.EnableAntialiasing = DevExpress.Utils.DefaultBoolean.True;
    (XYDiagram)chartNewCusts.Diagram.AxisX.Label.EnableAntialiasing = DevExpress.Utils.DefaultBoolean.True;
  catch (Exception ex){

private DataTable GetSales(){
  DataTable table = new DataTable("Sample");

  table.Columns.Add("MonthYear", typeof(string));
  table.Columns.Add("GroupField", typeof(string));
  table.Columns.Add("NewCustCount", typeof(int));

  DataRow row;

  row = table.NewRow();
  row("MonthYear") = "01-2015";
  row("GroupField") = "Customer Referral";
  row("NewCustCount") = 1;

  row = table.NewRow();
  row("MonthYear") = "01-2015";
  row("GroupField") = "Walk-In";
  row("NewCustCount") = 1;


  return table;


See Also