(options: ChartGPUOptions)
| 1167 | } |
| 1168 | |
| 1169 | setOption(options: ChartGPUOptions): void { |
| 1170 | if (this.isDisposed) { |
| 1171 | throw new ChartGPUWorkerError( |
| 1172 | 'Cannot setOption on disposed chart', |
| 1173 | 'DISPOSED', |
| 1174 | 'setOption', |
| 1175 | this.chartId |
| 1176 | ); |
| 1177 | } |
| 1178 | |
| 1179 | // Check if dataZoom slider needs to be added or removed |
| 1180 | const prevOptions = this.cachedOptions; |
| 1181 | const hadSliderZoom = prevOptions.dataZoom?.some(z => z?.type === 'slider') ?? false; |
| 1182 | const hasSliderZoom = options.dataZoom?.some(z => z?.type === 'slider') ?? false; |
| 1183 | |
| 1184 | this.cachedOptions = options; |
| 1185 | this.recomputeCachedSeriesPointCountsForZoom(options); |
| 1186 | |
| 1187 | // Recreate overlays if dataZoom slider presence changed |
| 1188 | if (hadSliderZoom !== hasSliderZoom) { |
| 1189 | // Dispose old overlays |
| 1190 | this.disposeOverlays(); |
| 1191 | // Recreate with new configuration |
| 1192 | this.createOverlays(); |
| 1193 | } else if (hasSliderZoom && this.zoomState) { |
| 1194 | // Update span constraints at runtime (matches worker coordinator behavior). |
| 1195 | const constraints = this.computeZoomSpanConstraints(options); |
| 1196 | const withConstraints = this.zoomState as unknown as { |
| 1197 | setSpanConstraints?: (minSpan: number, maxSpan: number) => void; |
| 1198 | }; |
| 1199 | withConstraints.setSpanConstraints?.( |
| 1200 | (constraints.minSpan as number) ?? 0.5, |
| 1201 | (constraints.maxSpan as number) ?? 100 |
| 1202 | ); |
| 1203 | } |
| 1204 | |
| 1205 | this.sendMessage({ |
| 1206 | type: 'setOption', |
| 1207 | chartId: this.chartId, |
| 1208 | options, |
| 1209 | }); |
| 1210 | } |
| 1211 | |
| 1212 | /** |
| 1213 | * Appends data points to a series (DataPoint[] or OHLCDataPoint[] form). |
nothing calls this directly
no test coverage detected