Plotly Chart Guidelines

From Tygron Support wiki
Revision as of 14:04, 1 December 2026 by Frank@tygron.nl (talk | contribs)
Jump to navigation Jump to search

This page contains tips on adding a Plotly Chart to a Text Panel content successfully. It focuses on correct Plotly figure construction, visual tuning, and rendering-quality checks. For panel lifecycle topics (severity grading, timeout-safe authoring workflow, unique names and collision handling, QA sign-off criteria, and common failure signatures), see Text Panel Content Guidelines.

Top 5 Failure Modes

These are the most frequently observed defects across production panels. Address them first during self-review:

Rank Defect Symptom Fix
1 Vertical overflow x-axis labels or footnote clipped at panel bottom Set chart div height to panel height minus all other elements (see height budget)
2 Coolest bar renders gray/white Minimum-value bar looks like missing data on a Reds scale Pad `cmin` below the data minimum (see color domain)
3 Colorscale has no effect All bars render in default blue despite declaring `colorscale: "Reds"` Add `marker.color: values` to the trace (see coloring)
4 Literal `°C` in labels/tooltips Degree sign shows as raw entity text Use `\u00B0` or literal `°` inside JavaScript strings (see encoding)
5 Zero-baseline or over-wide axis All bars look the same height over a narrow data band Use a data-driven `yaxis.range` with padding (see axis scaling)

Figure Anatomy

Every Plotly figure is built from up to four arguments passed to `Plotly.newPlot`:

Plotly.newPlot(divId, traces, layout, config);
  • traces – an array of trace objects. Each trace describes one dataset (a set of bars, a line, etc.). Properties such as `type`, `x`, `y`, `marker`, `text`, `textposition`, and `showlegend` belong here.
  • layout – a single object controlling axes, margins, titles, annotations, and global appearance. Properties such as `xaxis`, `yaxis`, `margin`, `title`, `barmode`, `paper_bgcolor`, and `plot_bgcolor` belong here.
  • config – controls interactivity. The standard setting for Tygron Text Panels is:
const config = { staticPlot: false, displayModeBar: true };

All code snippets below indicate in a comment whether they target a trace or the layout. See How to insert a Plotly Graph for the full setup including CSS sizing and the staticPlot flag.

Loading Plotly correctly

Plotly is available inside Text Panels without manually loading an external CDN script. When the panel content contains the capitalized word `Plotly`, the platform injects the required script reference. The `$LIB_PLOTLY` tag can also be used where an explicit script entry is preferred.

Do not add CDN script tags. Avoid adding external Plotly CDN script tags (e.g. `https://cdn.plot.ly/plotly-*.min.js`). Manual CDN loading can cause:

  • duplicate library loading,
  • version mismatches,
  • offline rendering failures,
  • content-security-policy problems.

Execution timing

Because TQL tags are replaced before the HTML is rendered, chart code can normally run immediately after the static values are available. Avoid gating the entire chart behind `window.load` unless there is a specific reason to do so—a `window.load` handler can leave the chart blank if the expected load sequence does not occur.

Property name accuracy

Use `margin`, not `margins`, in the Plotly layout object. Incorrect property names fail silently and produce unexpected spacing.

Scoping

Wrap chart code in an IIFE or clearly scoped script block to avoid leaking variables into the global panel scope.

Avoid duplicate titles

Do not declare both an HTML `<h2>` title and a `layout.title` in the Plotly configuration. Doing so produces a ghost/duplicate title that overlaps or stacks awkwardly. Choose one:

  • Preferred: use the HTML `<h2>` for the panel title and omit `layout.title`.
  • Alternative: use `layout.title` and omit the HTML heading.

Safe DOM Order and Panel Height Budget

Two layout defects dominate failed panels: the chart container appearing before the title in the DOM, and the total content height exceeding the fixed panel height.

DOM order

The recommended DOM order for a chart panel is:

  1. `<h2>` title
  2. `<p>` subtitle
  3. chart container `<div>`
  4. footnote `<p>` (if present)
  5. `<script>` initialisation

Placing the chart container before the title can push the title below the visible area in fixed-height panels. Even if a screenshot appears correct, the stored DOM order should still be reviewed.

Total height budget

A panel has a fixed pixel height (e.g. 1000 px). The sum of all elements must fit within that height:

// Example budget for a 1000 px panel
title        ≈  40 px
subtitle     ≈  30 px
chart div    ≈  850 px   ← leave headroom
footnote     ≈  30 px
padding      ≈  50 px
─────────────────────
total        ≈ 1000 px
  • Set the chart `<div>` height to `panel_height − (title + subtitle + footnote + padding)`, typically 80–90 % of the panel height.
  • Set `layout.height` to the same value as the `<div>` height.
  • Do not set `layout.height` to the full panel height when the panel contains additional HTML above or below the chart.
  • After any change to panel size, recalculate and re-verify the rendered image.

Anti-pattern: Setting the chart `<div>` to 1000 px inside a 1000 px panel that also contains a title, subtitle, and footnote guarantees vertical overflow. The chart will consume the full panel height, pushing the x-axis labels and any footnote below the visible fold.

A panel that requires scrolling to reveal axis labels or values should be resized or simplified.

Width budget

Account for horizontal space as well:

  • A colorbar consumes approximately 60–80 px on the right side.
  • Long category labels with rotation consume additional left/right margin.
  • Set `layout.margin.r` to accommodate the colorbar (typically 70 px).
  • If the panel width is constrained, prefer shorter labels or a horizontal bar orientation.

Avoid overflow:hidden

Do not use `overflow: hidden` on the panel or chart container. It silently clips axis labels, footnotes, and no-data messages. Verify that the last x-axis label is fully visible and that footnotes and no-data messages remain visible.

Full details: Layout, height budget, and clipping prevention.

Axis Scaling and Label Readability

A common defect is using a zero baseline or an overly wide axis when the data occupies a narrow band. This is especially relevant when comparing Grid Overlay values across Neighborhoods or Areas, where values often fall within a tight range.

Design requirement: labels must be readable. Every axis tick, category label, value annotation, and colorbar title must be legible at the rendered panel size. If a label is clipped, rotated beyond recognition, or too small to read, the chart fails regardless of data accuracy.

When to avoid a zero baseline

Avoid forcing the axis to zero when:

  • the data range is narrow,
  • zero is not a meaningful reference,
  • the purpose is to compare small differences between categories.

Example situation:

  • all values are within a few units of each other,
  • a zero baseline makes all bars look almost identical.

In that case, use a data-driven range.

Concrete example: narrow-band data

Consider PET values spanning 39.3–42.6 °C (a 3.3 °C spread):

  • A zero-baseline axis (`range: [0, 45]`) makes all nine bars reach nearly the same height—differences are invisible.
  • An over-wide axis (`range: [30, 50]`) wastes ~60 % of vertical space and still obscures inter-neighborhood differences.
  • A fitted axis (`range: [38.5, 43.5]`) makes the 3.3 °C spread clearly visible.

Data-driven range

First compute the bounds from your data:

// helper – run once before building the figure
const minValue = Math.min(...values);
const maxValue = Math.max(...values);
const span = maxValue - minValue;
const padding = Math.max(span * 0.15, 0.5);

const yMin = minValue - padding;
const yMax = maxValue + padding;

Then set the range on the layout object:

Plotly.newPlot('chart', traces, {
  // layout
  yaxis: {
    range: [yMin, yMax] // ← layout.yaxis.range
  }
}, { staticPlot: false, displayModeBar: true });

Choose dtick sensibly

`dtick` controls the step between axis ticks. Set it alongside range on the layout object:

Plotly.newPlot('chart', traces, {
  // layout
  yaxis: {
    range: [yMin, yMax],
    dtick: 1 // ← layout.yaxis.dtick
  }
}, { staticPlot: false, displayModeBar: true });

Too many ticks clutter the chart; too few hide structure. Pick a `dtick` that yields roughly 4–10 ticks over the visible range.

Disclose truncation (recommended)

If the axis does not start at zero, it is good practice to add a brief note in the surrounding panel HTML stating the actual starting value:

&lt;p class="footnote"&gt;
  The y-axis starts at {{yMin}} °C to emphasise differences between categories.
&lt;/p&gt;

Stating the concrete start value (rather than a generic "zoomed" sentence) prevents readers from misinterpreting bar lengths. This is a recommendation for clarity, not a mandatory field—the chart is acceptable without it as long as the axis is clearly labelled.

Avoid excessively wide ranges

An axis range much wider than the data spread wastes space and reduces comparability. If the data spread is small (e.g. 3.3 °C), do not use a range many times larger than the spread (e.g. `[31, 50]`) unless there is a strong analytical reason. An over-wide range makes all bars appear the same height and defeats the purpose of the chart.

Hardcoded ranges

Avoid hardcoded axis ranges that may clip future data. If a fixed range is used, require justification and a footnote explaining the chosen bounds. Hardcoded ranges become stale when scenarios, iterations, or timeframes change.

Ensure extremes are visible

Ensure the minimum and maximum values remain visible inside the plot area. Check axis behaviour after data changes, not only for the initial dataset. Avoid duplicate or overlapping axis labels.

Value labels

When precise comparison matters, display values above the bars. These properties belong to the trace object:

// trace (one element of the traces array)
{
  type: "bar",
  x: names,
  y: values,
  text: values.map((v) => v.toFixed(1) + "\u00B0C"),
  textposition: "outside" // ← trace.textposition
}

Include units in the label string. Ensure the layout top margin is large enough to show outside labels:

Plotly.newPlot('chart', traces, {
  // layout
  margin: { t: 60 } // ← layout.margin.t
}, { staticPlot: false, displayModeBar: true });

Reserve top margin when displaying a y-axis title.

Preventing Clipped Category Labels

Clipped x-axis labels are a common rendering defect, especially when category names are long.

Increase bottom margin

Rotated labels need vertical space. Set the bottom margin on the layout object:

Plotly.newPlot('chart', traces, {
  // layout
  margin: { b: 140 } // ← layout.margin.b
}, { staticPlot: false, displayModeBar: true });

If labels are still clipped, increase the bottom margin further—within the total height budget described above.

Use automargin

Enable automatic margin adjustment on the layout object, where supported:

Plotly.newPlot('chart', traces, {
  // layout
  xaxis: {
    automargin: true // ← layout.xaxis.automargin
  }
}, { staticPlot: false, displayModeBar: true });

This helps but is not a substitute for verifying the rendered image.

Control tick angle

Set a moderate rotation angle on the layout object:

Plotly.newPlot('chart', traces, {
  // layout
  xaxis: {
    tickangle: -45 // ← layout.xaxis.tickangle
  }
}, { staticPlot: false, displayModeBar: true });

Very steep angles (e.g. −90) can require excessive bottom margin.

Reduce font size cautiously

Reducing font size can help, but only if labels remain readable. Set the tick font on the layout object:

Plotly.newPlot('chart', traces, {
  // layout
  xaxis: {
    tickfont: { size: 11 } // ← layout.xaxis.tickfont.size
  }
}, { staticPlot: false, displayModeBar: true });

Abbreviate long names

If full names are impractical, use controlled abbreviations and explain them in a footnote or tooltip.

Use horizontal bars as a fallback

Vertical (column) orientation is the default and preferred layout for per-category comparisons. Use horizontal bars only when category names are too long for a vertical x-axis even after rotation. Change the orientation on the trace object:

// trace
{
  type: "bar",
  x: values, // note: x/y swapped for horizontal bars
  y: names,
  orientation: "h" // ← trace.orientation
}

When switching to horizontal bars, adjust margin settings accordingly (left margin instead of bottom for rotated labels):

// layout
margin: { t: 40, r: 60, b: 40, l: 180 }

Test with the longest label and tallest content

During development, test the layout using the longest expected category name and the tallest expected content stack (title + subtitle + chart + footnote), not only the current sample data. Verify that the last x-axis label is fully visible and that footnotes and no-data messages remain visible.

Coloring Bar Charts by Value

A colorscale only affects a Plotly bar trace when the trace carries its own colour array. All of the properties below (`color`, `colorscale`, `cmin`, `cmax`, `showscale`, `colorbar`) live inside `marker` on the trace object.

Required pattern

// trace (one element of the traces array)
const trace = {
  type: "bar",
  x: names,
  y: values,
  marker: {
    color: values,          // ← trace.marker.color (CRITICAL – without this the colorscale is inert)
    colorscale: "Reds",     // ← trace.marker.colorscale
    cmin: colorMin,         // ← trace.marker.cmin
    cmax: colorMax,         // ← trace.marker.cmax
    showscale: true,        // ← trace.marker.showscale
    line: {                 // ← optional thin outline for light colors
      color: "#333333",
      width: 1
    },
    colorbar: {             // ← trace.marker.colorbar
      title: { text: "PET (\u00B0C)" },
      thickness: 14,
      len: 0.8
    }
  }
};

Plotly.newPlot('chart', [trace], {
  // layout – reserve right margin for the colorbar
  margin: { r: 70 } // ← layout.margin.r
}, { staticPlot: false, displayModeBar: true });

The critical property is `marker.color`. Without it, `colorscale`, `cmin`, and `cmax` have no visible effect and the bars render in the default Plotly blue. Declaring `colorscale: "Reds"` alone is a no-op. This failure is completely silent—there is no error message, no console warning. The chart simply renders in uniform blue. Misspelling `color` as `colors` has the same effect.

Array length must match

The color array length must match the data array length. A color array that is too short can produce black or unexpected final bars.

Index alignment

Ensure that `names[i]` corresponds to `values[i]` for every index `i`. A silent off-by-one shift (e.g. caused by filtering one array but not the other) produces a chart where every bar displays the wrong category's value. Verify alignment by checking that the highest value belongs to the expected category.

// Filter by index pair to preserve alignment
const cleanNames = [];
const cleanValues = [];
for (let i = 0; i < names.length; i++) {
  if (values[i] != null && isFinite(values[i])) {
    cleanNames.push(names[i]);
    cleanValues.push(values[i]);
  }
}
// Verify: cleanNames.length === cleanValues.length

Note: `isNaN(null)` returns `false` in JavaScript, so always use `!= null && isFinite(...)` rather than just `isNaN(...)`.

Sort paired objects, not separate arrays

Do not sort the names array and the values array independently. Build paired objects first, sort those, then destructure:

const rows = [];
for (let i = 0; i < names.length; i++) {
  if (values[i] != null && isFinite(values[i])) {
    rows.push({ name: names[i], value: values[i] });
  }
}
rows.sort((a, b) => b.value - a.value);
const sortedNames  = rows.map((r) => r.name);
const sortedValues = rows.map((r) => r.value);

Do not assume identical row ordering

Two independent dynamic TQL tags (one for names, one for values) are not guaranteed to return rows in the same order. Always join by index pair or by item ID, and verify alignment before plotting.

Continuous data needs continuous encoding

For continuous quantitative data, use a continuous colorscale. Do not assign a fixed positional palette (first bar always red, second always blue, …) unless position itself is meaningful. Positional coloring becomes misleading when bars are sorted by value.

Align the color metaphor with the metric

For heat stress, use warmer colors for higher values and cooler colors for lower values. The color encoding should reinforce, not contradict, the data story.

Add a colorbar

The colorbar is declared inside `trace.marker` (see the block above). Include the measurement unit in the colorbar title. Reserve right margin on the layout object so it does not overlap the bars:

Plotly.newPlot('chart', [trace], {
  // layout
  margin: { r: 70 }
}, { staticPlot: false, displayModeBar: true });

Categorical coloring

If you are using discrete categories rather than a continuous scale, enable a legend on the trace object:

// trace
{
  type: "bar",
  x: names,
  y: values,
  showlegend: true // ← trace.showlegend
}

Make sure the legend entries explain what each colour means.

Do not rely on color alone

Color should support the data, not replace it. Also provide value labels, tooltips, or a table when precise values matter.

Verify the rendered gradient

Source code can look correct while the rendered chart still uses default colours. Always inspect the final image. See QA checklist for the full rendered-image checklist.

Choosing Color Domain Bounds

Even when `marker.color` is present, the colour domain can still be misleading.

The minimum-value problem

Sequential scales such as "Reds" start with a very light, near-white colour. If `cmin` equals the data minimum exactly, the lowest value maps to that near-white end and can look like missing data. This is the single most common color-related defect in production panels.

Pad the lower bound

Compute padded bounds, then pass them to the trace's marker:

// helpers
const minValue = Math.min(...values);
const maxValue = Math.max(...values);
const span = maxValue - minValue;
const colorPadding = Math.max(span * 0.15, 0.5);

const colorMin = minValue - colorPadding;
const colorMax = maxValue + colorPadding;

// trace
const trace = {
  type: "bar",
  x: names,
  y: values,
  marker: {
    color: values,       // ← trace.marker.color
    colorscale: "Reds",  // ← trace.marker.colorscale
    cmin: colorMin,      // ← trace.marker.cmin
    cmax: colorMax       // ← trace.marker.cmax
  }
};

Padding keeps the minimum value visibly coloured rather than blending into the background. If the lowest color is still too light against the background, add a thin bar outline (`line: { color: '#333333', width: 1 }`).

Dynamic vs fixed bounds

Prefer dynamic bounds with padding:

// trace.marker
cmin: minValue - padding,
cmax: maxValue + padding

Use fixed (hard-coded) bounds only when:

  • the data domain is stable across all Scenarios, Iterations, and timeframes,
  • the fixed bounds are documented,
  • the fixed bounds are verified to keep every value visible.

Hard-coded bounds become stale when scenarios, iterations, or timeframes change.

Verify extremes

Always check the rendered output to confirm that:

  • the minimum value is not near-white,
  • the maximum value is not saturated into an unreadable block,
  • intermediate values are visually distinguishable,
  • the colorbar gradient matches the actual bar colours.

Background Opacity and Contrast

Panels render over a 3D map. A transparent or semi-transparent background makes axis labels, titles, and bar values illegible.

Opaque background

Set both `paper_bgcolor` and `plot_bgcolor` to a solid, high-contrast fill on the layout object:

Plotly.newPlot('chart', traces, {
  // layout
  paper_bgcolor: "rgba(255,255,255,0.95)",
  plot_bgcolor: "rgba(255,255,255,0.95)"
}, { staticPlot: false, displayModeBar: true });

Font colour

Default Plotly fonts are dark grey/black, which works well on a light background. If you use a dark background, switch to light fonts:

// layout
font: { color: "#ffffff" },
xaxis: { tickfont: { color: "#ffffff" } },
yaxis: { tickfont: { color: "#ffffff" } }

Subtitle and footnote contrast

Apply the same principle to the HTML `<h2>`, `<p>`, and `.footnote` elements via inline styles or a scoped `<style>` block. Low-contrast text over the 3D map is a common readability defect.

Check contrast for both light and dark map backgrounds. Test the panel in the actual viewer, not only in isolation.

Full details: Background and contrast.

Encoding Special Characters in JavaScript Strings

JavaScript strings are not HTML. HTML entities such as `°` or `°` are **not** decoded inside JavaScript string literals and will render literally.

Incorrect

// WRONG – entity inside a JS string
const unit = "&deg;C";
const yAxisTitle = "Average PET (&deg;C)";
const hoverTemplate = "%{x}: %{y:.1f} &deg;C";

This renders as: `41.8 °C`

Correct

Use a Unicode escape or the literal UTF-8 character:

// Option 1: Unicode escape
const degree = "\u00B0";
const unit = degree + "C";
const yAxisTitle = "Average PET (" + unit + ")";
const hoverTemplate = "%{x}: %{y:.1f} " + unit + "C";

// Option 2: Literal UTF-8
const unit = "°C";

HTML entities are appropriate only in HTML text nodes (e.g. the subtitle `<p>`), never inside `<script>` strings passed to Plotly.

Where to check

After rendering, verify that none of the following contain a literal `°`, `°`, or similar entity text:

  • bar value labels (`text`),
  • tooltip / hover template,
  • y-axis title,
  • colorbar title,
  • subtitle,
  • footnote.

Full details: Character encoding.

Hover Templates and Tooltips

Configure the hover template on the trace to show the category, value, and unit:

// trace
{
  type: "bar",
  x: names,
  y: values,
  hovertemplate: "%{x}<br>Avg PET: %{y:.1f}\u00B0C<extra></extra>"
}
  • Use `\u00B0` (or the literal `°`) for the degree sign—never `°`.
  • Keep the unit consistent with the axis title, bar labels, and colorbar title.
  • The `<extra></extra>` tag suppresses the default trace-name box.

TQL Clause Compatibility (X vs Y)

The choice between `X` and `Y` clauses affects the shape of the JavaScript array received by the panel.

Clause family Result shape Typical use
`X`, `XA`, `XK`, `XC` flat array simple bar charts, category lists, one value per item
`Y`, `YA`, `YK`, `YC` array of arrays matrices, per-item time series, heatmaps

Critical rule: For a simple bar chart with one value per category, use the **same clause family** for both the category names and the values:

// CORRECT – both X-clause → flat arrays
const names  = [$SELECT_NAME_WHERE_NEIGHBORHOOD_IS_X];
const values = [$SELECT_GRIDAVG_WHERE_NEIGHBORHOOD_IS_X_AND_GRIDTYPE_IS_HEAT_STRESS_AND_RESULTTYPE_IS_PET_AND_TIMEFRAME_IS_0];
// WRONG – X-clause names + Y-clause values → flat + nested mismatch
const names  = [$SELECT_NAME_WHERE_NEIGHBORHOOD_IS_X];
const values = [$SELECT_GRIDAVG_WHERE_NEIGHBORHOOD_IS_Y_AND_GRIDTYPE_IS_HEAT_STRESS_AND_RESULTTYPE_IS_PET];

Mixing an X-clause name array with a Y-clause value array feeds Plotly a nested y-series and the chart renders blank.

Caution: Query Tool masks the Y-clause bug

The Query Tool and the `execute` API endpoint *display* Y-clause results flattened, which can mask this bug during development. Judge tag shape by the substitution semantics above (X → flat, Y → array-of-arrays), not by the tool's pretty-printed output.

Static binding only

Do **not** construct TQL queries dynamically in JavaScript (e.g. string concatenation + `fetch('/api/session/query/')`). Use static `$SELECT_…$` tags that the platform evaluates at render time. Runtime fetching is a FATAL violation and the root cause of blank-panel failures.

Full details: Static TQL data binding, TQL, X (TQL), Y (TQL).

Overlay Coupling and Timeframe Disclosure

When the chart values come from a grid overlay, the panel should be coupled to that overlay so it activates when the panel opens. The TQL query, the coupled overlay, and the subtitle should all refer to the same source. Pin the timeframe explicitly in the TQL tag or state it concretely in the subtitle (e.g. "02 Aug 2013, last iteration").

Full details: Overlay, timeframe, and scenario coupling, Timeframe (TQL Param).

Error Handling and No-Data Messages

Panel JavaScript should fail visibly, not silently. Wrap chart initialisation in a `try/catch` block:

const container = document.getElementById("chart");

try {
  if (!rows.length) {
    throw new Error("No data available");
  }

  Plotly.newPlot(container, [trace], layout, { staticPlot: false, displayModeBar: true });
} catch (error) {
  container.innerHTML =
    "<p style='color:#c00;padding:20px;'>Unable to render chart. Please check the data source.</p>";
}

Before plotting, validate:

  • the container exists,
  • the category array is not empty,
  • the value array is not empty,
  • category and value arrays have the same length,
  • values are finite numbers,
  • axis minima and maxima are finite.

Guard against `Math.min` and `Math.max` being called on empty arrays. A no-data state should be a designed part of the panel, not an accidental blank box.

Full details: Robustness, error handling, and code quality.

Unit Consistency

The measurement unit (e.g. `°C`, `dB(A)`, `ppm`) should appear consistently in:

  • the y-axis title,
  • bar value labels,
  • hover / tooltip template,
  • colorbar title,
  • subtitle,
  • footnote.

Define the unit string once and reuse it:

const UNIT = "\u00B0C";
// then reference UNIT everywhere

This prevents subtle inconsistencies (e.g. `°C` in the axis but `deg C` in the tooltip). Avoid mixing formats such as `C`, `°C`, and `degC` within the same panel.

Quick-Reference Checklist

Before shipping a Plotly chart panel, verify:

Check Pass criteria
DOM order title → subtitle → chart div → footnote → script
Height budget chart div + title + subtitle + footnote + padding ≤ panel height
Width budget colorbar margin + label margins accounted for
Single title only one of HTML `<h2>` or `layout.title`, not both
Axis range fitted to data (no zero baseline for narrow bands); truncation disclosed (recommended)
X-axis labels all visible; tested with longest expected name and tallest content stack
Index alignment names[i] corresponds to values[i] for all i; arrays filtered by index pair
marker.color present and bound to the numeric value array; length matches data
Color domain cmin padded below data minimum; cmax padded above data maximum
Colorbar present, titled with unit, right margin reserved
Background opaque (≥ 90 % alpha); font contrast verified over 3D map
Degree sign `\u00B0` or literal `°` in JS strings; no `°`
TQL clauses same clause family (X/X or Y/Y) for names and values; static tags only (no runtime fetch)
Error handling try/catch present; empty-data guard; no-data message styled
Units consistent across axis, labels, tooltip, colorbar, subtitle
Config `{ staticPlot: false, displayModeBar: true }` passed to Plotly.newPlot
No CDN script no external Plotly `<script>` tag; no `window.load` gate
Orientation vertical (column) bars preferred; horizontal only when labels require it
Rendered image inspected: all labels visible, colours correct, no JS error, min bar not gray

Panel-level checks (overlay coupling, timeframe disclosure, panel name uniqueness, text persistence): QA checklist.

Delivery Gate

A per-category bar-chart panel is ready for delivery only when all of the following chart-specific conditions hold:

  • Static bracketed TQL tags (no runtime fetch, no CDN, no `window.load` gate).
  • Names pulled dynamically; X-clause used for both categories and values.
  • `marker.color` bound to values **and** `colorscale`/`cmin`/`cmax` present; `cmin` padded below the minimum.
  • y-axis fitted to the data extent (no zero baseline, no over-wide range).
  • Chart height = panel height − header; div height = `layout.height`; x-axis labels fully visible.
  • Opaque background + explicit dark fonts; single title; unit consistent; degree sign via `\u00B0`.
  • `try/catch` + empty-data guard.
  • `config: { staticPlot: false, displayModeBar: true }` passed to `Plotly.newPlot`.
  • Vertical orientation used (horizontal only with justification).
  • Verified via `web/panel.html?id=…` showing both value labels and category labels.

Panel-level sign-off (text persistence, name uniqueness, overlay coupling, timeframe disclosure): Sign-off criteria.