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

Function makeColumnLayout

libs/echarts/echarts-en.simple.js:36736–36791  ·  view source on GitHub ↗
(barSeries)

Source from the content-addressed store, hash-verified

36734}
36735
36736function makeColumnLayout(barSeries) {
36737 var axisMinGaps = getValueAxesMinGaps(barSeries);
36738
36739 var seriesInfoList = [];
36740 each$1(barSeries, function (seriesModel) {
36741 var cartesian = seriesModel.coordinateSystem;
36742 var baseAxis = cartesian.getBaseAxis();
36743 var axisExtent = baseAxis.getExtent();
36744
36745 var bandWidth;
36746 if (baseAxis.type === 'category') {
36747 bandWidth = baseAxis.getBandWidth();
36748 }
36749 else if (baseAxis.type === 'value' || baseAxis.type === 'time') {
36750 var key = baseAxis.dim + '_' + baseAxis.index;
36751 var minGap = axisMinGaps[key];
36752 var extentSpan = Math.abs(axisExtent[1] - axisExtent[0]);
36753 var scale = baseAxis.scale.getExtent();
36754 var scaleSpan = Math.abs(scale[1] - scale[0]);
36755 bandWidth = minGap
36756 ? extentSpan / scaleSpan * minGap
36757 : extentSpan; // When there is only one data value
36758 }
36759 else {
36760 var data = seriesModel.getData();
36761 bandWidth = Math.abs(axisExtent[1] - axisExtent[0]) / data.count();
36762 }
36763
36764 var barWidth = parsePercent$1(
36765 seriesModel.get('barWidth'), bandWidth
36766 );
36767 var barMaxWidth = parsePercent$1(
36768 seriesModel.get('barMaxWidth'), bandWidth
36769 );
36770 var barMinWidth = parsePercent$1(
36771 // barMinWidth by default is 1 in cartesian. Because in value axis,
36772 // the auto-calculated bar width might be less than 1.
36773 seriesModel.get('barMinWidth') || 1, bandWidth
36774 );
36775 var barGap = seriesModel.get('barGap');
36776 var barCategoryGap = seriesModel.get('barCategoryGap');
36777
36778 seriesInfoList.push({
36779 bandWidth: bandWidth,
36780 barWidth: barWidth,
36781 barMaxWidth: barMaxWidth,
36782 barMinWidth: barMinWidth,
36783 barGap: barGap,
36784 barCategoryGap: barCategoryGap,
36785 axisKey: getAxisKey(baseAxis),
36786 stackId: getSeriesStackId(seriesModel)
36787 });
36788 });
36789
36790 return doCalBarWidthAndOffset(seriesInfoList);
36791}
36792
36793function doCalBarWidthAndOffset(seriesInfoList) {

Callers 3

layoutFunction · 0.70
getScaleExtentFunction · 0.70

Calls 10

pushMethod · 0.80
getValueAxesMinGapsFunction · 0.70
each$1Function · 0.70
parsePercent$1Function · 0.70
getAxisKeyFunction · 0.70
getSeriesStackIdFunction · 0.70
doCalBarWidthAndOffsetFunction · 0.70
getExtentMethod · 0.45
getDataMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected