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:
- Many series collapse into a spectrum. Past a threshold of distinct series, a qualitative palette stops being legible — the colors start repeating and the eye cannot tell them apart. When the series count crosses that line and you have not chosen a scheme yourself, the engine switches to a continuous spectrum so a crowded chart stays readable.
- Ranked data gets a sequential ramp. When the thing you are coloring by is a rank or ordinal order, a sequential scheme applied in rank order (Viridis) communicates the ordering far better than arbitrary categorical hues.
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:
- Nested size legends. When points are scaled by a numeric value, the size legend renders as concentric nested bubbles rather than a flat list — a more compact, more intuitive key.
- Categorical scatter becomes a strip plot. A scatter plot with one categorical axis and one continuous axis is really a strip plot in disguise. Rather than squashing categories onto a point axis, the engine promotes it to a proper strip/dotplot layout, with one band per category and jittered points.
Domain-aware defaults for KM and Volcano plots
Two chart families that scientists lean on get first-class treatment:
- Kaplan–Meier curves automatically show the log-rank p-value and the at-risk table — the context a survival curve is almost always presented with — without you enabling each one.
- Volcano plots automatically draw the fold-change and p-value cutoff lines that define significance, so the chart arrives ready to read.
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.