datahwcz-chart

Chart

ApexCharts wrapper configured through a JSON config script, with loading/error states and live option/series updates.

Attributes

AttributeTypeDefaultDescription
loadingbooleanfalseDefers chart initialization until set back to false; shows the loading state meanwhile.
widthstring'100%'Chart width passed to ApexCharts (default 100%).
heightstring'auto'Chart height passed to ApexCharts (default auto).
Inherited from Hwc
AttributeTypeDefaultDescription
i18nstring''Per-instance text overrides as key: text pairs, merged over the global z-i18n script and the built-in defaults.
floatingstring''Floating UI placement options (for example offset and shiftPadding) parsed as key: value pairs.
force-prevent-rerenderbooleanfalseSkips re-rendering after the first render; an existing data-host-inner child is adopted as the rendered DOM.
templatestring''Selector or id of an external element or <template> whose inner content is cloned in place of an inline template[data-fn="template"] child.
Inherited from Base
AttributeTypeDefaultDescription
clsstring''Adds classes to named parts as key: classes pairs; a plain string targets the default part.
stlstring''Adds inline styles to named parts as key: styles pairs; a plain string targets the default part.

Custom Styling (cls / stl)

Default cls target:host-inner · defaultstl target:host-inner

KeyDefault classclsstlDescription
chartz-chartyesyesThe chart container (default z-chart).
errorsr-onlyyesyesError announcement region (default sr-only).
host-inner—yesyesRendered root wrapper; the default cls/stl target.
loadingsr-onlyyesyesLoading announcement region (default sr-only).

i18n Keys

KeyDefaultPlaceholdersDescription
chart-labelChart—Accessible label of the chart region. Used in: host-inner.
error-messageFailed to load chart. Please try again.—Error announcement text. Used in: error, loading.
loading-messageLoading chart...—Loading announcement text. Used in: error, loading.
no-data-messageNo data available—Text shown when there is no data. Used in: error, loading.

Methods

SignatureDescription
getChartInstance(): ApexCharts | nullReturns the underlying ApexCharts instance (or null).
updateChart(options: object, redrawPaths?: boolean = true, animate?: boolean = true): Promise<void>Calls ApexCharts updateOptions with the given options, redraw paths, and animation flags.
updateSeries(newSeries: ApexAxisChartSeries | ApexNonAxisChartSeries, animate?: boolean = true): Promise<void>Calls ApexCharts updateSeries with new series data and an animation flag.

Data Hooks

AttributeValuesApplies toRoleDescription
data-chart-container—descendantmarkerMarks the element ApexCharts renders into.
data-error—descendantmarkerSet when initialization or updates fail.
data-host-inner · from Hwc—descendantconfigMarks the rendered inner wrapper so force-prevent-rerender can adopt server-rendered DOM without re-rendering.
data-loading—descendantmarkerSet while the chart is loading.
data-reactive · from Hwc—descendantconfigOpts the marked child (config script, data source, icons, or template) into live re-parsing when its DOM mutates.
data-rendered—descendantmarkerSet after the chart has rendered.

Child Content

script[data-fn="config"][type="application/json"]

JSON configuration script parsed by the base class (i18n, cls, stl, floating).

AttributeRequiredTypeDescription
data-fnyesconfigMarks the script as configuration (value: config).
data-reactivenobooleanRe-parses the configuration when the script mutates.

select[data-fn="data-source"]

Hidden select parsed into grouped option data by the base class.

AttributeRequiredTypeDescription
data-fnyesdata-sourceMarks the select as the data source (value: data-source).
data-reactivenobooleanRe-parses the options when the select mutates.

optgroup · repeatable

Groups options under a label.

AttributeRequiredTypeDescription
labelyesstringGroup header text; also the default group key.
disablednobooleanDisables every option in the group.
data-keynostringOverrides the group key used in the parsed data.
data-keywordsnocomma-separated stringComma-separated keywords stored with the group's data.

option · repeatable

One option entry within the group.

AttributeRequiredTypeDescription
valuenostringValue carried by this option in the parsed data.
disablednobooleanMakes the option non-selectable.
selectednobooleanMarks the option as initially selected.
data-keywordsnocomma-separated stringExtra search terms, comma-separated; searched alongside the label and value.

option · repeatable

One ungrouped option entry.

AttributeRequiredTypeDescription
valuenostringValue carried by this option in the parsed data.
disablednobooleanMakes the option non-selectable.
selectednobooleanMarks the option as initially selected.
data-keywordsnocomma-separated stringExtra search terms, comma-separated.

template[data-fn="icons"]

Instance-level icon repository.

AttributeRequiredTypeDescription
data-fnyesiconsMarks the template as an icon source (value: icons).
data-reactivenobooleanRe-parses the icons when the template mutates.

* · repeatable

One icon element.

AttributeRequiredTypeDescription
data-keyyesstringIcon key referenced by $icons.

template[data-fn="template"]

Deferred content template mounted by the base class.

AttributeRequiredTypeDescription
data-fnyestemplateMarks the template for deferred mounting (value: template).
data-reactivenobooleanRe-parses the template when it mutates.

Accessibility

PartARIADescription
chart—Chart container; no static ARIA attributes.
erroraria-live="assertive" role="alert"Error alert: role="alert" with aria-live.
host-inneraria-label="${ariaLabel}" role="img"Chart region labeled by chart-label.
loadingaria-label="${message}" aria-live="polite" role="status"Loading status: role="status" with aria-live and the loading label.
  • Loading and error states are announced through live regions; the chart region itself is labeled.