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

Method render

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

Source from the content-addressed store, hash-verified

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),

Callers

nothing calls this directly

Calls 15

getTooltipDataMethod · 0.95
getDataLabelsMethod · 0.95
getTotalDataLabelsMethod · 0.95
getActiveSeriesMapFunction · 0.90
makeLabelsFromLimitFunction · 0.90
getLimitOnAxisFunction · 0.90
hasNegativeFunction · 0.90
getBoxTypeSeriesPaddingFunction · 0.90
deepCopyArrayFunction · 0.90
getDataLabelsOptionsFunction · 0.90

Tested by

no test coverage detected