MCPcopy Index your code
hub / github.com/apache/echarts / normalProgress

Function normalProgress

src/chart/candlestick/candlestickLayout.ts:94–179  ·  view source on GitHub ↗
(params: StageHandlerProgressParams, data: SeriesData)

Source from the content-addressed store, hash-verified

92 };
93
94 function normalProgress(params: StageHandlerProgressParams, data: SeriesData) {
95 let dataIndex;
96 const store = data.getStore();
97 while ((dataIndex = params.next()) != null) {
98
99 const axisDimVal = store.get(cDimI, dataIndex) as number;
100 const openVal = store.get(openDimI, dataIndex) as number;
101 const closeVal = store.get(closeDimI, dataIndex) as number;
102 const lowestVal = store.get(lowestDimI, dataIndex) as number;
103 const highestVal = store.get(highestDimI, dataIndex) as number;
104
105 const ocLow = mathMin(openVal, closeVal);
106 const ocHigh = mathMax(openVal, closeVal);
107
108 const ocLowPoint = getPoint(ocLow, axisDimVal);
109 const ocHighPoint = getPoint(ocHigh, axisDimVal);
110 const lowestPoint = getPoint(lowestVal, axisDimVal);
111 const highestPoint = getPoint(highestVal, axisDimVal);
112
113 const ends: number[][] = [];
114 addBodyEnd(ends, ocHighPoint, 0);
115 addBodyEnd(ends, ocLowPoint, 1);
116
117 ends.push(
118 subPixelOptimizePoint(highestPoint),
119 subPixelOptimizePoint(ocHighPoint),
120 subPixelOptimizePoint(lowestPoint),
121 subPixelOptimizePoint(ocLowPoint)
122 );
123
124 const itemModel = data.getItemModel<CandlestickDataItemOption>(dataIndex);
125 const hasDojiColor = !!itemModel.get(['itemStyle', 'borderColorDoji']);
126 data.setItemLayout(dataIndex, {
127 sign: getSign(store, dataIndex, openVal, closeVal, closeDimI, hasDojiColor),
128 initBaseline: openVal > closeVal
129 ? ocHighPoint[vDimIdx] : ocLowPoint[vDimIdx], // open point.
130 ends: ends,
131 brushRect: makeBrushRect(lowestVal, highestVal, axisDimVal)
132 } as CandlestickItemLayout);
133 }
134
135 function getPoint(val: number, axisDimVal: number) {
136 const p = [];
137 p[cDimIdx] = axisDimVal;
138 p[vDimIdx] = val;
139 return (isNaN(axisDimVal) || isNaN(val))
140 ? [NaN, NaN]
141 : coordSys.dataToPoint(p);
142 }
143
144 function addBodyEnd(ends: number[][], point: number[], start: number) {
145 const point1 = point.slice();
146 const point2 = point.slice();
147
148 point1[cDimIdx] = subPixelOptimize(
149 point1[cDimIdx] + candleWidth / 2, 1, false
150 );
151 point2[cDimIdx] = subPixelOptimize(

Callers

nothing calls this directly

Calls 10

subPixelOptimizePointFunction · 0.85
getSignFunction · 0.85
makeBrushRectFunction · 0.85
getStoreMethod · 0.80
nextMethod · 0.80
getItemModelMethod · 0.80
setItemLayoutMethod · 0.80
getPointFunction · 0.70
addBodyEndFunction · 0.70
getMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…