MCPcopy
hub / github.com/tdewolff/minify / makeColumnLayout

Function makeColumnLayout

_benchmarks/sample_echarts.js:35539–35581  ·  view source on GitHub ↗
(barSeries)

Source from the content-addressed store, hash-verified

35537 }
35538
35539 function makeColumnLayout(barSeries) {
35540 var axisMinGaps = getValueAxesMinGaps(barSeries);
35541 var seriesInfoList = [];
35542 each(barSeries, function (seriesModel) {
35543 var cartesian = seriesModel.coordinateSystem;
35544 var baseAxis = cartesian.getBaseAxis();
35545 var axisExtent = baseAxis.getExtent();
35546 var bandWidth;
35547
35548 if (baseAxis.type === 'category') {
35549 bandWidth = baseAxis.getBandWidth();
35550 } else if (baseAxis.type === 'value' || baseAxis.type === 'time') {
35551 var key = baseAxis.dim + '_' + baseAxis.index;
35552 var minGap = axisMinGaps[key];
35553 var extentSpan = Math.abs(axisExtent[1] - axisExtent[0]);
35554 var scale = baseAxis.scale.getExtent();
35555 var scaleSpan = Math.abs(scale[1] - scale[0]);
35556 bandWidth = minGap ? extentSpan / scaleSpan * minGap : extentSpan; // When there is only one data value
35557 } else {
35558 var data = seriesModel.getData();
35559 bandWidth = Math.abs(axisExtent[1] - axisExtent[0]) / data.count();
35560 }
35561
35562 var barWidth = parsePercent$1(seriesModel.get('barWidth'), bandWidth);
35563 var barMaxWidth = parsePercent$1(seriesModel.get('barMaxWidth'), bandWidth);
35564 var barMinWidth = parsePercent$1( // barMinWidth by default is 1 in cartesian. Because in value axis,
35565 // the auto-calculated bar width might be less than 1.
35566 seriesModel.get('barMinWidth') || 1, bandWidth);
35567 var barGap = seriesModel.get('barGap');
35568 var barCategoryGap = seriesModel.get('barCategoryGap');
35569 seriesInfoList.push({
35570 bandWidth: bandWidth,
35571 barWidth: barWidth,
35572 barMaxWidth: barMaxWidth,
35573 barMinWidth: barMinWidth,
35574 barGap: barGap,
35575 barCategoryGap: barCategoryGap,
35576 axisKey: getAxisKey(baseAxis),
35577 stackId: getSeriesStackId(seriesModel)
35578 });
35579 });
35580 return doCalBarWidthAndOffset(seriesInfoList);
35581 }
35582
35583 function doCalBarWidthAndOffset(seriesInfoList) {
35584 // Columns info on each category axis. Key is cartesian name

Callers 3

layoutFunction · 0.85
sample_echarts.jsFile · 0.85
getScaleExtentFunction · 0.85

Calls 6

getValueAxesMinGapsFunction · 0.85
parsePercent$1Function · 0.85
getAxisKeyFunction · 0.85
getSeriesStackIdFunction · 0.85
doCalBarWidthAndOffsetFunction · 0.85
eachFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…