Register the chart view cache as the core chart view provider, so
openChartViews(store) returns live chart views, and the SVG chart renderer,
so grids created after this call draw their charts.
Workspace packages depending on @sheetwrite/charts
@sheetwrite/docs-startdependency
Public exports naming registerChartsBackend
None.
function registerChartsBackend(): voidfunctionregisterChartsBackend():voidfunctionregisterChartsBackend():voidRegister the chart view cache as the core chart view provider, so openChartViews(store) returns live chart views, and the SVG chart renderer, so grids created after this call draw their charts.Exampleimport { registerChartsBackend } from"@sheetwrite/charts";import { openChartViews, type Store } from"@sheetwrite/core";registerChartsBackend();functionsalesChartValues(store:Store) {constcharts=openChartViews(store);constvalues= charts.get({ sheet: "s", id: "sales" })?.series[0]?.values ?? [];charts.dispose();return values;}API reference →function openChartViews(store: Store): ChartViewProviderfunctionopenChartViews(store:Store):ChartViewProviderfunctionopenChartViews(store:Store,):ChartViewProviderOpen cached chart views through the optional backend. Import @sheetwrite/charts/register or call its registerChartsBackend first. Throws a SheetwriteError with code "optional-backend-unavailable" if no provider is registered. The caller must dispose the result.API reference →interface StoreinterfaceStoreinterfaceStoreColumnar workbook storage, query, transaction, and subscription contract.API reference →function salesChartValues(store: Store): (number | null)[]functionsalesChartValues(store:Store): (number|null)[]functionsalesChartValues(store:Store,): (number|null)[]API reference →const charts: ChartViewProviderconstcharts:ChartViewProviderconstcharts:ChartViewProviderCharts to resolve again, in commit order of the edits that touched them.API reference →store: Storelet store:Storelet store:StoreAPI reference →const values: (number | null)[]constvalues: (number|null)[]constvalues: (number|null)[]Numeric cells; text, booleans, errors and empty cells are null (a gap).API reference →ChartViewProvider.get(chart: ChartRef): ChartView | nullChartViewProvider.get(chart: ChartRef): ChartView |nullChartViewProvider.get(chart: ChartRef): ChartView |nullResolve on first access; later accesses use the cached committed view.API reference →ChartRef.sheet: stringinterfaceChartRef {sheet:string;}interfaceChartRef {sheet:string;}Sheet identity used by the simple data-first adapter. Defaults to sheet1.API reference →ChartRef.id: stringinterfaceChartRef {id:string;}interfaceChartRef {id:string;}Stable identity used by operations, history, and collaboration rebase.API reference →ChartView.series: ChartSeriesView[]interfaceChartView {series:ChartSeriesView[];}interfaceChartView {series:ChartSeriesView[];}ChartSeriesView.values: (number | null)[] | undefinedinterfaceChartSeriesView {values: (number|null)[] |undefined;}interfaceChartSeriesView {values:(number|null)[] |undefined;}Numeric cells; text, booleans, errors and empty cells are null (a gap).API reference →ChartViewProvider.dispose(): voidChartViewProvider.dispose(): voidChartViewProvider.dispose(): voidStop observing the store and release cached views.API reference →