MCPcopy Create free account
hub / github.com/CoderOpen/waimai / findRange

Function findRange

front/components/u-charts/u-charts.js:132–156  ·  view source on GitHub ↗
(num, type, limit)

Source from the content-addressed store, hash-verified

130}
131
132function findRange(num, type, limit) {
133 if (isNaN(num)) {
134 throw new Error('[uCharts] unvalid series data!');
135 }
136 limit = limit || 10;
137 type = type ? type : 'upper';
138 var multiple = 1;
139 while (limit < 1) {
140 limit *= 10;
141 multiple *= 10;
142 }
143 if (type === 'upper') {
144 num = Math.ceil(num * multiple);
145 } else {
146 num = Math.floor(num * multiple);
147 }
148 while (num % limit !== 0) {
149 if (type === 'upper') {
150 num++;
151 } else {
152 num--;
153 }
154 }
155 return num / multiple;
156}
157
158function calCandleMA(dayArr, nameArr, colorArr, kdata) {
159 let seriesTemp = [];

Callers 1

getDataRangeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected