@chartguard/quality-highcharts
v0.1.1
Published
highcharts quality adapter starter
Readme
@chartguard/quality-highcharts
Advisory quality review of Highcharts configs: it reads the chart the config describes (what the runtime would draw, with its defaults) and reports presentation problems such as bars that do not start at zero, unreadable colours or charts assistive technology cannot describe. Findings are advice, never a verdict: there is no error severity and no valid.
Status: pre-release (0.x). Coverage is partial, and the API and settings may still change between minor versions.
npm install @chartguard/quality-highchartsimport { analyze } from "@chartguard/quality-highcharts";
const report = analyze({ chart: { type: "column" }, yAxis: { min: 50 }, series: [{ type: "column", data: [60, 70] }] });
for (const finding of report.diagnostics) console.log(finding.code, finding.path, finding.message, finding.fix);- Rules: the shared catalog of
@chartguard/quality-core(RULE_CATALOG: each rule with its rationale, sources and documented limits).analyze(config, { rules: { "value-axis-untitled": "off" } })sets a rule's level (off,info,warning);rulesetpicks rules by id or impact. - Context: facts the chart leaves to the page (
context: { background: "#ffffff" }) let rules decide what the config alone cannot; a finding the context or a setting suppresses is kept inreport.suppressed, with why. - Fixes: a finding may carry a
set-optionfix, offered only when it is verified to remove the finding without a new one. It changes what is drawn: apply it (applyFixfrom@chartguard/core) only at the user's request. - Unknown stays unknown: a fact the config does not decide (an option set by a callback, a size-dependent range) is unknown, and no rule claims anything on it.
normalize(config)gives the library-neutralChartSemanticsthe rules read; invalid options throwQualityOptionsError(assertQualityOptionschecks them up front).
