Skip to main content

AxisBase.QualitativeScaleComparer Property

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

Namespace: DevExpress.XtraCharts

Assembly: DevExpress.XtraCharts.v22.2.dll

NuGet Package: DevExpress.Charts


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;


The following code snippets (auto-collected from DevExpress Examples) contain references to the QualitativeScaleComparer property.


The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

See Also