MCPcopy
hub / github.com/apache/echarts / render

Method render

src/chart/boxplot/BoxplotView.ts:45–124  ·  view source on GitHub ↗
(seriesModel: BoxplotSeriesModel, ecModel: GlobalModel, api: ExtensionAPI)

Source from the content-addressed store, hash-verified

43 private _data: SeriesData;
44
45 render(seriesModel: BoxplotSeriesModel, ecModel: GlobalModel, api: ExtensionAPI) {
46 const data = seriesModel.getData();
47 const group = this.group;
48 const oldData = this._data;
49
50 // There is no old data only when first rendering or switching from
51 // stream mode to normal mode, where previous elements should be removed.
52 if (!this._data) {
53 group.removeAll();
54 }
55
56 const constDim = seriesModel.getWhiskerBoxesLayout() === 'horizontal' ? 1 : 0;
57 const needClip = seriesModel.get('clip', true);
58 const coordSys = seriesModel.coordinateSystem;
59 const clipArea = coordSys.getArea && coordSys.getArea();
60 const clipPath = needClip && createClipPath(coordSys, false, seriesModel);
61
62 data.diff(oldData)
63 .add(function (newIdx) {
64 if (data.hasValue(newIdx)) {
65 const itemLayout = data.getItemLayout(newIdx) as BoxplotItemLayout;
66
67 const clipKind = needClip
68 ? resolveNormalBoxClipping(clipArea, itemLayout) : SHAPE_CLIP_KIND_NOT_CLIPPED;
69 if (clipKind === SHAPE_CLIP_KIND_FULLY_CLIPPED) {
70 return;
71 }
72
73 const symbolEl = createNormalBox(itemLayout, data, newIdx, constDim, true);
74 // One axis tick can corresponds to a group of box items (from different series),
75 // so it may be visually misleading when a group of items are partially outside
76 // but no clipping is applied.
77 // Consider performance of zr Element['clipPath'], only set to partially clipped elements.
78 updateClipPath(clipKind === SHAPE_CLIP_KIND_PARTIALLY_CLIPPED, symbolEl, clipPath);
79
80 data.setItemGraphicEl(newIdx, symbolEl);
81 group.add(symbolEl);
82 }
83 })
84 .update(function (newIdx, oldIdx) {
85 let symbolEl = oldData.getItemGraphicEl(oldIdx) as BoxPath;
86
87 // Empty data
88 if (!data.hasValue(newIdx)) {
89 group.remove(symbolEl);
90 return;
91 }
92
93 const itemLayout = data.getItemLayout(newIdx) as BoxplotItemLayout;
94
95 const clipKind = needClip
96 ? resolveNormalBoxClipping(clipArea, itemLayout) : SHAPE_CLIP_KIND_NOT_CLIPPED;
97 if (clipKind === SHAPE_CLIP_KIND_FULLY_CLIPPED) {
98 group.remove(symbolEl);
99 return;
100 }
101
102 if (!symbolEl) {

Callers

nothing calls this directly

Calls 15

createClipPathFunction · 0.90
resolveNormalBoxClippingFunction · 0.90
updateClipPathFunction · 0.90
saveOldStyleFunction · 0.90
updateNormalBoxDataFunction · 0.85
getWhiskerBoxesLayoutMethod · 0.80
executeMethod · 0.80
diffMethod · 0.80
hasValueMethod · 0.80
getItemLayoutMethod · 0.80
setItemGraphicElMethod · 0.80
getItemGraphicElMethod · 0.80

Tested by

no test coverage detected