echarts 4.4.0 → 4.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/ISSUE_TEMPLATE.md +1 -1
- package/.github/workflows/nodejs.yml +31 -0
- package/CONTRIBUTING.md +2 -2
- package/README.md +6 -12
- package/dist/echarts-en.common.js +2354 -1029
- package/dist/echarts-en.common.min.js +1 -1
- package/dist/echarts-en.js +2727 -1138
- package/dist/echarts-en.js.map +1 -1
- package/dist/echarts-en.min.js +1 -1
- package/dist/echarts-en.simple.js +2028 -759
- package/dist/echarts-en.simple.min.js +1 -1
- package/dist/echarts.common.js +2354 -1029
- package/dist/echarts.common.min.js +1 -1
- package/dist/echarts.js +2727 -1138
- package/dist/echarts.js.map +1 -1
- package/dist/echarts.min.js +1 -1
- package/dist/echarts.simple.js +2028 -759
- package/dist/echarts.simple.min.js +1 -1
- package/dist/extension/dataTool.js +9 -0
- package/dist/extension/dataTool.js.map +1 -1
- package/echarts.all.js +1 -1
- package/lib/chart/bar/BarSeries.js +4 -1
- package/lib/chart/bar/BarView.js +20 -6
- package/lib/chart/bar/BaseBarSeries.js +5 -1
- package/lib/chart/candlestick/CandlestickSeries.js +1 -0
- package/lib/chart/candlestick/CandlestickView.js +42 -1
- package/lib/chart/custom.js +1 -0
- package/lib/chart/effectScatter/EffectScatterSeries.js +3 -1
- package/lib/chart/funnel/FunnelSeries.js +15 -5
- package/lib/chart/gauge/GaugeSeries.js +0 -9
- package/lib/chart/graph/GraphSeries.js +11 -4
- package/lib/chart/graph/GraphView.js +28 -8
- package/lib/chart/graph/forceHelper.js +8 -2
- package/lib/chart/graph/forceLayout.js +5 -2
- package/lib/chart/heatmap/HeatmapView.js +4 -4
- package/lib/chart/helper/Symbol.js +8 -0
- package/lib/chart/helper/createListFromArray.js +14 -8
- package/lib/chart/helper/whiskerBoxCommon.js +22 -16
- package/lib/chart/line/LineSeries.js +3 -1
- package/lib/chart/line/LineView.js +8 -2
- package/lib/chart/map/MapSeries.js +8 -1
- package/lib/chart/pie/PieSeries.js +27 -6
- package/lib/chart/pie/PieView.js +1 -1
- package/lib/chart/pie/labelLayout.js +102 -19
- package/lib/chart/pie/pieLayout.js +19 -7
- package/lib/chart/radar/RadarSeries.js +3 -3
- package/lib/chart/sankey/SankeyView.js +28 -9
- package/lib/chart/scatter/ScatterSeries.js +3 -1
- package/lib/chart/themeRiver/ThemeRiverSeries.js +3 -3
- package/lib/chart/tree/TreeSeries.js +15 -1
- package/lib/chart/tree/TreeView.js +4 -2
- package/lib/component/axis/AngleAxisView.js +97 -20
- package/lib/component/axis/AxisBuilder.js +63 -24
- package/lib/component/axis/CartesianAxisView.js +55 -11
- package/lib/component/axis/RadiusAxisView.js +36 -4
- package/lib/component/brush/BrushView.js +6 -0
- package/lib/component/brush/brushAction.js +5 -0
- package/lib/component/dataZoom/DataZoomModel.js +15 -1
- package/lib/component/dataZoom/SliderZoomView.js +4 -10
- package/lib/component/helper/BrushController.js +43 -25
- package/lib/component/legend/LegendModel.js +3 -3
- package/lib/component/legend/LegendView.js +17 -13
- package/lib/component/toolbox/ToolboxView.js +16 -7
- package/lib/component/toolbox/feature/MagicType.js +19 -14
- package/lib/coord/Axis.js +44 -12
- package/lib/coord/axisDefault.js +21 -2
- package/lib/coord/axisTickLabelBuilder.js +9 -1
- package/lib/coord/cartesian/Cartesian2D.js +0 -15
- package/lib/coord/geo/geoJSONLoader.js +1 -1
- package/lib/coord/polar/polarCreator.js +11 -2
- package/lib/coord/radar/Radar.js +3 -1
- package/lib/coord/radar/RadarModel.js +4 -1
- package/lib/data/DataDiffer.js +2 -4
- package/lib/data/DataDimensionInfo.js +157 -0
- package/lib/data/List.js +29 -23
- package/lib/data/Tree.js +2 -1
- package/lib/data/helper/completeDimensions.js +43 -32
- package/lib/data/helper/createDimensions.js +2 -0
- package/lib/data/helper/sourceHelper.js +214 -114
- package/lib/echarts.js +2 -2
- package/lib/layout/barGrid.js +136 -11
- package/lib/layout/barPolar.js +2 -2
- package/lib/model/Global.js +1 -1
- package/lib/model/Series.js +3 -3
- package/lib/model/referHelper.js +40 -12
- package/lib/scale/Interval.js +87 -2
- package/lib/scale/Log.js +9 -2
- package/lib/scale/helper.js +1 -43
- package/lib/theme/dark.js +3 -0
- package/lib/util/graphic.js +1 -2
- package/lib/util/number.js +25 -1
- package/lib/util/shape/sausage.js +93 -0
- package/lib/visual/LegendVisualProvider.js +75 -0
- package/lib/visual/dataColor.js +2 -12
- package/lib/visual/seriesColor.js +15 -7
- package/map/js/china.js +2 -2
- package/map/json/china.json +1 -1
- package/map/json/province/tianjin.json +1 -1
- package/package.json +3 -2
- package/src/chart/bar/BarSeries.js +5 -1
- package/src/chart/bar/BarView.js +24 -8
- package/src/chart/bar/BaseBarSeries.js +5 -1
- package/src/chart/candlestick/CandlestickSeries.js +2 -0
- package/src/chart/candlestick/CandlestickView.js +44 -1
- package/src/chart/custom.js +1 -0
- package/src/chart/effectScatter/EffectScatterSeries.js +1 -1
- package/src/chart/funnel/FunnelSeries.js +11 -4
- package/src/chart/gauge/GaugeSeries.js +0 -6
- package/src/chart/graph/GraphSeries.js +10 -3
- package/src/chart/graph/GraphView.js +26 -8
- package/src/chart/graph/forceHelper.js +7 -3
- package/src/chart/graph/forceLayout.js +6 -3
- package/src/chart/heatmap/HeatmapView.js +4 -4
- package/src/chart/helper/Symbol.js +9 -0
- package/src/chart/helper/createClipPathFromCoordSys.js +5 -1
- package/src/chart/helper/createGraphFromNodeEdge.js +1 -1
- package/src/chart/helper/createListFromArray.js +13 -8
- package/src/chart/helper/whiskerBoxCommon.js +21 -16
- package/src/chart/line/LineSeries.js +1 -1
- package/src/chart/line/LineView.js +6 -1
- package/src/chart/map/MapSeries.js +5 -1
- package/src/chart/pie/PieSeries.js +26 -5
- package/src/chart/pie/PieView.js +1 -1
- package/src/chart/pie/labelLayout.js +114 -22
- package/src/chart/pie/pieLayout.js +20 -7
- package/src/chart/radar/RadarSeries.js +5 -3
- package/src/chart/sankey/SankeyView.js +26 -9
- package/src/chart/scatter/ScatterSeries.js +1 -1
- package/src/chart/themeRiver/ThemeRiverSeries.js +4 -3
- package/src/chart/tree/TreeSeries.js +12 -1
- package/src/chart/tree/TreeView.js +5 -2
- package/src/component/axis/AngleAxisView.js +106 -19
- package/src/component/axis/AxisBuilder.js +78 -33
- package/src/component/axis/CartesianAxisView.js +58 -11
- package/src/component/axis/RadiusAxisView.js +37 -4
- package/src/component/brush/BrushView.js +6 -0
- package/src/component/brush/brushAction.js +6 -1
- package/src/component/dataZoom/DataZoomModel.js +15 -1
- package/src/component/dataZoom/SliderZoomView.js +4 -9
- package/src/component/helper/BrushController.js +50 -28
- package/src/component/legend/LegendModel.js +3 -3
- package/src/component/legend/LegendView.js +18 -12
- package/src/component/toolbox/ToolboxView.js +18 -5
- package/src/component/toolbox/feature/MagicType.js +18 -13
- package/src/coord/Axis.js +48 -13
- package/src/coord/axisDefault.js +25 -1
- package/src/coord/axisTickLabelBuilder.js +10 -0
- package/src/coord/cartesian/Cartesian2D.js +0 -13
- package/src/coord/geo/geoJSONLoader.js +2 -2
- package/src/coord/polar/polarCreator.js +16 -3
- package/src/coord/radar/Radar.js +3 -1
- package/src/coord/radar/RadarModel.js +5 -2
- package/src/data/DataDiffer.js +1 -4
- package/src/data/DataDimensionInfo.js +135 -0
- package/src/data/Graph.js +1 -1
- package/src/data/List.js +33 -20
- package/src/data/Tree.js +3 -1
- package/src/data/helper/completeDimensions.js +49 -30
- package/src/data/helper/createDimensions.js +2 -0
- package/src/data/helper/sourceHelper.js +216 -124
- package/src/echarts.js +2 -2
- package/src/layout/barGrid.js +136 -13
- package/src/layout/barPolar.js +3 -2
- package/src/model/Global.js +1 -1
- package/src/model/Series.js +3 -3
- package/src/model/referHelper.js +34 -11
- package/src/scale/Interval.js +84 -4
- package/src/scale/Log.js +9 -2
- package/src/scale/helper.js +1 -39
- package/src/theme/dark.js +3 -0
- package/src/util/graphic.js +1 -2
- package/src/util/number.js +22 -2
- package/src/util/shape/sausage.js +93 -0
- package/src/visual/LegendVisualProvider.js +55 -0
- package/src/visual/dataColor.js +0 -13
- package/src/visual/seriesColor.js +13 -7
- package/theme/azul.js +163 -0
- package/theme/bee-inspired.js +178 -0
- package/theme/blue.js +178 -0
- package/theme/caravan.js +178 -0
- package/theme/carp.js +163 -0
- package/theme/cool.js +180 -0
- package/theme/dark-blue.js +168 -0
- package/theme/dark-bold.js +168 -0
- package/theme/dark-digerati.js +168 -0
- package/theme/dark-fresh-cut.js +168 -0
- package/theme/dark-mushroom.js +168 -0
- package/theme/dark.js +69 -62
- package/theme/eduardo.js +178 -0
- package/theme/forest.js +163 -0
- package/theme/fresh-cut.js +163 -0
- package/theme/fruit.js +178 -0
- package/theme/gray.js +220 -0
- package/theme/green.js +222 -0
- package/theme/helianthus.js +263 -0
- package/theme/infographic.js +72 -57
- package/theme/inspired.js +163 -0
- package/theme/jazz.js +163 -0
- package/theme/london.js +163 -0
- package/theme/macarons.js +80 -57
- package/theme/macarons2.js +251 -0
- package/theme/mint.js +155 -0
- package/theme/red-velvet.js +163 -0
- package/theme/red.js +225 -0
- package/theme/roma.js +55 -22
- package/theme/royal.js +163 -0
- package/theme/sakura.js +140 -0
- package/theme/shine.js +52 -45
- package/theme/tech-blue.js +180 -0
- package/theme/vintage.js +37 -23
- package/.travis.yml +0 -16
package/src/layout/barGrid.js
CHANGED
|
@@ -43,6 +43,7 @@ function getAxisKey(axis) {
|
|
|
43
43
|
* @param {number} opt.count Positive interger.
|
|
44
44
|
* @param {number} [opt.barWidth]
|
|
45
45
|
* @param {number} [opt.barMaxWidth]
|
|
46
|
+
* @param {number} [opt.barMinWidth]
|
|
46
47
|
* @param {number} [opt.barGap]
|
|
47
48
|
* @param {number} [opt.barCategoryGap]
|
|
48
49
|
* @return {Object} {width, offset, offsetCenter} If axis.type is not 'category', return undefined.
|
|
@@ -87,16 +88,101 @@ export function prepareLayoutBarSeries(seriesType, ecModel) {
|
|
|
87
88
|
return seriesModels;
|
|
88
89
|
}
|
|
89
90
|
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Map from (baseAxis.dim + '_' + baseAxis.index) to min gap of two adjacent
|
|
94
|
+
* values.
|
|
95
|
+
* This works for time axes, value axes, and log axes.
|
|
96
|
+
* For a single time axis, return value is in the form like
|
|
97
|
+
* {'x_0': [1000000]}.
|
|
98
|
+
* The value of 1000000 is in milliseconds.
|
|
99
|
+
*/
|
|
100
|
+
function getValueAxesMinGaps(barSeries) {
|
|
101
|
+
/**
|
|
102
|
+
* Map from axis.index to values.
|
|
103
|
+
* For a single time axis, axisValues is in the form like
|
|
104
|
+
* {'x_0': [1495555200000, 1495641600000, 1495728000000]}.
|
|
105
|
+
* Items in axisValues[x], e.g. 1495555200000, are time values of all
|
|
106
|
+
* series.
|
|
107
|
+
*/
|
|
108
|
+
var axisValues = {};
|
|
109
|
+
zrUtil.each(barSeries, function (seriesModel) {
|
|
110
|
+
var cartesian = seriesModel.coordinateSystem;
|
|
111
|
+
var baseAxis = cartesian.getBaseAxis();
|
|
112
|
+
if (baseAxis.type !== 'time' && baseAxis.type !== 'value') {
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
var data = seriesModel.getData();
|
|
117
|
+
var key = baseAxis.dim + '_' + baseAxis.index;
|
|
118
|
+
var dim = data.mapDimension(baseAxis.dim);
|
|
119
|
+
for (var i = 0, cnt = data.count(); i < cnt; ++i) {
|
|
120
|
+
var value = data.get(dim, i);
|
|
121
|
+
if (!axisValues[key]) {
|
|
122
|
+
// No previous data for the axis
|
|
123
|
+
axisValues[key] = [value];
|
|
124
|
+
}
|
|
125
|
+
else {
|
|
126
|
+
// No value in previous series
|
|
127
|
+
axisValues[key].push(value);
|
|
128
|
+
}
|
|
129
|
+
// Ignore duplicated time values in the same axis
|
|
130
|
+
}
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
var axisMinGaps = [];
|
|
134
|
+
for (var key in axisValues) {
|
|
135
|
+
if (axisValues.hasOwnProperty(key)) {
|
|
136
|
+
var valuesInAxis = axisValues[key];
|
|
137
|
+
if (valuesInAxis) {
|
|
138
|
+
// Sort axis values into ascending order to calculate gaps
|
|
139
|
+
valuesInAxis.sort(function (a, b) {
|
|
140
|
+
return a - b;
|
|
141
|
+
});
|
|
142
|
+
|
|
143
|
+
var min = null;
|
|
144
|
+
for (var j = 1; j < valuesInAxis.length; ++j) {
|
|
145
|
+
var delta = valuesInAxis[j] - valuesInAxis[j - 1];
|
|
146
|
+
if (delta > 0) {
|
|
147
|
+
// Ignore 0 delta because they are of the same axis value
|
|
148
|
+
min = min === null ? delta : Math.min(min, delta);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
// Set to null if only have one data
|
|
152
|
+
axisMinGaps[key] = min;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
return axisMinGaps;
|
|
157
|
+
}
|
|
158
|
+
|
|
90
159
|
export function makeColumnLayout(barSeries) {
|
|
160
|
+
var axisMinGaps = getValueAxesMinGaps(barSeries);
|
|
161
|
+
|
|
91
162
|
var seriesInfoList = [];
|
|
92
163
|
zrUtil.each(barSeries, function (seriesModel) {
|
|
93
|
-
var data = seriesModel.getData();
|
|
94
164
|
var cartesian = seriesModel.coordinateSystem;
|
|
95
165
|
var baseAxis = cartesian.getBaseAxis();
|
|
96
166
|
var axisExtent = baseAxis.getExtent();
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
167
|
+
|
|
168
|
+
var bandWidth;
|
|
169
|
+
if (baseAxis.type === 'category') {
|
|
170
|
+
bandWidth = baseAxis.getBandWidth();
|
|
171
|
+
}
|
|
172
|
+
else if (baseAxis.type === 'value' || baseAxis.type === 'time') {
|
|
173
|
+
var key = baseAxis.dim + '_' + baseAxis.index;
|
|
174
|
+
var minGap = axisMinGaps[key];
|
|
175
|
+
var extentSpan = Math.abs(axisExtent[1] - axisExtent[0]);
|
|
176
|
+
var scale = baseAxis.scale.getExtent();
|
|
177
|
+
var scaleSpan = Math.abs(scale[1] - scale[0]);
|
|
178
|
+
bandWidth = minGap
|
|
179
|
+
? extentSpan / scaleSpan * minGap
|
|
180
|
+
: extentSpan; // When there is only one data value
|
|
181
|
+
}
|
|
182
|
+
else {
|
|
183
|
+
var data = seriesModel.getData();
|
|
184
|
+
bandWidth = Math.abs(axisExtent[1] - axisExtent[0]) / data.count();
|
|
185
|
+
}
|
|
100
186
|
|
|
101
187
|
var barWidth = parsePercent(
|
|
102
188
|
seriesModel.get('barWidth'), bandWidth
|
|
@@ -104,6 +190,11 @@ export function makeColumnLayout(barSeries) {
|
|
|
104
190
|
var barMaxWidth = parsePercent(
|
|
105
191
|
seriesModel.get('barMaxWidth'), bandWidth
|
|
106
192
|
);
|
|
193
|
+
var barMinWidth = parsePercent(
|
|
194
|
+
// barMinWidth by default is 1 in cartesian. Because in value axis,
|
|
195
|
+
// the auto-calculated bar width might be less than 1.
|
|
196
|
+
seriesModel.get('barMinWidth') || 1, bandWidth
|
|
197
|
+
);
|
|
107
198
|
var barGap = seriesModel.get('barGap');
|
|
108
199
|
var barCategoryGap = seriesModel.get('barCategoryGap');
|
|
109
200
|
|
|
@@ -111,6 +202,7 @@ export function makeColumnLayout(barSeries) {
|
|
|
111
202
|
bandWidth: bandWidth,
|
|
112
203
|
barWidth: barWidth,
|
|
113
204
|
barMaxWidth: barMaxWidth,
|
|
205
|
+
barMinWidth: barMinWidth,
|
|
114
206
|
barGap: barGap,
|
|
115
207
|
barCategoryGap: barCategoryGap,
|
|
116
208
|
axisKey: getAxisKey(baseAxis),
|
|
@@ -154,7 +246,6 @@ function doCalBarWidthAndOffset(seriesInfoList) {
|
|
|
154
246
|
// only the attributes set on the last series will work.
|
|
155
247
|
// Do not change this fact unless there will be a break change.
|
|
156
248
|
|
|
157
|
-
// TODO
|
|
158
249
|
var barWidth = seriesInfo.barWidth;
|
|
159
250
|
if (barWidth && !stacks[stackId].width) {
|
|
160
251
|
// See #6312, do not restrict width.
|
|
@@ -165,6 +256,8 @@ function doCalBarWidthAndOffset(seriesInfoList) {
|
|
|
165
256
|
|
|
166
257
|
var barMaxWidth = seriesInfo.barMaxWidth;
|
|
167
258
|
barMaxWidth && (stacks[stackId].maxWidth = barMaxWidth);
|
|
259
|
+
var barMinWidth = seriesInfo.barMinWidth;
|
|
260
|
+
barMinWidth && (stacks[stackId].minWidth = barMinWidth);
|
|
168
261
|
var barGap = seriesInfo.barGap;
|
|
169
262
|
(barGap != null) && (columnsOnAxis.gap = barGap);
|
|
170
263
|
var barCategoryGap = seriesInfo.barCategoryGap;
|
|
@@ -189,15 +282,43 @@ function doCalBarWidthAndOffset(seriesInfoList) {
|
|
|
189
282
|
autoWidth = Math.max(autoWidth, 0);
|
|
190
283
|
|
|
191
284
|
// Find if any auto calculated bar exceeded maxBarWidth
|
|
192
|
-
zrUtil.each(stacks, function (column
|
|
285
|
+
zrUtil.each(stacks, function (column) {
|
|
193
286
|
var maxWidth = column.maxWidth;
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
287
|
+
var minWidth = column.minWidth;
|
|
288
|
+
|
|
289
|
+
if (!column.width) {
|
|
290
|
+
var finalWidth = autoWidth;
|
|
291
|
+
if (maxWidth && maxWidth < finalWidth) {
|
|
292
|
+
finalWidth = Math.min(maxWidth, remainedWidth);
|
|
293
|
+
}
|
|
294
|
+
// `minWidth` has higher priority. `minWidth` decide that wheter the
|
|
295
|
+
// bar is able to be visible. So `minWidth` should not be restricted
|
|
296
|
+
// by `maxWidth` or `remainedWidth` (which is from `bandWidth`). In
|
|
297
|
+
// the extreme cases for `value` axis, bars are allowed to overlap
|
|
298
|
+
// with each other if `minWidth` specified.
|
|
299
|
+
if (minWidth && minWidth > finalWidth) {
|
|
300
|
+
finalWidth = minWidth;
|
|
301
|
+
}
|
|
302
|
+
if (finalWidth !== autoWidth) {
|
|
303
|
+
column.width = finalWidth;
|
|
304
|
+
remainedWidth -= finalWidth + barGapPercent * finalWidth;
|
|
305
|
+
autoWidthCount--;
|
|
198
306
|
}
|
|
199
|
-
|
|
200
|
-
|
|
307
|
+
}
|
|
308
|
+
else {
|
|
309
|
+
// `barMinWidth/barMaxWidth` has higher priority than `barWidth`, as
|
|
310
|
+
// CSS does. Becuase barWidth can be a percent value, where
|
|
311
|
+
// `barMaxWidth` can be used to restrict the final width.
|
|
312
|
+
var finalWidth = column.width;
|
|
313
|
+
if (maxWidth) {
|
|
314
|
+
finalWidth = Math.min(finalWidth, maxWidth);
|
|
315
|
+
}
|
|
316
|
+
// `minWidth` has higher priority, as described above
|
|
317
|
+
if (minWidth) {
|
|
318
|
+
finalWidth = Math.max(finalWidth, minWidth);
|
|
319
|
+
}
|
|
320
|
+
column.width = finalWidth;
|
|
321
|
+
remainedWidth -= finalWidth + barGapPercent * finalWidth;
|
|
201
322
|
autoWidthCount--;
|
|
202
323
|
}
|
|
203
324
|
});
|
|
@@ -205,8 +326,10 @@ function doCalBarWidthAndOffset(seriesInfoList) {
|
|
|
205
326
|
// Recalculate width again
|
|
206
327
|
autoWidth = (remainedWidth - categoryGap)
|
|
207
328
|
/ (autoWidthCount + (autoWidthCount - 1) * barGapPercent);
|
|
329
|
+
|
|
208
330
|
autoWidth = Math.max(autoWidth, 0);
|
|
209
331
|
|
|
332
|
+
|
|
210
333
|
var widthSum = 0;
|
|
211
334
|
var lastColumn;
|
|
212
335
|
zrUtil.each(stacks, function (column, idx) {
|
|
@@ -433,5 +556,5 @@ function isInLargeMode(seriesModel) {
|
|
|
433
556
|
|
|
434
557
|
// See cases in `test/bar-start.html` and `#7412`, `#8747`.
|
|
435
558
|
function getValueAxisStart(baseAxis, valueAxis, stacked) {
|
|
436
|
-
return valueAxis.toGlobalCoord(valueAxis.dataToCoord(0));
|
|
559
|
+
return valueAxis.toGlobalCoord(valueAxis.dataToCoord(valueAxis.type === 'log' ? 1 : 0));
|
|
437
560
|
}
|
package/src/layout/barPolar.js
CHANGED
|
@@ -79,6 +79,8 @@ function barLayoutPolar(seriesType, ecModel, api) {
|
|
|
79
79
|
var valueDim = data.mapDimension(valueAxis.dim);
|
|
80
80
|
var baseDim = data.mapDimension(baseAxis.dim);
|
|
81
81
|
var stacked = isDimensionStacked(data, valueDim /*, baseDim*/);
|
|
82
|
+
var clampLayout = baseAxis.dim !== 'radius'
|
|
83
|
+
|| !seriesModel.get('roundCap', true);
|
|
82
84
|
|
|
83
85
|
var valueAxisStart = valueAxis.getExtent()[0];
|
|
84
86
|
|
|
@@ -130,8 +132,7 @@ function barLayoutPolar(seriesType, ecModel, api) {
|
|
|
130
132
|
}
|
|
131
133
|
// tangential sector
|
|
132
134
|
else {
|
|
133
|
-
|
|
134
|
-
var angleSpan = valueAxis.dataToAngle(value, true) - valueAxisStart;
|
|
135
|
+
var angleSpan = valueAxis.dataToAngle(value, clampLayout) - valueAxisStart;
|
|
135
136
|
var radius = baseAxis.dataToRadius(baseValue);
|
|
136
137
|
|
|
137
138
|
if (Math.abs(angleSpan) < barMinAngle) {
|
package/src/model/Global.js
CHANGED
|
@@ -212,7 +212,7 @@ var GlobalModel = Model.extend({
|
|
|
212
212
|
mainType, resultItem.keyInfo.subType, true
|
|
213
213
|
);
|
|
214
214
|
|
|
215
|
-
if (componentModel && componentModel
|
|
215
|
+
if (componentModel && componentModel.constructor === ComponentModelClass) {
|
|
216
216
|
componentModel.name = resultItem.keyInfo.name;
|
|
217
217
|
// componentModel.settingTask && componentModel.settingTask.dirty();
|
|
218
218
|
componentModel.mergeOption(newCptOption, this);
|
package/src/model/Series.js
CHANGED
|
@@ -62,11 +62,11 @@ var SeriesModel = ComponentModel.extend({
|
|
|
62
62
|
defaultOption: null,
|
|
63
63
|
|
|
64
64
|
/**
|
|
65
|
-
*
|
|
66
|
-
* @type {
|
|
65
|
+
* legend visual provider to the legend component
|
|
66
|
+
* @type {Object}
|
|
67
67
|
*/
|
|
68
68
|
// PENDING
|
|
69
|
-
|
|
69
|
+
legendVisualProvider: null,
|
|
70
70
|
|
|
71
71
|
/**
|
|
72
72
|
* Access path of color for visual
|
package/src/model/referHelper.js
CHANGED
|
@@ -30,7 +30,8 @@ import {__DEV__} from '../config';
|
|
|
30
30
|
import {createHashMap, retrieve, each} from 'zrender/src/core/util';
|
|
31
31
|
|
|
32
32
|
/**
|
|
33
|
-
* @
|
|
33
|
+
* @class
|
|
34
|
+
* For example:
|
|
34
35
|
* {
|
|
35
36
|
* coordSysName: 'cartesian2d',
|
|
36
37
|
* coordSysDims: ['x', 'y', ...],
|
|
@@ -42,19 +43,41 @@ import {createHashMap, retrieve, each} from 'zrender/src/core/util';
|
|
|
42
43
|
* x: xAxisModel,
|
|
43
44
|
* y: undefined
|
|
44
45
|
* }),
|
|
45
|
-
* //
|
|
46
|
+
* // The index of the first category axis in `coordSysDims`.
|
|
47
|
+
* // `null/undefined` means no category axis exists.
|
|
46
48
|
* firstCategoryDimIndex: 1,
|
|
47
49
|
* // To replace user specified encode.
|
|
48
50
|
* }
|
|
49
51
|
*/
|
|
50
|
-
|
|
52
|
+
function CoordSysInfo(coordSysName) {
|
|
53
|
+
/**
|
|
54
|
+
* @type {string}
|
|
55
|
+
*/
|
|
56
|
+
this.coordSysName = coordSysName;
|
|
57
|
+
/**
|
|
58
|
+
* @type {Array.<string>}
|
|
59
|
+
*/
|
|
60
|
+
this.coordSysDims = [];
|
|
61
|
+
/**
|
|
62
|
+
* @type {module:zrender/core/util#HashMap}
|
|
63
|
+
*/
|
|
64
|
+
this.axisMap = createHashMap();
|
|
65
|
+
/**
|
|
66
|
+
* @type {module:zrender/core/util#HashMap}
|
|
67
|
+
*/
|
|
68
|
+
this.categoryAxisMap = createHashMap();
|
|
69
|
+
/**
|
|
70
|
+
* @type {number}
|
|
71
|
+
*/
|
|
72
|
+
this.firstCategoryDimIndex = null;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* @return {module:model/referHelper#CoordSysInfo}
|
|
77
|
+
*/
|
|
78
|
+
export function getCoordSysInfoBySeries(seriesModel) {
|
|
51
79
|
var coordSysName = seriesModel.get('coordinateSystem');
|
|
52
|
-
var result =
|
|
53
|
-
coordSysName: coordSysName,
|
|
54
|
-
coordSysDims: [],
|
|
55
|
-
axisMap: createHashMap(),
|
|
56
|
-
categoryAxisMap: createHashMap()
|
|
57
|
-
};
|
|
80
|
+
var result = new CoordSysInfo(coordSysName);
|
|
58
81
|
var fetch = fetchers[coordSysName];
|
|
59
82
|
if (fetch) {
|
|
60
83
|
fetch(seriesModel, result, result.axisMap, result.categoryAxisMap);
|
|
@@ -95,7 +118,7 @@ var fetchers = {
|
|
|
95
118
|
}
|
|
96
119
|
if (isCategory(yAxisModel)) {
|
|
97
120
|
categoryAxisMap.set('y', yAxisModel);
|
|
98
|
-
result.firstCategoryDimIndex = 1;
|
|
121
|
+
result.firstCategoryDimIndex == null & (result.firstCategoryDimIndex = 1);
|
|
99
122
|
}
|
|
100
123
|
},
|
|
101
124
|
|
|
@@ -141,7 +164,7 @@ var fetchers = {
|
|
|
141
164
|
}
|
|
142
165
|
if (isCategory(angleAxisModel)) {
|
|
143
166
|
categoryAxisMap.set('angle', angleAxisModel);
|
|
144
|
-
result.firstCategoryDimIndex = 1;
|
|
167
|
+
result.firstCategoryDimIndex == null && (result.firstCategoryDimIndex = 1);
|
|
145
168
|
}
|
|
146
169
|
},
|
|
147
170
|
|
package/src/scale/Interval.js
CHANGED
|
@@ -81,12 +81,92 @@ var IntervalScale = Scale.extend({
|
|
|
81
81
|
},
|
|
82
82
|
|
|
83
83
|
/**
|
|
84
|
+
* @param {boolean} [expandToNicedExtent=false] If expand the ticks to niced extent.
|
|
84
85
|
* @return {Array.<number>}
|
|
85
86
|
*/
|
|
86
|
-
getTicks: function () {
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
87
|
+
getTicks: function (expandToNicedExtent) {
|
|
88
|
+
var interval = this._interval;
|
|
89
|
+
var extent = this._extent;
|
|
90
|
+
var niceTickExtent = this._niceExtent;
|
|
91
|
+
var intervalPrecision = this._intervalPrecision;
|
|
92
|
+
|
|
93
|
+
var ticks = [];
|
|
94
|
+
// If interval is 0, return [];
|
|
95
|
+
if (!interval) {
|
|
96
|
+
return ticks;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
// Consider this case: using dataZoom toolbox, zoom and zoom.
|
|
100
|
+
var safeLimit = 10000;
|
|
101
|
+
|
|
102
|
+
if (extent[0] < niceTickExtent[0]) {
|
|
103
|
+
if (expandToNicedExtent) {
|
|
104
|
+
ticks.push(roundNumber(niceTickExtent[0] - interval));
|
|
105
|
+
}
|
|
106
|
+
else {
|
|
107
|
+
ticks.push(extent[0]);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
var tick = niceTickExtent[0];
|
|
111
|
+
|
|
112
|
+
while (tick <= niceTickExtent[1]) {
|
|
113
|
+
ticks.push(tick);
|
|
114
|
+
// Avoid rounding error
|
|
115
|
+
tick = roundNumber(tick + interval, intervalPrecision);
|
|
116
|
+
if (tick === ticks[ticks.length - 1]) {
|
|
117
|
+
// Consider out of safe float point, e.g.,
|
|
118
|
+
// -3711126.9907707 + 2e-10 === -3711126.9907707
|
|
119
|
+
break;
|
|
120
|
+
}
|
|
121
|
+
if (ticks.length > safeLimit) {
|
|
122
|
+
return [];
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
// Consider this case: the last item of ticks is smaller
|
|
126
|
+
// than niceTickExtent[1] and niceTickExtent[1] === extent[1].
|
|
127
|
+
var lastNiceTick = ticks.length ? ticks[ticks.length - 1] : niceTickExtent[1];
|
|
128
|
+
if (extent[1] > lastNiceTick) {
|
|
129
|
+
if (expandToNicedExtent) {
|
|
130
|
+
ticks.push(lastNiceTick + interval);
|
|
131
|
+
}
|
|
132
|
+
else {
|
|
133
|
+
ticks.push(extent[1]);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
return ticks;
|
|
138
|
+
},
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* @param {number} [splitNumber=5]
|
|
142
|
+
* @return {Array.<Array.<number>>}
|
|
143
|
+
*/
|
|
144
|
+
getMinorTicks: function (splitNumber) {
|
|
145
|
+
var ticks = this.getTicks(true);
|
|
146
|
+
var minorTicks = [];
|
|
147
|
+
var extent = this.getExtent();
|
|
148
|
+
|
|
149
|
+
for (var i = 1; i < ticks.length; i++) {
|
|
150
|
+
var nextTick = ticks[i];
|
|
151
|
+
var prevTick = ticks[i - 1];
|
|
152
|
+
var count = 0;
|
|
153
|
+
var minorTicksGroup = [];
|
|
154
|
+
var interval = nextTick - prevTick;
|
|
155
|
+
var minorInterval = interval / splitNumber;
|
|
156
|
+
|
|
157
|
+
while (count < splitNumber - 1) {
|
|
158
|
+
var minorTick = numberUtil.round(prevTick + (count + 1) * minorInterval);
|
|
159
|
+
|
|
160
|
+
// For the first and last interval. The count may be less than splitNumber.
|
|
161
|
+
if (minorTick > extent[0] && minorTick < extent[1]) {
|
|
162
|
+
minorTicksGroup.push(minorTick);
|
|
163
|
+
}
|
|
164
|
+
count++;
|
|
165
|
+
}
|
|
166
|
+
minorTicks.push(minorTicksGroup);
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
return minorTicks;
|
|
90
170
|
},
|
|
91
171
|
|
|
92
172
|
/**
|
package/src/scale/Log.js
CHANGED
|
@@ -53,14 +53,15 @@ var LogScale = Scale.extend({
|
|
|
53
53
|
},
|
|
54
54
|
|
|
55
55
|
/**
|
|
56
|
+
* @param {boolean} [expandToNicedExtent=false] If expand the ticks to niced extent.
|
|
56
57
|
* @return {Array.<number>}
|
|
57
58
|
*/
|
|
58
|
-
getTicks: function () {
|
|
59
|
+
getTicks: function (expandToNicedExtent) {
|
|
59
60
|
var originalScale = this._originalScale;
|
|
60
61
|
var extent = this._extent;
|
|
61
62
|
var originalExtent = originalScale.getExtent();
|
|
62
63
|
|
|
63
|
-
return zrUtil.map(intervalScaleProto.getTicks.call(this), function (val) {
|
|
64
|
+
return zrUtil.map(intervalScaleProto.getTicks.call(this, expandToNicedExtent), function (val) {
|
|
64
65
|
var powVal = numberUtil.round(mathPow(this.base, val));
|
|
65
66
|
|
|
66
67
|
// Fix #4158
|
|
@@ -75,6 +76,12 @@ var LogScale = Scale.extend({
|
|
|
75
76
|
}, this);
|
|
76
77
|
},
|
|
77
78
|
|
|
79
|
+
/**
|
|
80
|
+
* @param {number} splitNumber
|
|
81
|
+
* @return {Array.<Array.<number>>}
|
|
82
|
+
*/
|
|
83
|
+
getMinorTicks: intervalScaleProto.getMinorTicks,
|
|
84
|
+
|
|
78
85
|
/**
|
|
79
86
|
* @param {number} val
|
|
80
87
|
* @return {string}
|
package/src/scale/helper.js
CHANGED
|
@@ -79,42 +79,4 @@ export function fixExtent(niceTickExtent, extent) {
|
|
|
79
79
|
if (niceTickExtent[0] > niceTickExtent[1]) {
|
|
80
80
|
niceTickExtent[0] = niceTickExtent[1];
|
|
81
81
|
}
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
export function intervalScaleGetTicks(interval, extent, niceTickExtent, intervalPrecision) {
|
|
85
|
-
var ticks = [];
|
|
86
|
-
|
|
87
|
-
// If interval is 0, return [];
|
|
88
|
-
if (!interval) {
|
|
89
|
-
return ticks;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
// Consider this case: using dataZoom toolbox, zoom and zoom.
|
|
93
|
-
var safeLimit = 10000;
|
|
94
|
-
|
|
95
|
-
if (extent[0] < niceTickExtent[0]) {
|
|
96
|
-
ticks.push(extent[0]);
|
|
97
|
-
}
|
|
98
|
-
var tick = niceTickExtent[0];
|
|
99
|
-
|
|
100
|
-
while (tick <= niceTickExtent[1]) {
|
|
101
|
-
ticks.push(tick);
|
|
102
|
-
// Avoid rounding error
|
|
103
|
-
tick = roundNumber(tick + interval, intervalPrecision);
|
|
104
|
-
if (tick === ticks[ticks.length - 1]) {
|
|
105
|
-
// Consider out of safe float point, e.g.,
|
|
106
|
-
// -3711126.9907707 + 2e-10 === -3711126.9907707
|
|
107
|
-
break;
|
|
108
|
-
}
|
|
109
|
-
if (ticks.length > safeLimit) {
|
|
110
|
-
return [];
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
// Consider this case: the last item of ticks is smaller
|
|
114
|
-
// than niceTickExtent[1] and niceTickExtent[1] === extent[1].
|
|
115
|
-
if (extent[1] > (ticks.length ? ticks[ticks.length - 1] : niceTickExtent[1])) {
|
|
116
|
-
ticks.push(extent[1]);
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
return ticks;
|
|
120
|
-
}
|
|
82
|
+
}
|
package/src/theme/dark.js
CHANGED
package/src/util/graphic.js
CHANGED
|
@@ -1071,8 +1071,7 @@ function rollbackDefaultTextStyle(style) {
|
|
|
1071
1071
|
}
|
|
1072
1072
|
|
|
1073
1073
|
export function getFont(opt, ecModel) {
|
|
1074
|
-
|
|
1075
|
-
var gTextStyleModel = ecModel || ecModel.getModel('textStyle');
|
|
1074
|
+
var gTextStyleModel = ecModel && ecModel.getModel('textStyle');
|
|
1076
1075
|
return zrUtil.trim([
|
|
1077
1076
|
// FIXME in node-canvas fontWeight is before fontStyle
|
|
1078
1077
|
opt.fontStyle || gTextStyleModel && gTextStyleModel.getShallow('fontStyle') || '',
|
package/src/util/number.js
CHANGED
|
@@ -386,8 +386,28 @@ export function quantity(val) {
|
|
|
386
386
|
return Math.pow(10, quantityExponent(val));
|
|
387
387
|
}
|
|
388
388
|
|
|
389
|
-
|
|
390
|
-
|
|
389
|
+
/**
|
|
390
|
+
* Exponent of the quantity of a number
|
|
391
|
+
* e.g., 1234 equals to 1.234*10^3, so quantityExponent(1234) is 3
|
|
392
|
+
*
|
|
393
|
+
* @param {number} val non-negative value
|
|
394
|
+
* @return {number}
|
|
395
|
+
*/
|
|
396
|
+
export function quantityExponent(val) {
|
|
397
|
+
if (val === 0) {
|
|
398
|
+
return 0;
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
var exp = Math.floor(Math.log(val) / Math.LN10);
|
|
402
|
+
/**
|
|
403
|
+
* exp is expected to be the rounded-down result of the base-10 log of val.
|
|
404
|
+
* But due to the precision loss with Math.log(val), we need to restore it
|
|
405
|
+
* using 10^exp to make sure we can get val back from exp. #11249
|
|
406
|
+
*/
|
|
407
|
+
if (val / Math.pow(10, exp) >= 10) {
|
|
408
|
+
exp++;
|
|
409
|
+
}
|
|
410
|
+
return exp;
|
|
391
411
|
}
|
|
392
412
|
|
|
393
413
|
/**
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Licensed to the Apache Software Foundation (ASF) under one
|
|
3
|
+
* or more contributor license agreements. See the NOTICE file
|
|
4
|
+
* distributed with this work for additional information
|
|
5
|
+
* regarding copyright ownership. The ASF licenses this file
|
|
6
|
+
* to you under the Apache License, Version 2.0 (the
|
|
7
|
+
* "License"); you may not use this file except in compliance
|
|
8
|
+
* with the License. You may obtain a copy of the License at
|
|
9
|
+
*
|
|
10
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
*
|
|
12
|
+
* Unless required by applicable law or agreed to in writing,
|
|
13
|
+
* software distributed under the License is distributed on an
|
|
14
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
15
|
+
* KIND, either express or implied. See the License for the
|
|
16
|
+
* specific language governing permissions and limitations
|
|
17
|
+
* under the License.
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
import {extendShape} from '../graphic';
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Sausage: similar to sector, but have half circle on both sides
|
|
24
|
+
* @public
|
|
25
|
+
*/
|
|
26
|
+
export default extendShape({
|
|
27
|
+
|
|
28
|
+
type: 'sausage',
|
|
29
|
+
|
|
30
|
+
shape: {
|
|
31
|
+
|
|
32
|
+
cx: 0,
|
|
33
|
+
|
|
34
|
+
cy: 0,
|
|
35
|
+
|
|
36
|
+
r0: 0,
|
|
37
|
+
|
|
38
|
+
r: 0,
|
|
39
|
+
|
|
40
|
+
startAngle: 0,
|
|
41
|
+
|
|
42
|
+
endAngle: Math.PI * 2,
|
|
43
|
+
|
|
44
|
+
clockwise: true
|
|
45
|
+
},
|
|
46
|
+
|
|
47
|
+
buildPath: function (ctx, shape) {
|
|
48
|
+
var x = shape.cx;
|
|
49
|
+
var y = shape.cy;
|
|
50
|
+
var r0 = Math.max(shape.r0 || 0, 0);
|
|
51
|
+
var r = Math.max(shape.r, 0);
|
|
52
|
+
var dr = (r - r0) * 0.5;
|
|
53
|
+
var rCenter = r0 + dr;
|
|
54
|
+
var startAngle = shape.startAngle;
|
|
55
|
+
var endAngle = shape.endAngle;
|
|
56
|
+
var clockwise = shape.clockwise;
|
|
57
|
+
|
|
58
|
+
var unitStartX = Math.cos(startAngle);
|
|
59
|
+
var unitStartY = Math.sin(startAngle);
|
|
60
|
+
var unitEndX = Math.cos(endAngle);
|
|
61
|
+
var unitEndY = Math.sin(endAngle);
|
|
62
|
+
|
|
63
|
+
var lessThanCircle = clockwise
|
|
64
|
+
? endAngle - startAngle < Math.PI * 2
|
|
65
|
+
: startAngle - endAngle < Math.PI * 2;
|
|
66
|
+
|
|
67
|
+
if (lessThanCircle) {
|
|
68
|
+
ctx.moveTo(unitStartX * r0 + x, unitStartY * r0 + y);
|
|
69
|
+
|
|
70
|
+
ctx.arc(
|
|
71
|
+
unitStartX * rCenter + x, unitStartY * rCenter + y, dr,
|
|
72
|
+
-Math.PI + startAngle, startAngle, !clockwise
|
|
73
|
+
);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
ctx.arc(x, y, r, startAngle, endAngle, !clockwise);
|
|
77
|
+
|
|
78
|
+
ctx.moveTo(unitEndX * r + x, unitEndY * r + y);
|
|
79
|
+
|
|
80
|
+
ctx.arc(
|
|
81
|
+
unitEndX * rCenter + x, unitEndY * rCenter + y, dr,
|
|
82
|
+
endAngle - Math.PI * 2, endAngle - Math.PI, !clockwise
|
|
83
|
+
);
|
|
84
|
+
|
|
85
|
+
if (r0 !== 0) {
|
|
86
|
+
ctx.arc(x, y, r0, endAngle, startAngle, clockwise);
|
|
87
|
+
|
|
88
|
+
ctx.moveTo(unitStartX * r0 + x, unitEndY * r0 + y);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
ctx.closePath();
|
|
92
|
+
}
|
|
93
|
+
});
|