AxisBase.QualitativeScaleComparer Property

Gets or sets the comparer used to compare deferred-axis qualitative scale values.

Namespace: DevExpress.XtraCharts

Assembly: DevExpress.XtraCharts.v19.2.dll

Declaration

[Browsable(false)]
public IComparer QualitativeScaleComparer { get; set; }
<Browsable(False)>
Public Property QualitativeScaleComparer As IComparer

Property Value

Type Description
IComparer

An object of the class implementing the IComparer interface.

Examples

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

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;
        }
    }
}

Implements

DevExpress.Charts.Native.IAxisData.QualitativeScaleComparer
See Also