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

Function getDataPoints

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

Source from the content-addressed store, hash-verified

1266}
1267
1268function getDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config) {
1269 var process = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : 1;
1270 var boundaryGap='center';
1271 if (opts.type == 'line'||opts.type == 'area'){
1272 boundaryGap=opts.xAxis.boundaryGap;
1273 }
1274 var points = [];
1275 var validHeight = opts.height - opts.area[0] - opts.area[2];
1276 data.forEach(function(item, index) {
1277 if (item === null) {
1278 points.push(null);
1279 } else {
1280 var point = {};
1281 point.color = item.color;
1282 point.x = xAxisPoints[index];
1283 if(boundaryGap=='center'){
1284 point.x += Math.round(eachSpacing / 2);
1285 }
1286 var value = item;
1287 if (typeof item === 'object' && item !== null) {
1288 value = item.value
1289 }
1290 var height = validHeight * (value - minRange) / (maxRange - minRange);
1291 height *= process;
1292 point.y = opts.height - Math.round(height) - opts.area[2];
1293 points.push(point);
1294 }
1295 });
1296
1297 return points;
1298}
1299
1300function getStackDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, seriesIndex, stackSeries) {
1301 var process = arguments.length > 9 && arguments[9] !== undefined ? arguments[9] : 1;

Callers 5

drawColumnDataPointsFunction · 0.85
drawCandleDataPointsFunction · 0.85
drawAreaDataPointsFunction · 0.85
drawLineDataPointsFunction · 0.85
drawMixDataPointsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected