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

Method _renderNormal

src/chart/candlestick/CandlestickView.ts:97–188  ·  view source on GitHub ↗
(seriesModel: CandlestickSeriesModel)

Source from the content-addressed store, hash-verified

95 }
96
97 _renderNormal(seriesModel: CandlestickSeriesModel) {
98 const data = seriesModel.getData();
99 const oldData = this._data;
100 const group = this.group;
101 const isSimpleBox = data.getLayout('isSimpleBox');
102
103 const needClip = seriesModel.get('clip', true);
104 const coordSys = seriesModel.coordinateSystem;
105 const clipArea = coordSys.getArea && coordSys.getArea();
106 const clipPath = needClip && createClipPath(coordSys, false, seriesModel);
107
108 // There is no old data only when first rendering or switching from
109 // stream mode to normal mode, where previous elements should be removed.
110 if (!this._data) {
111 group.removeAll();
112 }
113
114 const transPointDim = getTransPointDimension(seriesModel);
115
116 data.diff(oldData)
117 .add(function (newIdx) {
118 if (data.hasValue(newIdx)) {
119 const itemLayout = data.getItemLayout(newIdx) as CandlestickItemLayout;
120
121 const clipKind = needClip
122 ? resolveNormalBoxClipping(clipArea, itemLayout) : SHAPE_CLIP_KIND_NOT_CLIPPED;
123 if (clipKind === SHAPE_CLIP_KIND_FULLY_CLIPPED) {
124 return;
125 }
126
127 const el = createNormalBox(itemLayout, newIdx, transPointDim, true);
128 graphic.initProps(el, {shape: {points: itemLayout.ends}}, seriesModel, newIdx);
129
130 // When an item is partially inside and partially outside the Cartesian bounding rect,
131 // the disappearance of the entire item may confuse users. Therefore, clipping is needed.
132 // Consider performance of zr Element['clipPath'], only set to partially clipped elements.
133 updateClipPath(clipKind === SHAPE_CLIP_KIND_PARTIALLY_CLIPPED, el, clipPath);
134
135 setBoxCommon(el, data, newIdx, isSimpleBox);
136
137 group.add(el);
138
139 data.setItemGraphicEl(newIdx, el);
140 }
141 })
142 .update(function (newIdx, oldIdx) {
143 let el = oldData.getItemGraphicEl(oldIdx) as NormalBoxPath;
144
145 // Empty data
146 if (!data.hasValue(newIdx)) {
147 group.remove(el);
148 return;
149 }
150
151 const itemLayout = data.getItemLayout(newIdx) as CandlestickItemLayout;
152
153 const clipKind = needClip
154 ? resolveNormalBoxClipping(clipArea, itemLayout) : SHAPE_CLIP_KIND_NOT_CLIPPED;

Callers 1

renderMethod · 0.95

Calls 15

createClipPathFunction · 0.90
resolveNormalBoxClippingFunction · 0.90
updateClipPathFunction · 0.90
saveOldStyleFunction · 0.90
getTransPointDimensionFunction · 0.85
setBoxCommonFunction · 0.85
executeMethod · 0.80
diffMethod · 0.80
hasValueMethod · 0.80
getItemLayoutMethod · 0.80
setItemGraphicElMethod · 0.80
getItemGraphicElMethod · 0.80

Tested by

no test coverage detected