(data: ReadonlyArray<DataPoint>, autoScroll: boolean)
| 34 | }; |
| 35 | |
| 36 | const 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 | |
| 61 | const attachCoalescedResizeObserver = (container: HTMLElement, chart: ChartGPUInstance): ResizeObserver => { |
| 62 | let rafId: number | null = null; |
no outgoing calls
no test coverage detected