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

Function updateChart

examples/candlestick/main.ts:138–166  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

136 const borderWidthInput = document.getElementById('border-width') as HTMLInputElement | null;
137
138 const updateChart = () => {
139 const style = styleSelect?.value === 'hollow' ? 'hollow' : 'classic';
140 const upColor = upColorInput?.value ?? '#26a69a';
141 const downColor = downColorInput?.value ?? '#ef5350';
142 const borderWidth = borderWidthInput ? parseFloat(borderWidthInput.value) : 1;
143
144 const series0 = currentOptions.series?.[0];
145 if (!series0 || series0.type !== 'candlestick') return;
146
147 currentOptions = {
148 ...currentOptions,
149 series: [
150 {
151 ...series0,
152 data: ohlcData,
153 style,
154 itemStyle: {
155 ...series0.itemStyle,
156 upColor,
157 downColor,
158 upBorderColor: upColor,
159 downBorderColor: downColor,
160 borderWidth,
161 },
162 },
163 ],
164 };
165 chart.setOption(currentOptions);
166 };
167
168 styleSelect?.addEventListener('change', updateChart);
169 upColorInput?.addEventListener('input', updateChart);

Callers

nothing calls this directly

Calls 1

setOptionMethod · 0.65

Tested by

no test coverage detected