echarts 3.5.4 → 3.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/LICENSE +21 -18
- package/dist/echarts.common.js +10072 -9330
- package/dist/echarts.common.min.js +13 -13
- package/dist/echarts.js +13084 -11412
- package/dist/echarts.min.js +22 -21
- package/dist/echarts.simple.js +9454 -8889
- package/dist/echarts.simple.min.js +9 -10
- package/index.js +1 -0
- package/lib/chart/bar/BarView.js +141 -49
- package/lib/chart/bar/BaseBarSeries.js +2 -6
- package/lib/chart/bar.js +1 -0
- package/lib/chart/boxplot/BoxplotSeries.js +1 -1
- package/lib/chart/boxplot/boxplotLayout.js +23 -7
- package/lib/chart/candlestick/CandlestickSeries.js +1 -21
- package/lib/chart/candlestick/candlestickLayout.js +23 -7
- package/lib/chart/custom.js +442 -0
- package/lib/chart/graph/categoryVisual.js +3 -2
- package/lib/chart/heatmap/HeatmapView.js +75 -73
- package/lib/chart/helper/Symbol.js +8 -31
- package/lib/chart/helper/createListFromArray.js +15 -10
- package/lib/chart/helper/labelHelper.js +48 -0
- package/lib/chart/helper/whiskerBoxCommon.js +25 -44
- package/lib/chart/map/mapDataStatistic.js +9 -8
- package/lib/chart/pie/pieLayout.js +25 -17
- package/lib/chart/radar/RadarSeries.js +1 -1
- package/lib/chart/scatter/ScatterSeries.js +2 -3
- package/lib/chart/themeRiver/ThemeRiverSeries.js +6 -5
- package/lib/chart/themeRiver/themeRiverVisual.js +1 -1
- package/lib/chart/treemap/TreemapSeries.js +3 -3
- package/lib/component/axisPointer/BaseAxisPointer.js +7 -6
- package/lib/component/axisPointer/axisTrigger.js +62 -51
- package/lib/component/axisPointer.js +1 -2
- package/lib/component/calendar/CalendarView.js +5 -5
- package/lib/component/dataZoom/AxisProxy.js +76 -13
- package/lib/component/dataZoom/DataZoomModel.js +21 -5
- package/lib/component/dataZoom/InsideZoomModel.js +4 -1
- package/lib/component/dataZoom/InsideZoomView.js +16 -26
- package/lib/component/dataZoom/SliderZoomView.js +63 -26
- package/lib/component/dataZoom/roams.js +8 -3
- package/lib/component/graphic.js +13 -12
- package/lib/component/helper/BrushTargetManager.js +5 -5
- package/lib/component/helper/MapDraw.js +3 -3
- package/lib/component/helper/RoamController.js +43 -20
- package/lib/component/helper/brushHelper.js +2 -13
- package/lib/component/helper/selectableMixin.js +7 -7
- package/lib/component/helper/sliderMove.js +65 -36
- package/lib/component/legend/LegendView.js +6 -6
- package/lib/component/legend/legendAction.js +1 -1
- package/lib/component/marker/MarkAreaView.js +3 -6
- package/lib/component/marker/MarkLineView.js +3 -5
- package/lib/component/marker/MarkPointView.js +3 -5
- package/lib/component/marker/MarkerView.js +10 -12
- package/lib/component/polar.js +5 -0
- package/lib/component/timeline/SliderTimelineView.js +1 -1
- package/lib/component/toolbox/feature/DataZoom.js +14 -1
- package/lib/component/tooltip/TooltipView.js +3 -3
- package/lib/component/visualMap/ContinuousView.js +6 -4
- package/lib/coord/Axis.js +34 -2
- package/lib/coord/axisDefault.js +2 -1
- package/lib/coord/axisHelper.js +6 -25
- package/lib/coord/axisModelCommonMixin.js +1 -1
- package/lib/coord/calendar/Calendar.js +14 -17
- package/lib/coord/calendar/prepareCustom.js +31 -0
- package/lib/coord/cartesian/Axis2D.js +0 -12
- package/lib/coord/cartesian/Cartesian2D.js +1 -0
- package/lib/coord/cartesian/Grid.js +5 -2
- package/lib/coord/cartesian/prepareCustom.js +36 -0
- package/lib/coord/geo/Geo.js +9 -14
- package/lib/coord/geo/GeoModel.js +5 -5
- package/lib/coord/geo/geoCreator.js +3 -3
- package/lib/coord/geo/prepareCustom.js +36 -0
- package/lib/coord/parallel/Parallel.js +12 -11
- package/lib/coord/polar/Polar.js +2 -1
- package/lib/coord/polar/prepareCustom.js +53 -0
- package/lib/coord/single/Single.js +9 -8
- package/lib/coord/single/SingleAxis.js +0 -27
- package/lib/coord/single/prepareCustom.js +33 -0
- package/lib/data/DataDiffer.js +2 -1
- package/lib/data/Graph.js +11 -7
- package/lib/data/List.js +58 -19
- package/lib/data/helper/completeDimensions.js +184 -23
- package/lib/echarts.js +38 -33
- package/lib/helper.js +1 -8
- package/lib/layout/barGrid.js +87 -18
- package/lib/layout/barPolar.js +286 -0
- package/lib/layout/points.js +22 -16
- package/lib/model/Global.js +34 -31
- package/lib/model/Series.js +41 -29
- package/lib/model/mixin/colorPalette.js +2 -1
- package/lib/model/mixin/textStyle.js +7 -13
- package/lib/scale/Interval.js +21 -14
- package/lib/scale/Log.js +5 -7
- package/lib/scale/Time.js +13 -7
- package/lib/scale/helper.js +5 -1
- package/lib/util/format.js +12 -0
- package/lib/util/graphic.js +53 -1
- package/lib/util/model.js +63 -7
- package/map/js/world.js +1 -1
- package/map/json/world.json +1 -1
- package/package.json +3 -3
- package/src/chart/bar/BarView.js +141 -49
- package/src/chart/bar/BaseBarSeries.js +2 -6
- package/src/chart/bar.js +1 -0
- package/src/chart/boxplot/BoxplotSeries.js +1 -1
- package/src/chart/boxplot/boxplotLayout.js +23 -7
- package/src/chart/candlestick/CandlestickSeries.js +1 -21
- package/src/chart/candlestick/candlestickLayout.js +23 -7
- package/src/chart/custom.js +442 -0
- package/src/chart/graph/categoryVisual.js +3 -2
- package/src/chart/heatmap/HeatmapView.js +75 -73
- package/src/chart/helper/Symbol.js +8 -31
- package/src/chart/helper/createListFromArray.js +15 -10
- package/src/chart/helper/labelHelper.js +49 -0
- package/src/chart/helper/whiskerBoxCommon.js +25 -44
- package/src/chart/map/mapDataStatistic.js +9 -8
- package/src/chart/pie/pieLayout.js +25 -17
- package/src/chart/radar/RadarSeries.js +1 -1
- package/src/chart/scatter/ScatterSeries.js +2 -3
- package/src/chart/themeRiver/ThemeRiverSeries.js +6 -5
- package/src/chart/themeRiver/themeRiverVisual.js +1 -1
- package/src/chart/treemap/TreemapSeries.js +3 -3
- package/src/component/axisPointer/BaseAxisPointer.js +7 -6
- package/src/component/axisPointer/axisTrigger.js +62 -51
- package/src/component/axisPointer.js +1 -2
- package/src/component/calendar/CalendarView.js +5 -5
- package/src/component/dataZoom/AxisProxy.js +76 -13
- package/src/component/dataZoom/DataZoomModel.js +21 -5
- package/src/component/dataZoom/InsideZoomModel.js +4 -1
- package/src/component/dataZoom/InsideZoomView.js +16 -26
- package/src/component/dataZoom/SliderZoomView.js +63 -26
- package/src/component/dataZoom/roams.js +8 -3
- package/src/component/graphic.js +13 -12
- package/src/component/helper/BrushTargetManager.js +5 -5
- package/src/component/helper/MapDraw.js +3 -3
- package/src/component/helper/RoamController.js +43 -20
- package/src/component/helper/brushHelper.js +2 -13
- package/src/component/helper/selectableMixin.js +7 -7
- package/src/component/helper/sliderMove.js +65 -36
- package/src/component/legend/LegendView.js +6 -6
- package/src/component/legend/legendAction.js +1 -1
- package/src/component/marker/MarkAreaView.js +3 -6
- package/src/component/marker/MarkLineView.js +3 -5
- package/src/component/marker/MarkPointView.js +3 -5
- package/src/component/marker/MarkerView.js +10 -12
- package/src/component/polar.js +5 -0
- package/src/component/timeline/SliderTimelineView.js +1 -1
- package/src/component/toolbox/feature/DataZoom.js +14 -1
- package/src/component/tooltip/TooltipView.js +3 -3
- package/src/component/visualMap/ContinuousView.js +6 -4
- package/src/coord/Axis.js +34 -2
- package/src/coord/axisDefault.js +2 -1
- package/src/coord/axisHelper.js +6 -25
- package/src/coord/axisModelCommonMixin.js +1 -1
- package/src/coord/calendar/Calendar.js +14 -17
- package/src/coord/calendar/prepareCustom.js +32 -0
- package/src/coord/cartesian/Axis2D.js +0 -12
- package/src/coord/cartesian/Cartesian2D.js +1 -0
- package/src/coord/cartesian/Grid.js +5 -2
- package/src/coord/cartesian/prepareCustom.js +37 -0
- package/src/coord/geo/Geo.js +9 -14
- package/src/coord/geo/GeoModel.js +5 -5
- package/src/coord/geo/geoCreator.js +3 -3
- package/src/coord/geo/prepareCustom.js +37 -0
- package/src/coord/parallel/Parallel.js +12 -11
- package/src/coord/polar/Polar.js +2 -1
- package/src/coord/polar/prepareCustom.js +54 -0
- package/src/coord/single/Single.js +9 -8
- package/src/coord/single/SingleAxis.js +0 -27
- package/src/coord/single/prepareCustom.js +34 -0
- package/src/data/DataDiffer.js +2 -1
- package/src/data/Graph.js +11 -7
- package/src/data/List.js +58 -19
- package/src/data/helper/completeDimensions.js +184 -23
- package/src/echarts.js +38 -33
- package/src/helper.js +1 -8
- package/src/layout/barGrid.js +87 -18
- package/src/layout/barPolar.js +287 -0
- package/src/layout/points.js +22 -16
- package/src/model/Global.js +34 -31
- package/src/model/Series.js +41 -29
- package/src/model/mixin/colorPalette.js +2 -1
- package/src/model/mixin/textStyle.js +7 -13
- package/src/scale/Interval.js +21 -14
- package/src/scale/Log.js +5 -7
- package/src/scale/Time.js +13 -7
- package/src/scale/helper.js +5 -1
- package/src/util/format.js +12 -0
- package/src/util/graphic.js +53 -1
- package/src/util/model.js +63 -7
- package/src/coord/cartesian/axisLabelInterval.js +0 -26
package/lib/model/Global.js
CHANGED
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
this._optionManager = optionManager;
|
|
64
64
|
},
|
|
65
65
|
|
|
66
|
-
setOption: function (option, optionPreprocessorFuncs
|
|
66
|
+
setOption: function (option, optionPreprocessorFuncs) {
|
|
67
67
|
zrUtil.assert(
|
|
68
68
|
!(OPTION_INNER_KEY in option),
|
|
69
69
|
'please use chart.getOption()'
|
|
@@ -71,7 +71,7 @@
|
|
|
71
71
|
|
|
72
72
|
this._optionManager.setOption(option, optionPreprocessorFuncs);
|
|
73
73
|
|
|
74
|
-
this.resetOption(null
|
|
74
|
+
this.resetOption(null);
|
|
75
75
|
},
|
|
76
76
|
|
|
77
77
|
/**
|
|
@@ -81,7 +81,7 @@
|
|
|
81
81
|
* 'media': only reset media query option
|
|
82
82
|
* @return {boolean} Whether option changed.
|
|
83
83
|
*/
|
|
84
|
-
resetOption: function (type
|
|
84
|
+
resetOption: function (type) {
|
|
85
85
|
var optionChanged = false;
|
|
86
86
|
var optionManager = this._optionManager;
|
|
87
87
|
|
|
@@ -92,11 +92,7 @@
|
|
|
92
92
|
initBase.call(this, baseOption);
|
|
93
93
|
}
|
|
94
94
|
else {
|
|
95
|
-
|
|
96
|
-
// go through update process, data should not be restored.
|
|
97
|
-
// Otherwise grphic els mounted on data will be eliminated
|
|
98
|
-
// and downplay will not work.
|
|
99
|
-
!onlyGraphic && this.restoreData();
|
|
95
|
+
this.restoreData();
|
|
100
96
|
this.mergeOption(baseOption);
|
|
101
97
|
}
|
|
102
98
|
optionChanged = true;
|
|
@@ -158,7 +154,7 @@
|
|
|
158
154
|
var newCptOptionList = modelUtil.normalizeToArray(newOption[mainType]);
|
|
159
155
|
|
|
160
156
|
var mapResult = modelUtil.mappingToExists(
|
|
161
|
-
componentsMap
|
|
157
|
+
componentsMap.get(mainType), newCptOptionList
|
|
162
158
|
);
|
|
163
159
|
|
|
164
160
|
modelUtil.makeIdAndName(mapResult);
|
|
@@ -177,7 +173,7 @@
|
|
|
177
173
|
);
|
|
178
174
|
|
|
179
175
|
option[mainType] = [];
|
|
180
|
-
componentsMap
|
|
176
|
+
componentsMap.set(mainType, []);
|
|
181
177
|
|
|
182
178
|
each(mapResult, function (resultItem, index) {
|
|
183
179
|
var componentModel = resultItem.exist;
|
|
@@ -227,13 +223,13 @@
|
|
|
227
223
|
}
|
|
228
224
|
}
|
|
229
225
|
|
|
230
|
-
componentsMap
|
|
226
|
+
componentsMap.get(mainType)[index] = componentModel;
|
|
231
227
|
option[mainType][index] = componentModel.option;
|
|
232
228
|
}, this);
|
|
233
229
|
|
|
234
230
|
// Backup series for filtering.
|
|
235
231
|
if (mainType === 'series') {
|
|
236
|
-
this._seriesIndices = createSeriesIndices(componentsMap.series);
|
|
232
|
+
this._seriesIndices = createSeriesIndices(componentsMap.get('series'));
|
|
237
233
|
}
|
|
238
234
|
}
|
|
239
235
|
},
|
|
@@ -277,7 +273,7 @@
|
|
|
277
273
|
* @return {module:echarts/model/Component}
|
|
278
274
|
*/
|
|
279
275
|
getComponent: function (mainType, idx) {
|
|
280
|
-
var list = this._componentsMap
|
|
276
|
+
var list = this._componentsMap.get(mainType);
|
|
281
277
|
if (list) {
|
|
282
278
|
return list[idx || 0];
|
|
283
279
|
}
|
|
@@ -303,7 +299,7 @@
|
|
|
303
299
|
var id = condition.id;
|
|
304
300
|
var name = condition.name;
|
|
305
301
|
|
|
306
|
-
var cpts = this._componentsMap
|
|
302
|
+
var cpts = this._componentsMap.get(mainType);
|
|
307
303
|
|
|
308
304
|
if (!cpts || !cpts.length) {
|
|
309
305
|
return [];
|
|
@@ -378,7 +374,7 @@
|
|
|
378
374
|
var queryCond = getQueryCond(query);
|
|
379
375
|
var result = queryCond
|
|
380
376
|
? this.queryComponents(queryCond)
|
|
381
|
-
: this._componentsMap
|
|
377
|
+
: this._componentsMap.get(mainType);
|
|
382
378
|
|
|
383
379
|
return doFilter(filterBySubType(result, condition));
|
|
384
380
|
|
|
@@ -437,14 +433,14 @@
|
|
|
437
433
|
if (typeof mainType === 'function') {
|
|
438
434
|
context = cb;
|
|
439
435
|
cb = mainType;
|
|
440
|
-
each(
|
|
436
|
+
componentsMap.each(function (components, componentType) {
|
|
441
437
|
each(components, function (component, index) {
|
|
442
438
|
cb.call(context, componentType, component, index);
|
|
443
439
|
});
|
|
444
440
|
});
|
|
445
441
|
}
|
|
446
442
|
else if (zrUtil.isString(mainType)) {
|
|
447
|
-
each(componentsMap
|
|
443
|
+
each(componentsMap.get(mainType), cb, context);
|
|
448
444
|
}
|
|
449
445
|
else if (isObject(mainType)) {
|
|
450
446
|
var queryResult = this.findComponents(mainType);
|
|
@@ -457,7 +453,7 @@
|
|
|
457
453
|
* @return {Array.<module:echarts/model/Series>}
|
|
458
454
|
*/
|
|
459
455
|
getSeriesByName: function (name) {
|
|
460
|
-
var series = this._componentsMap.series;
|
|
456
|
+
var series = this._componentsMap.get('series');
|
|
461
457
|
return filter(series, function (oneSeries) {
|
|
462
458
|
return oneSeries.name === name;
|
|
463
459
|
});
|
|
@@ -468,7 +464,7 @@
|
|
|
468
464
|
* @return {module:echarts/model/Series}
|
|
469
465
|
*/
|
|
470
466
|
getSeriesByIndex: function (seriesIndex) {
|
|
471
|
-
return this._componentsMap.series[seriesIndex];
|
|
467
|
+
return this._componentsMap.get('series')[seriesIndex];
|
|
472
468
|
},
|
|
473
469
|
|
|
474
470
|
/**
|
|
@@ -476,7 +472,7 @@
|
|
|
476
472
|
* @return {Array.<module:echarts/model/Series>}
|
|
477
473
|
*/
|
|
478
474
|
getSeriesByType: function (subType) {
|
|
479
|
-
var series = this._componentsMap.series;
|
|
475
|
+
var series = this._componentsMap.get('series');
|
|
480
476
|
return filter(series, function (oneSeries) {
|
|
481
477
|
return oneSeries.subType === subType;
|
|
482
478
|
});
|
|
@@ -486,7 +482,7 @@
|
|
|
486
482
|
* @return {Array.<module:echarts/model/Series>}
|
|
487
483
|
*/
|
|
488
484
|
getSeries: function () {
|
|
489
|
-
return this._componentsMap.series.slice();
|
|
485
|
+
return this._componentsMap.get('series').slice();
|
|
490
486
|
},
|
|
491
487
|
|
|
492
488
|
/**
|
|
@@ -499,7 +495,7 @@
|
|
|
499
495
|
eachSeries: function (cb, context) {
|
|
500
496
|
assertSeriesInitialized(this);
|
|
501
497
|
each(this._seriesIndices, function (rawSeriesIndex) {
|
|
502
|
-
var series = this._componentsMap.series[rawSeriesIndex];
|
|
498
|
+
var series = this._componentsMap.get('series')[rawSeriesIndex];
|
|
503
499
|
cb.call(context, series, rawSeriesIndex);
|
|
504
500
|
}, this);
|
|
505
501
|
},
|
|
@@ -511,7 +507,7 @@
|
|
|
511
507
|
* @param {*} context
|
|
512
508
|
*/
|
|
513
509
|
eachRawSeries: function (cb, context) {
|
|
514
|
-
each(this._componentsMap.series, cb, context);
|
|
510
|
+
each(this._componentsMap.get('series'), cb, context);
|
|
515
511
|
},
|
|
516
512
|
|
|
517
513
|
/**
|
|
@@ -525,7 +521,7 @@
|
|
|
525
521
|
eachSeriesByType: function (subType, cb, context) {
|
|
526
522
|
assertSeriesInitialized(this);
|
|
527
523
|
each(this._seriesIndices, function (rawSeriesIndex) {
|
|
528
|
-
var series = this._componentsMap.series[rawSeriesIndex];
|
|
524
|
+
var series = this._componentsMap.get('series')[rawSeriesIndex];
|
|
529
525
|
if (series.subType === subType) {
|
|
530
526
|
cb.call(context, series, rawSeriesIndex);
|
|
531
527
|
}
|
|
@@ -551,6 +547,13 @@
|
|
|
551
547
|
return zrUtil.indexOf(this._seriesIndices, seriesModel.componentIndex) < 0;
|
|
552
548
|
},
|
|
553
549
|
|
|
550
|
+
/**
|
|
551
|
+
* @return {Array.<number>}
|
|
552
|
+
*/
|
|
553
|
+
getCurrentSeriesIndices: function () {
|
|
554
|
+
return (this._seriesIndices || []).slice();
|
|
555
|
+
},
|
|
556
|
+
|
|
554
557
|
/**
|
|
555
558
|
* @param {Function} cb
|
|
556
559
|
* @param {*} context
|
|
@@ -558,7 +561,7 @@
|
|
|
558
561
|
filterSeries: function (cb, context) {
|
|
559
562
|
assertSeriesInitialized(this);
|
|
560
563
|
var filteredSeries = filter(
|
|
561
|
-
this._componentsMap.series, cb, context
|
|
564
|
+
this._componentsMap.get('series'), cb, context
|
|
562
565
|
);
|
|
563
566
|
this._seriesIndices = createSeriesIndices(filteredSeries);
|
|
564
567
|
},
|
|
@@ -566,10 +569,10 @@
|
|
|
566
569
|
restoreData: function () {
|
|
567
570
|
var componentsMap = this._componentsMap;
|
|
568
571
|
|
|
569
|
-
this._seriesIndices = createSeriesIndices(componentsMap.series);
|
|
572
|
+
this._seriesIndices = createSeriesIndices(componentsMap.get('series'));
|
|
570
573
|
|
|
571
574
|
var componentTypes = [];
|
|
572
|
-
each(
|
|
575
|
+
componentsMap.each(function (components, componentType) {
|
|
573
576
|
componentTypes.push(componentType);
|
|
574
577
|
});
|
|
575
578
|
|
|
@@ -577,7 +580,7 @@
|
|
|
577
580
|
componentTypes,
|
|
578
581
|
ComponentModel.getAllClassMainTypes(),
|
|
579
582
|
function (componentType, dependencies) {
|
|
580
|
-
each(componentsMap
|
|
583
|
+
each(componentsMap.get(componentType), function (component) {
|
|
581
584
|
component.restoreData();
|
|
582
585
|
});
|
|
583
586
|
}
|
|
@@ -621,7 +624,7 @@
|
|
|
621
624
|
* @type {Object.<string, Array.<module:echarts/model/Model>>}
|
|
622
625
|
* @private
|
|
623
626
|
*/
|
|
624
|
-
this._componentsMap = {series: []};
|
|
627
|
+
this._componentsMap = zrUtil.createHashMap({series: []});
|
|
625
628
|
|
|
626
629
|
/**
|
|
627
630
|
* Mapping between filtered series list and raw series list.
|
|
@@ -651,7 +654,7 @@
|
|
|
651
654
|
|
|
652
655
|
var ret = {};
|
|
653
656
|
each(types, function (type) {
|
|
654
|
-
ret[type] = (componentsMap
|
|
657
|
+
ret[type] = (componentsMap.get(type) || []).slice();
|
|
655
658
|
});
|
|
656
659
|
|
|
657
660
|
return ret;
|
|
@@ -702,7 +705,7 @@
|
|
|
702
705
|
// which make sure that their initialization is after series.
|
|
703
706
|
if (__DEV__) {
|
|
704
707
|
if (!ecModel._seriesIndices) {
|
|
705
|
-
throw new Error('
|
|
708
|
+
throw new Error('Option should contains series.');
|
|
706
709
|
}
|
|
707
710
|
}
|
|
708
711
|
}
|
package/lib/model/Series.js
CHANGED
|
@@ -181,7 +181,7 @@
|
|
|
181
181
|
* @return {Array.<string>} dimensions on the axis.
|
|
182
182
|
*/
|
|
183
183
|
coordDimToDataDim: function (coordDim) {
|
|
184
|
-
return
|
|
184
|
+
return modelUtil.coordDimToDataDim(this.getData(), coordDim);
|
|
185
185
|
},
|
|
186
186
|
|
|
187
187
|
/**
|
|
@@ -191,7 +191,7 @@
|
|
|
191
191
|
* @return {string}
|
|
192
192
|
*/
|
|
193
193
|
dataDimToCoordDim: function (dataDim) {
|
|
194
|
-
return dataDim;
|
|
194
|
+
return modelUtil.dataDimToCoordDim(this.getData(), dataDim);
|
|
195
195
|
},
|
|
196
196
|
|
|
197
197
|
/**
|
|
@@ -215,35 +215,46 @@
|
|
|
215
215
|
*/
|
|
216
216
|
formatTooltip: function (dataIndex, multipleSeries, dataType) {
|
|
217
217
|
function formatArrayValue(value) {
|
|
218
|
-
var
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
var dimType = dimInfo && dimInfo.type;
|
|
223
|
-
var valStr;
|
|
218
|
+
var vertially = zrUtil.reduce(value, function (vertially, val, idx) {
|
|
219
|
+
var dimItem = data.getDimensionInfo(idx);
|
|
220
|
+
return vertially |= dimItem.tooltip !== false && dimItem.tooltipName != null;
|
|
221
|
+
}, 0);
|
|
224
222
|
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
223
|
+
var result = [];
|
|
224
|
+
var tooltipDims = modelUtil.otherDimToDataDim(data, 'tooltip');
|
|
225
|
+
|
|
226
|
+
tooltipDims.length
|
|
227
|
+
? zrUtil.each(tooltipDims, function (dimIdx) {
|
|
228
|
+
setEachItem(data.get(dimIdx, dataIndex), dimIdx);
|
|
229
|
+
})
|
|
230
|
+
// By default, all dims is used on tooltip.
|
|
231
|
+
: zrUtil.each(value, setEachItem);
|
|
232
|
+
|
|
233
|
+
function setEachItem(val, dimIdx) {
|
|
234
|
+
var dimInfo = data.getDimensionInfo(dimIdx);
|
|
235
|
+
// If `dimInfo.tooltip` is not set, show tooltip.
|
|
236
|
+
if (!dimInfo || dimInfo.otherDims.tooltip === false) {
|
|
237
|
+
return;
|
|
233
238
|
}
|
|
239
|
+
var dimType = dimInfo.type;
|
|
240
|
+
var valStr = (vertially ? '- ' + (dimInfo.tooltipName || dimInfo.name) + ': ' : '')
|
|
241
|
+
+ (dimType === 'ordinal'
|
|
242
|
+
? val + ''
|
|
243
|
+
: dimType === 'time'
|
|
244
|
+
? (multipleSeries ? '' : formatUtil.formatTime('yyyy/MM/dd hh:mm:ss', val))
|
|
245
|
+
: addCommas(val)
|
|
246
|
+
);
|
|
247
|
+
valStr && result.push(encodeHTML(valStr));
|
|
248
|
+
}
|
|
234
249
|
|
|
235
|
-
|
|
236
|
-
});
|
|
237
|
-
|
|
238
|
-
return result.join(', ');
|
|
250
|
+
return (vertially ? '<br/>' : '') + result.join(vertially ? '<br/>' : ', ');
|
|
239
251
|
}
|
|
240
252
|
|
|
241
253
|
var data = get(this, 'data');
|
|
242
254
|
|
|
243
255
|
var value = this.getRawValue(dataIndex);
|
|
244
|
-
var formattedValue =
|
|
245
|
-
|
|
246
|
-
);
|
|
256
|
+
var formattedValue = zrUtil.isArray(value)
|
|
257
|
+
? formatArrayValue(value) : encodeHTML(addCommas(value));
|
|
247
258
|
var name = data.getName(dataIndex);
|
|
248
259
|
|
|
249
260
|
var color = data.getItemVisual(dataIndex, 'color');
|
|
@@ -252,8 +263,7 @@
|
|
|
252
263
|
}
|
|
253
264
|
color = color || 'transparent';
|
|
254
265
|
|
|
255
|
-
var colorEl =
|
|
256
|
-
+ 'border-radius:10px;width:9px;height:9px;background-color:' + encodeHTML(color) + '"></span>';
|
|
266
|
+
var colorEl = formatUtil.getTooltipMarker(color);
|
|
257
267
|
|
|
258
268
|
var seriesName = this.name;
|
|
259
269
|
// FIXME
|
|
@@ -261,14 +271,16 @@
|
|
|
261
271
|
// Not show '-'
|
|
262
272
|
seriesName = '';
|
|
263
273
|
}
|
|
274
|
+
seriesName = seriesName
|
|
275
|
+
? encodeHTML(seriesName) + (!multipleSeries ? '<br/>' : ': ')
|
|
276
|
+
: '';
|
|
264
277
|
return !multipleSeries
|
|
265
|
-
?
|
|
278
|
+
? seriesName + colorEl
|
|
266
279
|
+ (name
|
|
267
|
-
? encodeHTML(name) + '
|
|
280
|
+
? encodeHTML(name) + ': ' + formattedValue
|
|
268
281
|
: formattedValue
|
|
269
282
|
)
|
|
270
|
-
|
|
271
|
-
: (colorEl + encodeHTML(this.name) + ' : ' + formattedValue);
|
|
283
|
+
: colorEl + seriesName + formattedValue;
|
|
272
284
|
},
|
|
273
285
|
|
|
274
286
|
/**
|
|
@@ -14,7 +14,8 @@
|
|
|
14
14
|
scope = scope || this;
|
|
15
15
|
var colorIdx = get(scope, 'colorIdx') || 0;
|
|
16
16
|
var colorNameMap = get(scope, 'colorNameMap') || set(scope, 'colorNameMap', {});
|
|
17
|
-
|
|
17
|
+
// Use `hasOwnProperty` to avoid conflict with Object.prototype.
|
|
18
|
+
if (colorNameMap.hasOwnProperty(name)) {
|
|
18
19
|
return colorNameMap[name];
|
|
19
20
|
}
|
|
20
21
|
var colorPalette = this.get('color', true) || [];
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
|
|
2
2
|
|
|
3
3
|
var textContain = require('zrender/lib/contain/text');
|
|
4
|
-
|
|
5
|
-
function getShallow(model, path) {
|
|
6
|
-
return model && model.getShallow(path);
|
|
7
|
-
}
|
|
4
|
+
var graphicUtil = require('../../util/graphic');
|
|
8
5
|
|
|
9
6
|
module.exports = {
|
|
10
7
|
/**
|
|
@@ -22,15 +19,12 @@
|
|
|
22
19
|
* @return {string}
|
|
23
20
|
*/
|
|
24
21
|
getFont: function () {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
this.getShallow('
|
|
30
|
-
|
|
31
|
-
(this.getShallow('fontSize') || getShallow(gTextStyleModel, 'fontSize') || 12) + 'px',
|
|
32
|
-
this.getShallow('fontFamily') || getShallow(gTextStyleModel, 'fontFamily') || 'sans-serif'
|
|
33
|
-
].join(' ');
|
|
22
|
+
return graphicUtil.getFont({
|
|
23
|
+
fontStyle: this.getShallow('fontStyle'),
|
|
24
|
+
fontWeight: this.getShallow('fontWeight'),
|
|
25
|
+
fontSize: this.getShallow('fontSize'),
|
|
26
|
+
fontFamily: this.getShallow('fontFamily')
|
|
27
|
+
}, this.ecModel);
|
|
34
28
|
},
|
|
35
29
|
|
|
36
30
|
getTextRect: function (text) {
|
package/lib/scale/Interval.js
CHANGED
|
@@ -47,8 +47,10 @@
|
|
|
47
47
|
* Get interval
|
|
48
48
|
*/
|
|
49
49
|
getInterval: function () {
|
|
50
|
-
if (
|
|
51
|
-
this.
|
|
50
|
+
if (__DEV__) {
|
|
51
|
+
if (this._interval == null) {
|
|
52
|
+
throw new Error('`nice` should be called firstly' );
|
|
53
|
+
}
|
|
52
54
|
}
|
|
53
55
|
return this._interval;
|
|
54
56
|
},
|
|
@@ -67,8 +69,10 @@
|
|
|
67
69
|
* @return {Array.<number>}
|
|
68
70
|
*/
|
|
69
71
|
getTicks: function () {
|
|
70
|
-
if (
|
|
71
|
-
this.
|
|
72
|
+
if (__DEV__) {
|
|
73
|
+
if (this._interval == null) {
|
|
74
|
+
throw new Error('`nice` should be called firstly' );
|
|
75
|
+
}
|
|
72
76
|
}
|
|
73
77
|
return helper.intervalScaleGetTicks(
|
|
74
78
|
this._interval, this._extent, this._niceExtent, this._intervalPrecision
|
|
@@ -120,8 +124,9 @@
|
|
|
120
124
|
* Update interval and extent of intervals for nice ticks
|
|
121
125
|
*
|
|
122
126
|
* @param {number} [splitNumber = 5] Desired number of ticks
|
|
127
|
+
* @param {number} [minInterval]
|
|
123
128
|
*/
|
|
124
|
-
niceTicks: function (splitNumber) {
|
|
129
|
+
niceTicks: function (splitNumber, minInterval) {
|
|
125
130
|
splitNumber = splitNumber || 5;
|
|
126
131
|
var extent = this._extent;
|
|
127
132
|
var span = extent[1] - extent[0];
|
|
@@ -135,7 +140,7 @@
|
|
|
135
140
|
extent.reverse();
|
|
136
141
|
}
|
|
137
142
|
|
|
138
|
-
var result = helper.intervalScaleNiceTicks(extent, splitNumber);
|
|
143
|
+
var result = helper.intervalScaleNiceTicks(extent, splitNumber, minInterval);
|
|
139
144
|
|
|
140
145
|
this._intervalPrecision = result.intervalPrecision;
|
|
141
146
|
this._interval = result.interval;
|
|
@@ -144,11 +149,13 @@
|
|
|
144
149
|
|
|
145
150
|
/**
|
|
146
151
|
* Nice extent.
|
|
147
|
-
* @param {
|
|
148
|
-
* @param {
|
|
149
|
-
* @param {boolean} [
|
|
152
|
+
* @param {Object} opt
|
|
153
|
+
* @param {number} [opt.splitNumber = 5] Given approx tick number
|
|
154
|
+
* @param {boolean} [opt.fixMin=false]
|
|
155
|
+
* @param {boolean} [opt.fixMax=false]
|
|
156
|
+
* @param {boolean} [opt.minInterval=false]
|
|
150
157
|
*/
|
|
151
|
-
niceExtent: function (
|
|
158
|
+
niceExtent: function (opt) {
|
|
152
159
|
var extent = this._extent;
|
|
153
160
|
// If extent start and end are same, expand them
|
|
154
161
|
if (extent[0] === extent[1]) {
|
|
@@ -160,7 +167,7 @@
|
|
|
160
167
|
// Plus data are all 100 and axis extent are [100, 100].
|
|
161
168
|
// Extend to the both side will cause expanded max is larger than fixed max.
|
|
162
169
|
// So only expand to the smaller side.
|
|
163
|
-
if (!fixMax) {
|
|
170
|
+
if (!opt.fixMax) {
|
|
164
171
|
extent[1] += expandSize / 2;
|
|
165
172
|
extent[0] -= expandSize / 2;
|
|
166
173
|
}
|
|
@@ -179,15 +186,15 @@
|
|
|
179
186
|
extent[1] = 1;
|
|
180
187
|
}
|
|
181
188
|
|
|
182
|
-
this.niceTicks(splitNumber);
|
|
189
|
+
this.niceTicks(opt.splitNumber, opt.minInterval);
|
|
183
190
|
|
|
184
191
|
// var extent = this._extent;
|
|
185
192
|
var interval = this._interval;
|
|
186
193
|
|
|
187
|
-
if (!fixMin) {
|
|
194
|
+
if (!opt.fixMin) {
|
|
188
195
|
extent[0] = roundNumber(Math.floor(extent[0] / interval) * interval);
|
|
189
196
|
}
|
|
190
|
-
if (!fixMax) {
|
|
197
|
+
if (!opt.fixMax) {
|
|
191
198
|
extent[1] = roundNumber(Math.ceil(extent[1] / interval) * interval);
|
|
192
199
|
}
|
|
193
200
|
}
|
package/lib/scale/Log.js
CHANGED
|
@@ -158,16 +158,14 @@
|
|
|
158
158
|
|
|
159
159
|
/**
|
|
160
160
|
* Nice extent.
|
|
161
|
-
* @
|
|
162
|
-
* @param {boolean} [fixMin=false]
|
|
163
|
-
* @param {boolean} [fixMax=false]
|
|
161
|
+
* @override
|
|
164
162
|
*/
|
|
165
|
-
niceExtent: function (
|
|
166
|
-
intervalScaleProto.niceExtent.call(this,
|
|
163
|
+
niceExtent: function (opt) {
|
|
164
|
+
intervalScaleProto.niceExtent.call(this, opt);
|
|
167
165
|
|
|
168
166
|
var originalScale = this._originalScale;
|
|
169
|
-
originalScale.__fixMin = fixMin;
|
|
170
|
-
originalScale.__fixMax = fixMax;
|
|
167
|
+
originalScale.__fixMin = opt.fixMin;
|
|
168
|
+
originalScale.__fixMax = opt.fixMax;
|
|
171
169
|
}
|
|
172
170
|
|
|
173
171
|
});
|
package/lib/scale/Time.js
CHANGED
|
@@ -52,7 +52,9 @@
|
|
|
52
52
|
var TimeScale = IntervalScale.extend({
|
|
53
53
|
type: 'time',
|
|
54
54
|
|
|
55
|
-
|
|
55
|
+
/**
|
|
56
|
+
* @override
|
|
57
|
+
*/
|
|
56
58
|
getLabel: function (val) {
|
|
57
59
|
var stepLvl = this._stepLvl;
|
|
58
60
|
|
|
@@ -61,8 +63,10 @@
|
|
|
61
63
|
return formatUtil.formatTime(stepLvl[0], date, this.getSetting('useUTC'));
|
|
62
64
|
},
|
|
63
65
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
+
/**
|
|
67
|
+
* @override
|
|
68
|
+
*/
|
|
69
|
+
niceExtent: function (opt) {
|
|
66
70
|
var extent = this._extent;
|
|
67
71
|
// If extent start and end are same, expand them
|
|
68
72
|
if (extent[0] === extent[1]) {
|
|
@@ -77,20 +81,22 @@
|
|
|
77
81
|
extent[0] = extent[1] - ONE_DAY;
|
|
78
82
|
}
|
|
79
83
|
|
|
80
|
-
this.niceTicks(
|
|
84
|
+
this.niceTicks(opt.splitNumber);
|
|
81
85
|
|
|
82
86
|
// var extent = this._extent;
|
|
83
87
|
var interval = this._interval;
|
|
84
88
|
|
|
85
|
-
if (!fixMin) {
|
|
89
|
+
if (!opt.fixMin) {
|
|
86
90
|
extent[0] = numberUtil.round(mathFloor(extent[0] / interval) * interval);
|
|
87
91
|
}
|
|
88
|
-
if (!fixMax) {
|
|
92
|
+
if (!opt.fixMax) {
|
|
89
93
|
extent[1] = numberUtil.round(mathCeil(extent[1] / interval) * interval);
|
|
90
94
|
}
|
|
91
95
|
},
|
|
92
96
|
|
|
93
|
-
|
|
97
|
+
/**
|
|
98
|
+
* @override
|
|
99
|
+
*/
|
|
94
100
|
niceTicks: function (approxTickNum) {
|
|
95
101
|
var timezoneOffset = this.getSetting('useUTC')
|
|
96
102
|
? 0 : numberUtil.getTimezoneOffset() * 60 * 1000;
|
package/lib/scale/helper.js
CHANGED
|
@@ -13,13 +13,17 @@
|
|
|
13
13
|
* @param {Array.<number>} extent Both extent[0] and extent[1] should be valid number.
|
|
14
14
|
* Should be extent[0] < extent[1].
|
|
15
15
|
* @param {number} splitNumber splitNumber should be >= 1.
|
|
16
|
+
* @param {number} [minInterval]
|
|
16
17
|
* @return {Object} {interval, intervalPrecision, niceTickExtent}
|
|
17
18
|
*/
|
|
18
|
-
helper.intervalScaleNiceTicks = function (extent, splitNumber) {
|
|
19
|
+
helper.intervalScaleNiceTicks = function (extent, splitNumber, minInterval) {
|
|
19
20
|
var result = {};
|
|
20
21
|
var span = extent[1] - extent[0];
|
|
21
22
|
|
|
22
23
|
var interval = result.interval = numberUtil.nice(span / splitNumber, true);
|
|
24
|
+
if (minInterval != null && interval < minInterval) {
|
|
25
|
+
interval = result.interval = minInterval;
|
|
26
|
+
}
|
|
23
27
|
// Tow more digital for tick.
|
|
24
28
|
var precision = result.intervalPrecision = numberUtil.getPrecisionSafe(interval) + 2;
|
|
25
29
|
// Niced extent inside original extent
|
package/lib/util/format.js
CHANGED
|
@@ -129,6 +129,18 @@
|
|
|
129
129
|
return tpl;
|
|
130
130
|
};
|
|
131
131
|
|
|
132
|
+
/**
|
|
133
|
+
* @param {string} color
|
|
134
|
+
* @param {string} [extraCssText]
|
|
135
|
+
* @return {string}
|
|
136
|
+
*/
|
|
137
|
+
formatUtil.getTooltipMarker = function (color, extraCssText) {
|
|
138
|
+
return color
|
|
139
|
+
? '<span style="display:inline-block;margin-right:5px;'
|
|
140
|
+
+ 'border-radius:10px;width:9px;height:9px;background-color:'
|
|
141
|
+
+ formatUtil.encodeHTML(color) + ';' + (extraCssText || '') + '"></span>'
|
|
142
|
+
: '';
|
|
143
|
+
};
|
|
132
144
|
|
|
133
145
|
/**
|
|
134
146
|
* @param {string} str
|