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

Function getStackDataPoints

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

Source from the content-addressed store, hash-verified

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;
1302 var points = [];
1303 var validHeight = opts.height - opts.area[0] - opts.area[2];
1304
1305 data.forEach(function(item, index) {
1306 if (item === null) {
1307 points.push(null);
1308 } else {
1309 var point = {};
1310 point.color = item.color;
1311 point.x = xAxisPoints[index] + Math.round(eachSpacing / 2);
1312
1313 if (seriesIndex > 0) {
1314 var value = 0;
1315 for (let i = 0; i <= seriesIndex; i++) {
1316 value += stackSeries[i].data[index];
1317 }
1318 var value0 = value - item;
1319 var height = validHeight * (value - minRange) / (maxRange - minRange);
1320 var height0 = validHeight * (value0 - minRange) / (maxRange - minRange);
1321 } else {
1322 var value = item;
1323 var height = validHeight * (value - minRange) / (maxRange - minRange);
1324 var height0 = 0;
1325 }
1326 var heightc = height0;
1327 height *= process;
1328 heightc *= process;
1329 point.y = opts.height - Math.round(height) - opts.area[2];
1330 point.y0 = opts.height - Math.round(heightc) - opts.area[2];
1331 points.push(point);
1332 }
1333 });
1334
1335 return points;
1336}
1337
1338function getYAxisTextList(series, opts, config, stack) {
1339 var data;

Callers 1

drawColumnDataPointsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected