(seriesModel: CandlestickSeriesModel)
| 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; |
no test coverage detected