Yagr methods
Fields
id!: string- id of chart's root element. Will set up if not provided.uplot!: UPlot- uPlot instanceroot!: HTMLElement- root HTML elementconfig!: YagrConfigresizeOb?: ResizeObservercanvas!: HTMLCanvasElement- uPlot'c HTML5 Canvas elementplugins: YagrPlugins- map of available pluginsstate!: YagrState- current Yagr stateutils!- Yagr utility helpers such as color parser, i18n etcisEmpty- is chart empty (refers tostate.isEmptyDataSet)
Methods
redraw(series = true, axes = true): void- redraws Yagr instance by given options. Can redraw separately series or axes. By default fully rebuild axes and series.dispose(): void- dispose Yagr instance, plugins and remove all listenerstoDataUrl(): string- returns canvas'spng/imgDataURL stringsubscribe(): void- subsribe to uPlot's syncunsubscribe(): void- unsubscribe from uPlot's syncgetById(id: string): Series- finds uPlot Series by idreflow()- reflow chart instance
Update methods
See more in dynamic updates docs.
setLocale(locale: string | Record<string, string>): void- set's locale of chart and redraws all locale-dependent elements.setTheme(themeValue: YagrTheme): void- set's theme of chart and redraws all theme-dependent elements.setVisible(lineId: string | null, show: boolean): void- sets series visibility (passnullto show/hide ass)setFocus(lineId: string | null, focus: boolean): void- sets series focus (passnullto focus/defocus all)setAxes(axes: YagrConfig['axes']): void- sets new axes config and rerender chart's axes (and series if required)setScales(scales: YagrConfig['scales']): void- sets new scales config and rerender chart if requiredsetSeries- update chart seriessetConfig(cfgPath: Partial<YagrConfig>)- applies passed patch to current config and calls all requiredset*functions in single batchyagr.batch- allows to run multiple Yagr updates with single redraw and data recalculation
Was the article helpful?
Previous