configWarnings
Toggles the console warnings d3plus logs when a class receives a config
property it does not support (like a misspelled key passed to .config()
or shapeConfig), or a config key names a data field that no row of the
chart’s data has (like y: "vlaue"). Warnings are on by default and the
setting applies to every chart on the page. With no argument, returns the
current setting.
Basic example
Section titled “Basic example”Every class checks the keys handed to config() and warns once about any it does not support, which catches misspellings such as titel. Press the button to trigger a warning, then untick the box to turn the check off page-wide; with no argument the function reports the current setting.
import {configWarnings, Legend} from "@d3plus/core";
new Legend().config({titel: "Sales"});
// console: Legend received unknown property "titel".
configWarnings(false); // silence the check for every chart on the page
configWarnings();
Missing field warning
Section titled “Missing field warning”A config key given a data field’s name (such as x, y, time, groupBy, sum, size, or color) warns when no row of the chart’s data has that field, naming the key, the field, and the fields the data does have. Each chart warns once per key and field, so redraws stay quiet; a key set to a function is never checked. Pick a key to see the warning for each misspelling.
import {LinePlot} from "@d3plus/core";
new LinePlot() .config({data, groupBy: "region", x: "year", y: "vlaue"}) .render();// console: LinePlot y: no rows have 'vlaue'; fields are: year, value, regionParameters
import {configWarnings} from "@d3plus/core";
_requiredboolean