(
chartState: ChartState<T>,
computed
)
| 131 | } |
| 132 | |
| 133 | render<T extends BarChartOptions | ColumnChartOptions | ColumnLineChartOptions>( |
| 134 | chartState: ChartState<T>, |
| 135 | computed |
| 136 | ) { |
| 137 | const { layout, series: seriesData, axes, stackSeries, legend, theme, scale } = chartState; |
| 138 | const { viewRange } = computed; |
| 139 | this.isShow = !!stackSeries[this.name]; |
| 140 | |
| 141 | if (!this.isShow) { |
| 142 | return; |
| 143 | } |
| 144 | |
| 145 | const categories = (chartState.categories as string[]) ?? []; |
| 146 | const options = this.getOptions(chartState.options); |
| 147 | |
| 148 | this.setEventDetectType(seriesData, options); |
| 149 | |
| 150 | this.theme = theme.series[this.name]; |
| 151 | this.rect = layout.plot; |
| 152 | this.activeSeriesMap = getActiveSeriesMap(legend); |
| 153 | this.selectable = this.getSelectableOption(options); |
| 154 | |
| 155 | const stackSeriesData = getStackSeriesDataInViewRange(stackSeries[this.name], viewRange); |
| 156 | const { tickDistance } = axes[this.labelAxis]; |
| 157 | const diverging = !!options.series?.diverging; |
| 158 | |
| 159 | const { limit, stepSize } = this.getScaleData(scale); |
| 160 | const labels = makeLabelsFromLimit(limit, stepSize); |
| 161 | const { min, max } = getLimitOnAxis(labels); |
| 162 | |
| 163 | const { stack, scaleType } = stackSeriesData; |
| 164 | |
| 165 | this.basePosition = this.getBasePosition(axes[this.valueAxis]); |
| 166 | |
| 167 | let offsetSize: number = this.getOffsetSize(); |
| 168 | |
| 169 | const { centerYAxis } = axes; |
| 170 | |
| 171 | if (diverging) { |
| 172 | const [left, right] = this.getDivergingBasePosition(centerYAxis!); |
| 173 | |
| 174 | this.basePosition = this.getOffsetSize() / 2; |
| 175 | this.leftBasePosition = left; |
| 176 | this.rightBasePosition = right; |
| 177 | |
| 178 | offsetSize = this.getOffsetSizeWithDiverging(centerYAxis!); |
| 179 | } |
| 180 | |
| 181 | const renderOptions: RenderOptions = { |
| 182 | stack, |
| 183 | scaleType, |
| 184 | tickDistance, |
| 185 | min, |
| 186 | max, |
| 187 | diverging, |
| 188 | hasNegativeValue: hasNegative(labels), |
| 189 | seriesDirection: this.getSeriesDirection(labels), |
| 190 | defaultPadding: getBoxTypeSeriesPadding(tickDistance), |
nothing calls this directly
no test coverage detected