MCPcopy Index your code
hub / github.com/SuperMap/iClient-JavaScript / doCalBarWidthAndOffset

Function doCalBarWidthAndOffset

libs/echarts/echarts.simple.js:36793–36936  ·  view source on GitHub ↗
(seriesInfoList)

Source from the content-addressed store, hash-verified

36791}
36792
36793function doCalBarWidthAndOffset(seriesInfoList) {
36794 // Columns info on each category axis. Key is cartesian name
36795 var columnsMap = {};
36796
36797 each$1(seriesInfoList, function (seriesInfo, idx) {
36798 var axisKey = seriesInfo.axisKey;
36799 var bandWidth = seriesInfo.bandWidth;
36800 var columnsOnAxis = columnsMap[axisKey] || {
36801 bandWidth: bandWidth,
36802 remainedWidth: bandWidth,
36803 autoWidthCount: 0,
36804 categoryGap: '20%',
36805 gap: '30%',
36806 stacks: {}
36807 };
36808 var stacks = columnsOnAxis.stacks;
36809 columnsMap[axisKey] = columnsOnAxis;
36810
36811 var stackId = seriesInfo.stackId;
36812
36813 if (!stacks[stackId]) {
36814 columnsOnAxis.autoWidthCount++;
36815 }
36816 stacks[stackId] = stacks[stackId] || {
36817 width: 0,
36818 maxWidth: 0
36819 };
36820
36821 // Caution: In a single coordinate system, these barGrid attributes
36822 // will be shared by series. Consider that they have default values,
36823 // only the attributes set on the last series will work.
36824 // Do not change this fact unless there will be a break change.
36825
36826 var barWidth = seriesInfo.barWidth;
36827 if (barWidth && !stacks[stackId].width) {
36828 // See #6312, do not restrict width.
36829 stacks[stackId].width = barWidth;
36830 barWidth = Math.min(columnsOnAxis.remainedWidth, barWidth);
36831 columnsOnAxis.remainedWidth -= barWidth;
36832 }
36833
36834 var barMaxWidth = seriesInfo.barMaxWidth;
36835 barMaxWidth && (stacks[stackId].maxWidth = barMaxWidth);
36836 var barMinWidth = seriesInfo.barMinWidth;
36837 barMinWidth && (stacks[stackId].minWidth = barMinWidth);
36838 var barGap = seriesInfo.barGap;
36839 (barGap != null) && (columnsOnAxis.gap = barGap);
36840 var barCategoryGap = seriesInfo.barCategoryGap;
36841 (barCategoryGap != null) && (columnsOnAxis.categoryGap = barCategoryGap);
36842 });
36843
36844 var result = {};
36845
36846 each$1(columnsMap, function (columnsOnAxis, coordSysName) {
36847
36848 result[coordSysName] = {};
36849
36850 var stacks = columnsOnAxis.stacks;

Callers 1

makeColumnLayoutFunction · 0.70

Calls 4

minMethod · 0.80
maxMethod · 0.80
each$1Function · 0.70
parsePercent$1Function · 0.70

Tested by

no test coverage detected