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

Function createCartesianOptions

examples/data-update-animation/main.ts:93–122  ·  view source on GitHub ↗
(data: Readonly<{ bars: ReadonlyArray<DataPoint>; line: ReadonlyArray<DataPoint> }>, animation: ChartGPUOptions['animation'])

Source from the content-addressed store, hash-verified

91};
92
93const createCartesianOptions = (data: Readonly<{ bars: ReadonlyArray<DataPoint>; line: ReadonlyArray<DataPoint> }>, animation: ChartGPUOptions['animation']): ChartGPUOptions => {
94 const n = data.line.length;
95 return {
96 grid: { left: 70, right: 120, top: 24, bottom: 56 },
97 xAxis: { type: 'value', min: 0, max: Math.max(1, n - 1), name: 'Index (match-by-index)' },
98 // Intentionally omit y min/max so y-domain changes (from new extents) are visible.
99 yAxis: { type: 'value', name: 'Value (auto domain)' },
100 theme,
101 tooltip: { show: true, trigger: 'axis' },
102 animation,
103 series: [
104 {
105 type: 'bar',
106 name: 'Bars',
107 data: data.bars,
108 color: '#4a9eff',
109 barWidth: '72%',
110 barGap: 0.2,
111 barCategoryGap: 0.25,
112 },
113 {
114 type: 'line',
115 name: 'Line',
116 data: data.line,
117 color: '#ff4ab0',
118 lineStyle: { width: 2, opacity: 1 },
119 },
120 ],
121 };
122};
123
124const createPieOptions = (slices: ReadonlyArray<PieDataItem>, animation: ChartGPUOptions['animation']): ChartGPUOptions => {
125 return {

Callers 2

mainFunction · 0.85
updateChartsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected