Labeling Axes

    Namespace: , it defines options for the scale title. Note that this only applies to cartesian axes.

    Creating Custom Tick Formats

    It is also common to want to change the tick marks to include information about the data type. For example, adding a dollar sign (‘$’). To do this, you need to override the method in the axis configuration.

    • index - the tick index in the ticks array.
    • ticks - the array containing all of the tick objects.

    The call to the method is scoped to the scale. this inside the method is the scale object.

    If the callback returns null or undefined the associated grid line will be hidden.

    The , which is the default x-axis for line and bar charts, uses the index as internal data format. For accessing the label, use this.getLabelForValue(value). API: getLabelForValue

    In the following example, every label of the Y-axis would be displayed with a dollar sign at the front.

    1. return '$' + Chart.Ticks.formatters.numeric.apply(this, [value, index, ticks]);

    Related samples: