Run Your Axis Backwards: First-Class Reversed Numeric Axes in CanvasXpress

Some data reads most naturally from high to low. Think of a timeline measured in "years before present," a depth profile where zero is the surface and larger numbers go deeper, a countdown, or a ranking where the best score should sit on the left. For charts like these you want a numeric axis that runs from the large value down to the small one — high on the left, low on the right, or top to bottom.

Until now the honest workaround was to negate your data and live with the consequences: your tick labels would show the wrong signs, and anyone reading the chart had to mentally flip every number. CanvasXpress now solves this properly. Both the x-axis and the y-axis accept a documented reverse transform that flips the drawing direction while keeping your real, positive values on the labels.

How it works

The axis transform options you already use — log scales, square-root, percentile — now include reverse. Set it on whichever axis you want to run backwards:

new CanvasXpress("canvas", {
  graphType: "Scatter2D",
  data: { /* your trajectory data */ },
  xAxisTransform: "reverse"
});

That one line makes the x-axis run high to low. Your tick labels stay as they are — if your data runs from 10000 down to 0, the axis reads 10000 on the left and 0 on the right, with correct, positive numbers at every tick. The same applies to the y-axis with yAxisTransform: "reverse".

This matters because the alternative — flipping the sign of the underlying values — corrupts the one thing a chart must get right: the labels. With a proper reverse transform, the data you loaded is the data that shows, and only the visual direction changes.

Overlays come along for the ride

A reversed axis is only useful if everything drawn on the chart respects it. A reversed scatter where the trend line, confidence band, or reference line still pointed the old way would be worse than no reverse at all.

So the reverse transform extends through the overlays, not just the points and ticks. Confidence ribbons, zero lines, ellipses, polygons, and design-of-experiments overlays all honor the reversed direction on both axes. The motivating case was a trajectory chart with a shaded confidence band plotted against a backward-running time axis: the band now sits correctly on the line instead of appearing mirrored. If you plot a forecast with its uncertainty ribbon on a reversed axis, the ribbon tracks the forecast exactly as it should.

Gridlines, log-scale ticks, and mark positions all move together, so the whole chart is internally consistent whichever direction you choose.

A concrete example

Say you are plotting an allele-frequency trajectory against time measured in years before present, with a confidence band:

new CanvasXpress("canvas", {
  graphType: "Scatter2D",
  data: { /* frequency over time, with band bounds */ },
  xAxisTransform: "reverse",
  scatterType: "line",
  ribbonBy: "CI"
});

The oldest time (the largest number) sits on the left, the present (zero) on the right, the line reads left to right as time moves forward, and the confidence ribbon hugs the line throughout. The axis labels are the actual years, positive and correct.

The safety property: off by default, nothing moves

A feature like this is only trustworthy if turning it on is the only thing that changes. The reverse transform defaults to off, and when it is off every chart renders exactly as it did before — down to the byte, as far as CanvasXpress's own saved-image output is concerned. You do not have to worry that adding reverse support quietly shifted any of your existing charts. Reverse is a direction flag you opt into per axis, and it touches nothing until you ask for it.

Where you can use it

Reverse is a transform on the numeric axis itself, so it is available wherever those axes are: scatter plots, line and area charts, and the other graph types that draw on a continuous x or y axis. Because it lives alongside the other axis transforms, it is discoverable in the same place — plain-language requests like "reversed axis," "descending axis," "flip the axis," or "high-to-low axis" all resolve to it.

Try it today

If your data has a natural high-to-low reading order, you no longer have to fight the chart to show it. Add xAxisTransform: "reverse" or yAxisTransform: "reverse", keep your real values, and let CanvasXpress handle the direction — overlays, ticks, gridlines, and all. It is available now, and like the rest of CanvasXpress, a chart you build with it saves to a PNG that carries its own reproducible configuration, so the reversed view travels with the image.