Replacing numeric labels with text on linear axis

Feb 5, 2014 at 1:16 PM
Hi,

I would like to create a Bar chart that shows the progress of items through an established workflow.

For example: A made up order system has the following stages:

1) Credit check
2) Credit approved
3) Order dispatched
4) Order received
5) Order closed

What I’d like to do is have open orders listed vertically on a category axis and then bar the will show how far through the life-cycle the order is. Using a linear axis and the numerical value of the status this can be done easily. What I’d like is to replace the number on the axis with the stage, eg: 2 would be shown as Credit Approved

Is this possible ?

thanks,
rob
Feb 14, 2014 at 4:07 PM
try to create a custom Axis class and override the Axis.FormatValue method.
    public class MyLinearAxis : LinearAxis
    {
        public override string FormatValue(double x)
        {
            switch ((int)x)
            {
                case 1:
                    return "Credit check";
                    // etc.
                default:
                    return string.Empty;
            }
        }
    }
We could add a Func<double,string> property to the Axis class if this is a frequently needed feature. Something like this:
        public Func<double, string> LabelFormatter { get; set; }

        public virtual string FormatValue(double x)
        {
            if (this.LabelFormatter != null)
            {
                return this.LabelFormatter(x);
            }

If you want this included in the library:
  1. create an issue
  2. create a fork
  3. add some unit tests
  4. implement
  5. submit including issue #
  6. make a pull request.