Smarter Charts From the Start: Meet `autoDefaults`

Good chart defaults are invisible when they are right and infuriating when they are wrong. A color scale that diverges from a meaningful zero. A date axis spaced like plain categories. A legend of two hundred flat swatches where a smooth gradient would have told the whole story. Each of these is fixable by hand — but only if you know the parameter, remember to set it, and do it again on the next chart.

CanvasXpress now folds a whole bundle of data-driven presentation choices behind a single opt-in flag: autoDefaults. Turn it on, and the engine inspects your data and config and applies the sensible presentation defaults automatically. Leave it off — which is the default — and every existing chart renders exactly as it always has.

new CanvasXpress({
  renderTo: 'chart',
  data: myData,
  config: {
    graphType: 'Scatter2D',
    autoDefaults: true
  }
});

That one flag is the whole interface. Here is what it does on your behalf.

Color that understands your numbers

When you color points or cells by a continuous value, the right spectrum depends on the data. If every value sits on one side of zero, a sequential ramp — light to saturated — reads cleanly. If the values straddle zero, a diverging spectrum anchored at zero is the honest choice, because it shows direction as well as magnitude. With autoDefaults on, CanvasXpress detects the sign range and picks the matching spectrum for you, instead of defaulting to one scheme and hoping it fits.

Two more color behaviors come along:

Dates that behave like dates

Feed a chart a sample axis of dates and, by default, those dates are treated as evenly spaced labels — January 1 and January 2 sit the same distance apart as January 2 and March 15. That is rarely what you want. With autoDefaults, when the engine recognizes date values it switches the axis to a proportional time scale, so the spacing reflects real elapsed time. Line charts, area charts, and time-based scatter plots all read correctly.

Legends and layouts tuned to the chart

A few more refinements round out the bundle:

Domain-aware defaults for KM and Volcano plots

Two chart families that scientists lean on get first-class treatment:

The design principle: opt in, override anything

Two decisions make autoDefaults safe to adopt.

First, it is a single master flag. You do not learn a dozen sub-parameters; you flip one switch and get the coherent bundle. That matters most for the tools that sit on top of CanvasXpress — the R and Python packages, the command-line renderer, generated configs — which can now request good defaults with one key instead of re-deriving each behavior themselves.

Second, it never fights you. Every behavior inside the bundle checks whether you have already set the relevant option, and if you have, your choice wins. autoDefaults fills in what you left unspecified; it does not overrule what you decided. Set your own color scheme and the many-series rule steps aside. Pin your own legend and the nested-bubble default yields. The flag composes with your config rather than replacing it.

And because the default is off, turning it on is a purely additive choice. Nothing in your existing charts moves until you ask. When you do ask, you get a set of presentation decisions that a thoughtful analyst would have made anyway — applied consistently, every time, across every chart you render.

Why bother

The value is not that any one of these behaviors is impossible today — all of them were reachable with the right parameters. The value is that you no longer have to know them, remember them, or repeat them. A continuous legend here, a diverging ramp there, a proper time axis, a volcano plot that arrives annotated: these are the small correctnesses that separate a chart that merely plots the data from one that actually communicates it.

Flip one flag and let the engine handle the ones you would otherwise have to hand-set, one config at a time, forever.