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

Function getCandleDataPoints

front/components/u-charts/u-charts.js:1243–1266  ·  view source on GitHub ↗
(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config)

Source from the content-addressed store, hash-verified

1241}
1242
1243function getCandleDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config) {
1244 var process = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : 1;
1245 var points = [];
1246 var validHeight = opts.height - opts.area[0] - opts.area[2];
1247 data.forEach(function(item, index) {
1248 if (item === null) {
1249 points.push(null);
1250 } else {
1251 var cPoints = [];
1252 item.forEach(function(items, indexs) {
1253 var point = {};
1254 point.x = xAxisPoints[index] + Math.round(eachSpacing / 2);
1255 var value = items.value || items;
1256 var height = validHeight * (value - minRange) / (maxRange - minRange);
1257 height *= process;
1258 point.y = opts.height - Math.round(height) - opts.area[2];
1259 cPoints.push(point);
1260 });
1261 points.push(cPoints);
1262 }
1263 });
1264
1265 return points;
1266}
1267
1268function getDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config) {
1269 var process = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : 1;

Callers 1

drawCandleDataPointsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected