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

Function doCalBarWidthAndOffset

_benchmarks/sample_echarts.js:35583–35726  ·  view source on GitHub ↗
(seriesInfoList)

Source from the content-addressed store, hash-verified

35581 }
35582
35583 function doCalBarWidthAndOffset(seriesInfoList) {
35584 // Columns info on each category axis. Key is cartesian name
35585 var columnsMap = {};
35586 each(seriesInfoList, function (seriesInfo, idx) {
35587 var axisKey = seriesInfo.axisKey;
35588 var bandWidth = seriesInfo.bandWidth;
35589 var columnsOnAxis = columnsMap[axisKey] || {
35590 bandWidth: bandWidth,
35591 remainedWidth: bandWidth,
35592 autoWidthCount: 0,
35593 categoryGap: null,
35594 gap: '20%',
35595 stacks: {}
35596 };
35597 var stacks = columnsOnAxis.stacks;
35598 columnsMap[axisKey] = columnsOnAxis;
35599 var stackId = seriesInfo.stackId;
35600
35601 if (!stacks[stackId]) {
35602 columnsOnAxis.autoWidthCount++;
35603 }
35604
35605 stacks[stackId] = stacks[stackId] || {
35606 width: 0,
35607 maxWidth: 0
35608 }; // Caution: In a single coordinate system, these barGrid attributes
35609 // will be shared by series. Consider that they have default values,
35610 // only the attributes set on the last series will work.
35611 // Do not change this fact unless there will be a break change.
35612
35613 var barWidth = seriesInfo.barWidth;
35614
35615 if (barWidth && !stacks[stackId].width) {
35616 // See #6312, do not restrict width.
35617 stacks[stackId].width = barWidth;
35618 barWidth = Math.min(columnsOnAxis.remainedWidth, barWidth);
35619 columnsOnAxis.remainedWidth -= barWidth;
35620 }
35621
35622 var barMaxWidth = seriesInfo.barMaxWidth;
35623 barMaxWidth && (stacks[stackId].maxWidth = barMaxWidth);
35624 var barMinWidth = seriesInfo.barMinWidth;
35625 barMinWidth && (stacks[stackId].minWidth = barMinWidth);
35626 var barGap = seriesInfo.barGap;
35627 barGap != null && (columnsOnAxis.gap = barGap);
35628 var barCategoryGap = seriesInfo.barCategoryGap;
35629 barCategoryGap != null && (columnsOnAxis.categoryGap = barCategoryGap);
35630 });
35631 var result = {};
35632 each(columnsMap, function (columnsOnAxis, coordSysName) {
35633 result[coordSysName] = {};
35634 var stacks = columnsOnAxis.stacks;
35635 var bandWidth = columnsOnAxis.bandWidth;
35636 var categoryGapPercent = columnsOnAxis.categoryGap;
35637
35638 if (categoryGapPercent == null) {
35639 var columnCount = keys(stacks).length; // More columns in one group
35640 // the spaces between group is smaller. Or the column will be too thin.

Callers 2

getLayoutOnAxisFunction · 0.85
makeColumnLayoutFunction · 0.85

Calls 3

parsePercent$1Function · 0.85
eachFunction · 0.70
keysFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…