Imperative API
For operations not covered by declarative props, forward a ref to access the raw KlineCharts Chart instance.
import { useRef } from "react";import { KLineChart, type Chart } from "react-klinecharts";
const chartRef = useRef<Chart>(null);<KLineChart ref={chartRef} data={data} />;Navigation
Section titled “Navigation”chart.scrollByDistance(distance, animationDuration?)chart.scrollToRealTime(animationDuration?)chart.scrollToDataIndex(dataIndex, animationDuration?)chart.scrollToTimestamp(timestamp, animationDuration?)chart.zoomAtCoordinate(scale, coordinate?, animationDuration?)chart.zoomAtDataIndex(scale, dataIndex, animationDuration?)chart.zoomAtTimestamp(scale, timestamp, animationDuration?)Data queries
Section titled “Data queries”chart.getDataList(): KLineData[]chart.getVisibleRange(): VisibleRangechart.getBarSpace(): BarSpaceCoordinate conversion
Section titled “Coordinate conversion”chart.convertToPixel(points, filter?): Partial<Coordinate> | Array<Partial<Coordinate>>chart.convertFromPixel(coordinates, filter?): Partial<Point> | Array<Partial<Point>>Pane management
Section titled “Pane management”chart.setPaneOptions(options: Partial<PaneOptions>): voidchart.getPaneOptions(id?): Nullable<PaneOptions> | PaneOptions[]Y axis management (v10 multi-YAxis)
Section titled “Y axis management (v10 multi-YAxis)”chart.createYAxis(yAxis: YAxisOverride): Nullable<string>chart.removeYAxis(filter: YAxisFilter): boolean // requires id or namechart.getYAxes(filter: YAxisFilter): YAxis[]chart.overrideYAxis(yAxis: YAxisOverride): voidIndicator & overlay operations
Section titled “Indicator & overlay operations”chart.createIndicator(value, isStack?): Nullable<string>chart.getIndicators(filter?): Indicator[]chart.overrideIndicator(override: IndicatorCreate): booleanchart.removeIndicator(filter?): boolean
chart.createOverlay(value): Nullable<string> | Array<Nullable<string>>chart.getOverlays(filter?): Overlay[]chart.overrideOverlay(override): booleanchart.removeOverlay(filter?): booleanDOM access
Section titled “DOM access”chart.getDom(paneId?, position?): Nullable<HTMLElement>chart.getSize(paneId?, position?): Nullable<Bounding>Export & misc
Section titled “Export & misc”chart.getConvertPictureUrl(includeOverlay?, type?, backgroundColor?): stringchart.resize(): voidSee the KlineCharts API documentation for the authoritative reference.