MCPcopy
hub / github.com/nhn/tui.chart / render

Method render

apps/chart/src/component/boxSeries.ts:263–357  ·  view source on GitHub ↗
(
    chartState: ChartState<T>,
    computed
  )

Source from the content-addressed store, hash-verified

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,

Callers

nothing calls this directly

Calls 15

getOptionsMethod · 0.95
setEventDetectTypeMethod · 0.95
getScaleDataMethod · 0.95
getBasePositionMethod · 0.95
getOffsetSizeMethod · 0.95
getValueRatioMethod · 0.95
getSeriesDirectionMethod · 0.95
renderSeriesModelMethod · 0.95
makeTooltipDataMethod · 0.95

Tested by

no test coverage detected