(
chartState: ChartState<T>,
computed
)
| 261 | } |
| 262 | |
| 263 | render<T extends BarChartOptions | ColumnChartOptions | ColumnLineChartOptions>( |
| 264 | chartState: ChartState<T>, |
| 265 | computed |
| 266 | ) { |
| 267 | const { layout, series, axes, stackSeries, legend, theme, scale } = chartState; |
| 268 | |
| 269 | this.isShow = !(stackSeries && stackSeries[this.name]); |
| 270 | |
| 271 | if (!this.isShow) { |
| 272 | return; |
| 273 | } |
| 274 | |
| 275 | const categories = (chartState.categories as string[]) ?? []; |
| 276 | const options = this.getOptions(chartState.options); |
| 277 | |
| 278 | this.setEventDetectType(series, options); |
| 279 | |
| 280 | this.theme = theme.series[this.name]; |
| 281 | this.rect = layout.plot; |
| 282 | this.activeSeriesMap = getActiveSeriesMap(legend); |
| 283 | this.selectable = this.getSelectableOption(options); |
| 284 | this.valueAxis = getValueAxisName(options, this.name, this.isBar ? 'xAxis' : 'yAxis'); |
| 285 | |
| 286 | const seriesData = series[this.name].data.map((seriesDatum) => ({ |
| 287 | ...seriesDatum, |
| 288 | data: getDataInRange(seriesDatum.data, computed.viewRange), |
| 289 | })); |
| 290 | |
| 291 | if (axes.centerYAxis) { |
| 292 | this.valueAxis = 'centerYAxis'; |
| 293 | } |
| 294 | |
| 295 | const { tickDistance } = axes[this.labelAxis]; |
| 296 | const diverging = !!(options.series as BoxSeriesOptions)?.diverging; |
| 297 | const { limit, stepSize } = this.getScaleData(scale); |
| 298 | const labels = makeLabelsFromLimit(limit, stepSize); |
| 299 | const { min, max } = getLimitOnAxis(labels); |
| 300 | |
| 301 | this.basePosition = this.getBasePosition(axes[this.valueAxis]); |
| 302 | |
| 303 | let offsetSize: number = this.getOffsetSize(); |
| 304 | const { centerYAxis } = axes; |
| 305 | |
| 306 | if (diverging) { |
| 307 | const [left, right] = this.getDivergingBasePosition(centerYAxis!); |
| 308 | |
| 309 | this.basePosition = this.getOffsetSize() / 2; |
| 310 | this.leftBasePosition = left; |
| 311 | this.rightBasePosition = right; |
| 312 | |
| 313 | offsetSize = this.getOffsetSizeWithDiverging(centerYAxis!); |
| 314 | } |
| 315 | |
| 316 | const renderOptions: RenderOptions = { |
| 317 | min, |
| 318 | max, |
| 319 | tickDistance, |
| 320 | diverging, |
nothing calls this directly
no test coverage detected