MCPcopy Index your code
hub / github.com/ChartGPU/ChartGPU / createBaseOptions

Function createBaseOptions

examples/live-streaming/main.ts:36–59  ·  view source on GitHub ↗
(data: ReadonlyArray<DataPoint>, autoScroll: boolean)

Source from the content-addressed store, hash-verified

34};
35
36const createBaseOptions = (data: ReadonlyArray<DataPoint>, autoScroll: boolean): ChartGPUOptions => ({
37 // Note: when `dataZoom` includes `{ type: 'slider' }`, ChartGPU reserves additional bottom
38 // space internally for the slider UI, so this value only needs to cover axis labels/title.
39 grid: { left: 70, right: 24, top: 24, bottom: 44 },
40 xAxis: { type: 'value', name: 't' },
41 yAxis: { type: 'value', name: 'value' },
42 tooltip: { trigger: 'axis' },
43 autoScroll,
44 dataZoom: [{ type: 'inside' }, { type: 'slider', start: 70, end: 100 }],
45 palette: ['#4a9eff'],
46 animation: false,
47 series: [
48 {
49 type: 'line',
50 name: 'stream',
51 data,
52 color: '#4a9eff',
53 lineStyle: { width: 2, opacity: 1 },
54 // Keep sampling on so the example stays responsive as the buffer grows.
55 sampling: 'lttb',
56 samplingThreshold: 2500,
57 },
58 ],
59});
60
61const attachCoalescedResizeObserver = (container: HTMLElement, chart: ChartGPUInstance): ResizeObserver => {
62 let rafId: number | null = null;

Callers 2

mainFunction · 0.85
applyOptionsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected