echarts 3.6.1 → 3.7.2
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/README.md +1 -0
- package/dist/echarts-en.js +77756 -0
- package/dist/echarts-en.min.js +38 -0
- package/dist/echarts.common-en.js +50169 -0
- package/dist/echarts.common-en.min.js +30 -0
- package/dist/echarts.common.js +5799 -3093
- package/dist/echarts.common.min.js +14 -13
- package/dist/echarts.js +7628 -4679
- package/dist/echarts.min.js +22 -22
- package/dist/echarts.simple-en.js +34988 -0
- package/dist/echarts.simple-en.min.js +27 -0
- package/dist/echarts.simple.js +4472 -2493
- package/dist/echarts.simple.min.js +11 -9
- package/dist/extension/bmap.js +50 -11
- package/dist/extension/bmap.min.js +1 -1
- package/dist/extension/dataTool.js +10 -10
- package/extension/bmap/BMapCoordSys.js +40 -1
- package/index.blank.js +4 -0
- package/index.common.js +1 -1
- package/index.js +1 -1
- package/lib/action/createDataSelectAction.js +6 -2
- package/lib/chart/bar/BarView.js +6 -3
- package/lib/chart/bar/BaseBarSeries.js +4 -3
- package/lib/chart/bar/PictorialBarSeries.js +1 -1
- package/lib/chart/bar/PictorialBarView.js +29 -7
- package/lib/chart/bar/helper.js +14 -31
- package/lib/chart/candlestick/candlestickLayout.js +49 -6
- package/lib/chart/chord/chordCircularLayout.js +2 -2
- package/lib/chart/custom.js +135 -21
- package/lib/chart/funnel/FunnelSeries.js +0 -1
- package/lib/chart/funnel/FunnelView.js +15 -22
- package/lib/chart/funnel/funnelLayout.js +1 -1
- package/lib/chart/gauge/GaugeSeries.js +7 -12
- package/lib/chart/gauge/GaugeView.js +32 -53
- package/lib/chart/graph/GraphSeries.js +2 -1
- package/lib/chart/graph/GraphView.js +39 -45
- package/lib/chart/graph/forceHelper.js +5 -0
- package/lib/chart/graph/forceLayout.js +1 -1
- package/lib/chart/heatmap/HeatmapLayer.js +7 -0
- package/lib/chart/heatmap/HeatmapView.js +10 -9
- package/lib/chart/helper/EffectSymbol.js +3 -3
- package/lib/chart/helper/LargeSymbolDraw.js +6 -1
- package/lib/chart/helper/Line.js +40 -22
- package/lib/chart/helper/Symbol.js +20 -7
- package/lib/chart/helper/SymbolDraw.js +2 -1
- package/lib/chart/helper/labelHelper.js +0 -17
- package/lib/chart/helper/whiskerBoxCommon.js +11 -3
- package/lib/chart/line/LineSeries.js +1 -0
- package/lib/chart/line/LineView.js +14 -2
- package/lib/chart/line/poly.js +5 -0
- package/lib/chart/lines/LinesView.js +22 -7
- package/lib/chart/map/MapSeries.js +3 -7
- package/lib/chart/map/MapView.js +29 -18
- package/lib/chart/pie/PieSeries.js +20 -6
- package/lib/chart/pie/PieView.js +20 -23
- package/lib/chart/pie/labelLayout.js +3 -3
- package/lib/chart/radar/RadarView.js +16 -20
- package/lib/chart/sankey/SankeySeries.js +2 -4
- package/lib/chart/sankey/SankeyView.js +13 -29
- package/lib/chart/sankey/sankeyLayout.js +1 -1
- package/lib/chart/scatter/ScatterSeries.js +2 -1
- package/lib/chart/themeRiver/ThemeRiverSeries.js +2 -4
- package/lib/chart/themeRiver/ThemeRiverView.js +2 -5
- package/lib/chart/themeRiver/themeRiverLayout.js +1 -1
- package/lib/chart/treemap/Breadcrumb.js +1 -1
- package/lib/chart/treemap/TreemapSeries.js +28 -8
- package/lib/chart/treemap/TreemapView.js +88 -77
- package/lib/chart/treemap/treemapLayout.js +29 -13
- package/lib/component/axis/AngleAxisView.js +13 -19
- package/lib/component/axis/AxisBuilder.js +260 -186
- package/lib/component/axis/CartesianAxisView.js +15 -3
- package/lib/component/axis/ParallelAxisView.js +1 -1
- package/lib/component/axis/RadiusAxisView.js +1 -1
- package/lib/component/axis/SingleAxisView.js +8 -2
- package/lib/component/axis/cartesianAxisHelper.js +11 -15
- package/lib/component/axisPointer/AxisPointerModel.js +1 -3
- package/lib/component/axisPointer/BaseAxisPointer.js +15 -38
- package/lib/component/axisPointer/axisTrigger.js +36 -20
- package/lib/component/axisPointer/modelHelper.js +3 -4
- package/lib/component/axisPointer/viewHelper.js +4 -6
- package/lib/component/axisPointer.js +1 -14
- package/lib/component/calendar/CalendarView.js +22 -39
- package/lib/component/dataZoom/AxisProxy.js +3 -2
- package/lib/component/dataZoom/DataZoomModel.js +16 -4
- package/lib/component/dataZoom/InsideZoomView.js +5 -3
- package/lib/component/dataZoom/SliderZoomView.js +21 -32
- package/lib/component/dataZoom/roams.js +33 -9
- package/lib/component/dataZoom/typeDefaulter.js +1 -1
- package/lib/component/graphic.js +17 -5
- package/lib/component/helper/BrushTargetManager.js +1 -1
- package/lib/component/helper/MapDraw.js +26 -22
- package/lib/component/helper/RoamController.js +12 -11
- package/lib/component/helper/listComponent.js +27 -24
- package/lib/component/helper/selectableMixin.js +40 -15
- package/lib/component/legend/LegendModel.js +11 -3
- package/lib/component/legend/LegendView.js +151 -70
- package/lib/component/legend/ScrollableLegendModel.js +75 -0
- package/lib/component/legend/ScrollableLegendView.js +367 -0
- package/lib/component/legend/legendAction.js +1 -0
- package/lib/component/legend/scrollableLegendAction.js +24 -0
- package/lib/component/legend.js +8 -3
- package/lib/component/legendScroll.js +11 -0
- package/lib/component/marker/MarkAreaView.js +12 -26
- package/lib/component/marker/MarkLineView.js +5 -5
- package/lib/component/marker/MarkPointView.js +4 -4
- package/lib/component/marker/MarkerModel.js +1 -4
- package/lib/component/marker/markerHelper.js +1 -0
- package/lib/component/radar/RadarView.js +6 -3
- package/lib/component/timeline/SliderTimelineModel.js +4 -6
- package/lib/component/timeline/SliderTimelineView.js +14 -16
- package/lib/component/timeline/TimelineAxis.js +1 -1
- package/lib/component/timeline/TimelineModel.js +1 -3
- package/lib/component/title.js +9 -10
- package/lib/component/toolbox/ToolboxModel.js +2 -0
- package/lib/component/toolbox/ToolboxView.js +15 -27
- package/lib/component/toolbox/feature/Brush.js +3 -8
- package/lib/component/toolbox/feature/DataView.js +5 -5
- package/lib/component/toolbox/feature/DataZoom.js +3 -4
- package/lib/component/toolbox/feature/MagicType.js +3 -6
- package/lib/component/toolbox/feature/Restore.js +2 -1
- package/lib/component/toolbox/feature/SaveAsImage.js +23 -9
- package/lib/component/tooltip/TooltipContent.js +4 -4
- package/lib/component/tooltip/TooltipView.js +29 -6
- package/lib/component/visualMap/ContinuousModel.js +2 -2
- package/lib/component/visualMap/ContinuousView.js +12 -8
- package/lib/component/visualMap/PiecewiseModel.js +1 -2
- package/lib/component/visualMap/PiecewiseView.js +2 -2
- package/lib/component/visualMap/VisualMapModel.js +18 -12
- package/lib/coord/Axis.js +1 -1
- package/lib/coord/axisDefault.js +3 -3
- package/lib/coord/axisHelper.js +18 -1
- package/lib/coord/axisModelCommonMixin.js +12 -2
- package/lib/coord/calendar/Calendar.js +65 -21
- package/lib/coord/calendar/CalendarModel.js +6 -12
- package/lib/coord/cartesian/Cartesian2D.js +0 -14
- package/lib/coord/cartesian/Grid.js +47 -28
- package/lib/coord/geo/Geo.js +2 -18
- package/lib/coord/geo/GeoModel.js +6 -13
- package/lib/coord/geo/fix/diaoyuIsland.js +30 -0
- package/lib/coord/geo/geoCreator.js +6 -1
- package/lib/coord/polar/Polar.js +0 -13
- package/lib/coord/radar/Radar.js +1 -1
- package/lib/coord/radar/RadarModel.js +6 -2
- package/lib/data/DataDiffer.js +14 -7
- package/lib/data/Graph.js +3 -0
- package/lib/data/List.js +1 -1
- package/lib/data/Tree.js +2 -2
- package/lib/data/helper/completeDimensions.js +2 -11
- package/lib/echarts.js +33 -10
- package/lib/lang/cn.js +4 -0
- package/lib/lang/default.js +42 -0
- package/lib/lang/en.js +42 -0
- package/lib/lang.js +42 -0
- package/lib/langEN.js +42 -0
- package/lib/layout/barGrid.js +11 -3
- package/lib/layout/barPolar.js +9 -2
- package/lib/model/Model.js +2 -1
- package/lib/model/Series.js +14 -6
- package/lib/model/mixin/textStyle.js +11 -9
- package/lib/preprocessor/backwardCompat.js +5 -4
- package/lib/preprocessor/helper/compatStyle.js +157 -45
- package/lib/scale/Interval.js +10 -4
- package/lib/scale/Time.js +14 -6
- package/lib/scale/helper.js +15 -2
- package/lib/util/format.js +4 -24
- package/lib/util/graphic.js +412 -21
- package/lib/util/layout.js +28 -16
- package/lib/util/model.js +26 -11
- package/lib/util/number.js +106 -21
- package/lib/visual/VisualMapping.js +4 -4
- package/package.json +3 -3
- package/rollup.config.js +49 -0
- package/src/action/createDataSelectAction.js +6 -2
- package/src/chart/bar/BarView.js +6 -3
- package/src/chart/bar/BaseBarSeries.js +4 -3
- package/src/chart/bar/PictorialBarSeries.js +1 -1
- package/src/chart/bar/PictorialBarView.js +29 -7
- package/src/chart/bar/helper.js +13 -30
- package/src/chart/candlestick/candlestickLayout.js +49 -6
- package/src/chart/chord/chordCircularLayout.js +2 -2
- package/src/chart/custom.js +135 -21
- package/src/chart/funnel/FunnelSeries.js +0 -1
- package/src/chart/funnel/FunnelView.js +15 -22
- package/src/chart/funnel/funnelLayout.js +1 -1
- package/src/chart/gauge/GaugeSeries.js +7 -12
- package/src/chart/gauge/GaugeView.js +32 -53
- package/src/chart/graph/GraphSeries.js +2 -1
- package/src/chart/graph/GraphView.js +39 -45
- package/src/chart/graph/forceHelper.js +5 -0
- package/src/chart/graph/forceLayout.js +1 -1
- package/src/chart/heatmap/HeatmapLayer.js +7 -0
- package/src/chart/heatmap/HeatmapView.js +10 -9
- package/src/chart/helper/EffectSymbol.js +3 -3
- package/src/chart/helper/LargeSymbolDraw.js +6 -1
- package/src/chart/helper/Line.js +40 -22
- package/src/chart/helper/Symbol.js +20 -7
- package/src/chart/helper/SymbolDraw.js +2 -1
- package/src/chart/helper/labelHelper.js +0 -17
- package/src/chart/helper/whiskerBoxCommon.js +11 -4
- package/src/chart/line/LineSeries.js +1 -0
- package/src/chart/line/LineView.js +14 -2
- package/src/chart/line/poly.js +5 -0
- package/src/chart/lines/LinesView.js +22 -7
- package/src/chart/map/MapSeries.js +3 -7
- package/src/chart/map/MapView.js +29 -18
- package/src/chart/pie/PieSeries.js +20 -6
- package/src/chart/pie/PieView.js +20 -23
- package/src/chart/pie/labelLayout.js +3 -3
- package/src/chart/radar/RadarView.js +16 -20
- package/src/chart/sankey/SankeySeries.js +2 -4
- package/src/chart/sankey/SankeyView.js +13 -29
- package/src/chart/sankey/sankeyLayout.js +1 -1
- package/src/chart/scatter/ScatterSeries.js +2 -1
- package/src/chart/themeRiver/ThemeRiverSeries.js +2 -4
- package/src/chart/themeRiver/ThemeRiverView.js +2 -5
- package/src/chart/themeRiver/themeRiverLayout.js +1 -1
- package/src/chart/treemap/Breadcrumb.js +1 -1
- package/src/chart/treemap/TreemapSeries.js +28 -8
- package/src/chart/treemap/TreemapView.js +88 -77
- package/src/chart/treemap/treemapLayout.js +29 -13
- package/src/component/axis/AngleAxisView.js +13 -19
- package/src/component/axis/AxisBuilder.js +260 -186
- package/src/component/axis/CartesianAxisView.js +15 -3
- package/src/component/axis/ParallelAxisView.js +1 -1
- package/src/component/axis/RadiusAxisView.js +1 -1
- package/src/component/axis/SingleAxisView.js +8 -2
- package/src/component/axis/cartesianAxisHelper.js +11 -15
- package/src/component/axisPointer/AxisPointerModel.js +1 -3
- package/src/component/axisPointer/BaseAxisPointer.js +15 -38
- package/src/component/axisPointer/axisTrigger.js +36 -20
- package/src/component/axisPointer/modelHelper.js +3 -4
- package/src/component/axisPointer/viewHelper.js +4 -6
- package/src/component/axisPointer.js +1 -14
- package/src/component/calendar/CalendarView.js +22 -39
- package/src/component/dataZoom/AxisProxy.js +3 -2
- package/src/component/dataZoom/DataZoomModel.js +16 -4
- package/src/component/dataZoom/InsideZoomView.js +5 -3
- package/src/component/dataZoom/SliderZoomView.js +21 -32
- package/src/component/dataZoom/roams.js +33 -9
- package/src/component/dataZoom/typeDefaulter.js +1 -1
- package/src/component/graphic.js +17 -5
- package/src/component/helper/BrushTargetManager.js +1 -1
- package/src/component/helper/MapDraw.js +26 -22
- package/src/component/helper/RoamController.js +12 -11
- package/src/component/helper/listComponent.js +27 -24
- package/src/component/helper/selectableMixin.js +40 -15
- package/src/component/legend/LegendModel.js +11 -3
- package/src/component/legend/LegendView.js +151 -70
- package/src/component/legend/ScrollableLegendModel.js +76 -0
- package/src/component/legend/ScrollableLegendView.js +368 -0
- package/src/component/legend/legendAction.js +1 -0
- package/src/component/legend/scrollableLegendAction.js +25 -0
- package/src/component/legend.js +8 -3
- package/src/component/legendScroll.js +12 -0
- package/src/component/marker/MarkAreaView.js +12 -26
- package/src/component/marker/MarkLineView.js +5 -5
- package/src/component/marker/MarkPointView.js +4 -4
- package/src/component/marker/MarkerModel.js +1 -4
- package/src/component/marker/markerHelper.js +1 -0
- package/src/component/radar/RadarView.js +6 -3
- package/src/component/timeline/SliderTimelineModel.js +4 -6
- package/src/component/timeline/SliderTimelineView.js +14 -16
- package/src/component/timeline/TimelineAxis.js +1 -1
- package/src/component/timeline/TimelineModel.js +1 -3
- package/src/component/title.js +9 -10
- package/src/component/toolbox/ToolboxModel.js +2 -0
- package/src/component/toolbox/ToolboxView.js +15 -27
- package/src/component/toolbox/feature/Brush.js +3 -8
- package/src/component/toolbox/feature/DataView.js +5 -5
- package/src/component/toolbox/feature/DataZoom.js +3 -4
- package/src/component/toolbox/feature/MagicType.js +3 -6
- package/src/component/toolbox/feature/Restore.js +2 -1
- package/src/component/toolbox/feature/SaveAsImage.js +23 -10
- package/src/component/tooltip/TooltipContent.js +4 -4
- package/src/component/tooltip/TooltipView.js +29 -7
- package/src/component/visualMap/ContinuousModel.js +2 -2
- package/src/component/visualMap/ContinuousView.js +12 -8
- package/src/component/visualMap/PiecewiseModel.js +1 -2
- package/src/component/visualMap/PiecewiseView.js +2 -2
- package/src/component/visualMap/VisualMapModel.js +18 -12
- package/src/coord/Axis.js +1 -1
- package/src/coord/axisDefault.js +3 -3
- package/src/coord/axisHelper.js +18 -1
- package/src/coord/axisModelCommonMixin.js +12 -2
- package/src/coord/calendar/Calendar.js +65 -21
- package/src/coord/calendar/CalendarModel.js +6 -12
- package/src/coord/cartesian/Cartesian2D.js +0 -14
- package/src/coord/cartesian/Grid.js +47 -28
- package/src/coord/geo/Geo.js +2 -18
- package/src/coord/geo/GeoModel.js +6 -13
- package/src/coord/geo/fix/diaoyuIsland.js +30 -0
- package/src/coord/geo/geoCreator.js +6 -1
- package/src/coord/polar/Polar.js +0 -13
- package/src/coord/radar/Radar.js +1 -1
- package/src/coord/radar/RadarModel.js +6 -2
- package/src/data/DataDiffer.js +14 -7
- package/src/data/Graph.js +3 -0
- package/src/data/List.js +1 -1
- package/src/data/Tree.js +2 -2
- package/src/data/helper/completeDimensions.js +2 -11
- package/src/echarts.js +33 -10
- package/src/lang.js +43 -0
- package/src/langEN.js +43 -0
- package/src/layout/barGrid.js +11 -3
- package/src/layout/barPolar.js +9 -2
- package/src/model/Model.js +2 -1
- package/src/model/Series.js +14 -6
- package/src/model/mixin/textStyle.js +11 -9
- package/src/preprocessor/backwardCompat.js +5 -4
- package/src/preprocessor/helper/compatStyle.js +157 -45
- package/src/scale/Interval.js +10 -4
- package/src/scale/Time.js +14 -6
- package/src/scale/helper.js +15 -2
- package/src/util/format.js +4 -24
- package/src/util/graphic.js +412 -21
- package/src/util/layout.js +28 -16
- package/src/util/model.js +26 -11
- package/src/util/number.js +106 -21
- package/src/visual/VisualMapping.js +4 -4
- package/webpack.config.js +21 -7
- package/.npmignore +0 -10
|
@@ -0,0 +1,368 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Separate legend and scrollable legend to reduce package size.
|
|
3
|
+
*/
|
|
4
|
+
define(function (require) {
|
|
5
|
+
|
|
6
|
+
var zrUtil = require('zrender/core/util');
|
|
7
|
+
var graphic = require('../../util/graphic');
|
|
8
|
+
var layoutUtil = require('../../util/layout');
|
|
9
|
+
var LegendView = require('./LegendView');
|
|
10
|
+
|
|
11
|
+
var Group = graphic.Group;
|
|
12
|
+
|
|
13
|
+
var WH = ['width', 'height'];
|
|
14
|
+
var XY = ['x', 'y'];
|
|
15
|
+
|
|
16
|
+
var ScrollableLegendView = LegendView.extend({
|
|
17
|
+
|
|
18
|
+
type: 'legend.scroll',
|
|
19
|
+
|
|
20
|
+
newlineDisabled: true,
|
|
21
|
+
|
|
22
|
+
init: function () {
|
|
23
|
+
|
|
24
|
+
ScrollableLegendView.superCall(this, 'init');
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* @private
|
|
28
|
+
* @type {number} For `scroll`.
|
|
29
|
+
*/
|
|
30
|
+
this._currentIndex = 0;
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* @private
|
|
34
|
+
* @type {module:zrender/container/Group}
|
|
35
|
+
*/
|
|
36
|
+
this.group.add(this._containerGroup = new Group());
|
|
37
|
+
this._containerGroup.add(this.getContentGroup());
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* @private
|
|
41
|
+
* @type {module:zrender/container/Group}
|
|
42
|
+
*/
|
|
43
|
+
this.group.add(this._controllerGroup = new Group());
|
|
44
|
+
},
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* @override
|
|
48
|
+
*/
|
|
49
|
+
resetInner: function () {
|
|
50
|
+
ScrollableLegendView.superCall(this, 'resetInner');
|
|
51
|
+
|
|
52
|
+
this._controllerGroup.removeAll();
|
|
53
|
+
this._containerGroup.removeClipPath();
|
|
54
|
+
this._containerGroup.__rectSize = null;
|
|
55
|
+
},
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* @override
|
|
59
|
+
*/
|
|
60
|
+
renderInner: function (itemAlign, legendModel, ecModel, api) {
|
|
61
|
+
var me = this;
|
|
62
|
+
|
|
63
|
+
// Render content items.
|
|
64
|
+
ScrollableLegendView.superCall(this, 'renderInner', itemAlign, legendModel, ecModel, api);
|
|
65
|
+
|
|
66
|
+
var controllerGroup = this._controllerGroup;
|
|
67
|
+
|
|
68
|
+
var pageIconSize = legendModel.get('pageIconSize', true);
|
|
69
|
+
if (!zrUtil.isArray(pageIconSize)) {
|
|
70
|
+
pageIconSize = [pageIconSize, pageIconSize];
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
createPageButton('pagePrev', 0);
|
|
74
|
+
|
|
75
|
+
var pageTextStyleModel = legendModel.getModel('pageTextStyle');
|
|
76
|
+
controllerGroup.add(new graphic.Text({
|
|
77
|
+
name: 'pageText',
|
|
78
|
+
style: {
|
|
79
|
+
textFill: pageTextStyleModel.getTextColor(),
|
|
80
|
+
font: pageTextStyleModel.getFont(),
|
|
81
|
+
textVerticalAlign: 'middle',
|
|
82
|
+
textAlign: 'center'
|
|
83
|
+
},
|
|
84
|
+
silent: true
|
|
85
|
+
}));
|
|
86
|
+
|
|
87
|
+
createPageButton('pageNext', 1);
|
|
88
|
+
|
|
89
|
+
function createPageButton(name, iconIdx) {
|
|
90
|
+
var pageDataIndexName = name + 'DataIndex';
|
|
91
|
+
var icon = graphic.createIcon(
|
|
92
|
+
legendModel.get('pageIcons', true)[legendModel.getOrient().name][iconIdx],
|
|
93
|
+
{
|
|
94
|
+
// Buttons will be created in each render, so we do not need
|
|
95
|
+
// to worry about avoiding using legendModel kept in scope.
|
|
96
|
+
onclick: zrUtil.bind(
|
|
97
|
+
me._pageGo, me, pageDataIndexName, legendModel, api
|
|
98
|
+
)
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
x: -pageIconSize[0] / 2,
|
|
102
|
+
y: -pageIconSize[1] / 2,
|
|
103
|
+
width: pageIconSize[0],
|
|
104
|
+
height: pageIconSize[1]
|
|
105
|
+
}
|
|
106
|
+
);
|
|
107
|
+
icon.name = name;
|
|
108
|
+
controllerGroup.add(icon);
|
|
109
|
+
}
|
|
110
|
+
},
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* @override
|
|
114
|
+
*/
|
|
115
|
+
layoutInner: function (legendModel, itemAlign, maxSize) {
|
|
116
|
+
var contentGroup = this.getContentGroup();
|
|
117
|
+
var containerGroup = this._containerGroup;
|
|
118
|
+
var controllerGroup = this._controllerGroup;
|
|
119
|
+
|
|
120
|
+
var orientIdx = legendModel.getOrient().index;
|
|
121
|
+
var wh = WH[orientIdx];
|
|
122
|
+
var hw = WH[1 - orientIdx];
|
|
123
|
+
var yx = XY[1 - orientIdx];
|
|
124
|
+
|
|
125
|
+
// Place items in contentGroup.
|
|
126
|
+
layoutUtil.box(
|
|
127
|
+
legendModel.get('orient'),
|
|
128
|
+
contentGroup,
|
|
129
|
+
legendModel.get('itemGap'),
|
|
130
|
+
!orientIdx ? null : maxSize.width,
|
|
131
|
+
orientIdx ? null : maxSize.height
|
|
132
|
+
);
|
|
133
|
+
|
|
134
|
+
layoutUtil.box(
|
|
135
|
+
// Buttons in controller are layout always horizontally.
|
|
136
|
+
'horizontal',
|
|
137
|
+
controllerGroup,
|
|
138
|
+
legendModel.get('pageButtonItemGap', true)
|
|
139
|
+
);
|
|
140
|
+
|
|
141
|
+
var contentRect = contentGroup.getBoundingRect();
|
|
142
|
+
var controllerRect = controllerGroup.getBoundingRect();
|
|
143
|
+
var showController = contentRect[wh] > maxSize[wh];
|
|
144
|
+
|
|
145
|
+
var contentPos = [-contentRect.x, -contentRect.y];
|
|
146
|
+
// Remain contentPos when scroll animation perfroming.
|
|
147
|
+
contentPos[orientIdx] = contentGroup.position[orientIdx];
|
|
148
|
+
|
|
149
|
+
// Layout container group based on 0.
|
|
150
|
+
var containerPos = [0, 0];
|
|
151
|
+
var controllerPos = [-controllerRect.x, -controllerRect.y];
|
|
152
|
+
var pageButtonGap = zrUtil.retrieve2(
|
|
153
|
+
legendModel.get('pageButtonGap', true), legendModel.get('itemGap', true)
|
|
154
|
+
);
|
|
155
|
+
|
|
156
|
+
// Place containerGroup and controllerGroup and contentGroup.
|
|
157
|
+
if (showController) {
|
|
158
|
+
var pageButtonPosition = legendModel.get('pageButtonPosition', true);
|
|
159
|
+
// controller is on the right / bottom.
|
|
160
|
+
if (pageButtonPosition === 'end') {
|
|
161
|
+
controllerPos[orientIdx] += maxSize[wh] - controllerRect[wh];
|
|
162
|
+
}
|
|
163
|
+
// controller is on the left / top.
|
|
164
|
+
else {
|
|
165
|
+
containerPos[orientIdx] += controllerRect[wh] + pageButtonGap;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
// Always align controller to content as 'middle'.
|
|
170
|
+
controllerPos[1 - orientIdx] += contentRect[hw] / 2 - controllerRect[hw] / 2;
|
|
171
|
+
|
|
172
|
+
contentGroup.attr('position', contentPos);
|
|
173
|
+
containerGroup.attr('position', containerPos);
|
|
174
|
+
controllerGroup.attr('position', controllerPos);
|
|
175
|
+
|
|
176
|
+
// Calculate `mainRect` and set `clipPath`.
|
|
177
|
+
// mainRect should not be calculated by `this.group.getBoundingRect()`
|
|
178
|
+
// for sake of the overflow.
|
|
179
|
+
var mainRect = this.group.getBoundingRect();
|
|
180
|
+
var mainRect = {x: 0, y: 0};
|
|
181
|
+
// Consider content may be overflow (should be clipped).
|
|
182
|
+
mainRect[wh] = showController ? maxSize[wh] : contentRect[wh];
|
|
183
|
+
mainRect[hw] = Math.max(contentRect[hw], controllerRect[hw]);
|
|
184
|
+
// `containerRect[yx] + containerPos[1 - orientIdx]` is 0.
|
|
185
|
+
mainRect[yx] = Math.min(0, controllerRect[yx] + controllerPos[1 - orientIdx]);
|
|
186
|
+
|
|
187
|
+
containerGroup.__rectSize = maxSize[wh];
|
|
188
|
+
if (showController) {
|
|
189
|
+
var clipShape = {x: 0, y: 0};
|
|
190
|
+
clipShape[wh] = Math.max(maxSize[wh] - controllerRect[wh] - pageButtonGap, 0);
|
|
191
|
+
clipShape[hw] = mainRect[hw];
|
|
192
|
+
containerGroup.setClipPath(new graphic.Rect({shape: clipShape}));
|
|
193
|
+
// Consider content may be larger than container, container rect
|
|
194
|
+
// can not be obtained from `containerGroup.getBoundingRect()`.
|
|
195
|
+
containerGroup.__rectSize = clipShape[wh];
|
|
196
|
+
}
|
|
197
|
+
else {
|
|
198
|
+
// Do not remove or ignore controller. Keep them set as place holders.
|
|
199
|
+
controllerGroup.eachChild(function (child) {
|
|
200
|
+
child.attr({invisible: true, silent: true});
|
|
201
|
+
});
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
// Content translate animation.
|
|
205
|
+
var pageInfo = this._getPageInfo(legendModel);
|
|
206
|
+
pageInfo.pageIndex != null && graphic.updateProps(
|
|
207
|
+
contentGroup, {position: pageInfo.contentPosition}, legendModel
|
|
208
|
+
);
|
|
209
|
+
|
|
210
|
+
this._updatePageInfoView(legendModel, pageInfo);
|
|
211
|
+
|
|
212
|
+
return mainRect;
|
|
213
|
+
},
|
|
214
|
+
|
|
215
|
+
_pageGo: function (to, legendModel, api) {
|
|
216
|
+
var scrollDataIndex = this._getPageInfo(legendModel)[to];
|
|
217
|
+
|
|
218
|
+
scrollDataIndex != null && api.dispatchAction({
|
|
219
|
+
type: 'legendScroll',
|
|
220
|
+
scrollDataIndex: scrollDataIndex,
|
|
221
|
+
legendId: legendModel.id
|
|
222
|
+
});
|
|
223
|
+
},
|
|
224
|
+
|
|
225
|
+
_updatePageInfoView: function (legendModel, pageInfo) {
|
|
226
|
+
var controllerGroup = this._controllerGroup;
|
|
227
|
+
|
|
228
|
+
zrUtil.each(['pagePrev', 'pageNext'], function (name) {
|
|
229
|
+
var canJump = pageInfo[name + 'DataIndex'] != null;
|
|
230
|
+
var icon = controllerGroup.childOfName(name);
|
|
231
|
+
if (icon) {
|
|
232
|
+
icon.setStyle(
|
|
233
|
+
'fill',
|
|
234
|
+
canJump
|
|
235
|
+
? legendModel.get('pageIconColor', true)
|
|
236
|
+
: legendModel.get('pageIconInactiveColor', true)
|
|
237
|
+
);
|
|
238
|
+
icon.cursor = canJump ? 'pointer' : 'default';
|
|
239
|
+
}
|
|
240
|
+
});
|
|
241
|
+
|
|
242
|
+
var pageText = controllerGroup.childOfName('pageText');
|
|
243
|
+
var pageFormatter = legendModel.get('pageFormatter');
|
|
244
|
+
var pageIndex = pageInfo.pageIndex;
|
|
245
|
+
var current = pageIndex != null ? pageIndex + 1 : 0;
|
|
246
|
+
var total = pageInfo.pageCount;
|
|
247
|
+
|
|
248
|
+
pageText && pageFormatter && pageText.setStyle(
|
|
249
|
+
'text',
|
|
250
|
+
zrUtil.isString(pageFormatter)
|
|
251
|
+
? pageFormatter.replace('{current}', current).replace('{total}', total)
|
|
252
|
+
: pageFormatter({current: current, total: total})
|
|
253
|
+
);
|
|
254
|
+
},
|
|
255
|
+
|
|
256
|
+
/**
|
|
257
|
+
* @param {module:echarts/model/Model} legendModel
|
|
258
|
+
* @return {Object} {
|
|
259
|
+
* contentPosition: Array.<number>, null when data item not found.
|
|
260
|
+
* pageIndex: number, null when data item not found.
|
|
261
|
+
* pageCount: number, always be a number, can be 0.
|
|
262
|
+
* pagePrevDataIndex: number, null when no next page.
|
|
263
|
+
* pageNextDataIndex: number, null when no previous page.
|
|
264
|
+
* }
|
|
265
|
+
*/
|
|
266
|
+
_getPageInfo: function (legendModel) {
|
|
267
|
+
// Align left or top by the current dataIndex.
|
|
268
|
+
var currDataIndex = legendModel.get('scrollDataIndex', true);
|
|
269
|
+
var contentGroup = this.getContentGroup();
|
|
270
|
+
var contentRect = contentGroup.getBoundingRect();
|
|
271
|
+
var containerRectSize = this._containerGroup.__rectSize;
|
|
272
|
+
|
|
273
|
+
var orientIdx = legendModel.getOrient().index;
|
|
274
|
+
var wh = WH[orientIdx];
|
|
275
|
+
var hw = WH[1 - orientIdx];
|
|
276
|
+
var xy = XY[orientIdx];
|
|
277
|
+
var contentPos = contentGroup.position.slice();
|
|
278
|
+
|
|
279
|
+
var pageIndex;
|
|
280
|
+
var pagePrevDataIndex;
|
|
281
|
+
var pageNextDataIndex;
|
|
282
|
+
|
|
283
|
+
var targetItemGroup;
|
|
284
|
+
contentGroup.eachChild(function (child) {
|
|
285
|
+
if (child.__legendDataIndex === currDataIndex) {
|
|
286
|
+
targetItemGroup = child;
|
|
287
|
+
}
|
|
288
|
+
});
|
|
289
|
+
|
|
290
|
+
var pageCount = containerRectSize ? Math.ceil(contentRect[wh] / containerRectSize) : 0;
|
|
291
|
+
|
|
292
|
+
if (targetItemGroup) {
|
|
293
|
+
var itemRect = targetItemGroup.getBoundingRect();
|
|
294
|
+
var itemLoc = targetItemGroup.position[orientIdx] + itemRect[xy];
|
|
295
|
+
contentPos[orientIdx] = -itemLoc - contentRect[xy];
|
|
296
|
+
pageIndex = Math.floor(
|
|
297
|
+
pageCount * (itemLoc + itemRect[xy] + containerRectSize / 2) / contentRect[wh]
|
|
298
|
+
);
|
|
299
|
+
pageIndex = (contentRect[wh] && pageCount)
|
|
300
|
+
? Math.max(0, Math.min(pageCount - 1, pageIndex))
|
|
301
|
+
: -1;
|
|
302
|
+
|
|
303
|
+
var winRect = {x: 0, y: 0};
|
|
304
|
+
winRect[wh] = containerRectSize;
|
|
305
|
+
winRect[hw] = contentRect[hw];
|
|
306
|
+
winRect[xy] = -contentPos[orientIdx] - contentRect[xy];
|
|
307
|
+
|
|
308
|
+
var startIdx;
|
|
309
|
+
var children = contentGroup.children();
|
|
310
|
+
|
|
311
|
+
contentGroup.eachChild(function (child, index) {
|
|
312
|
+
var itemRect = getItemRect(child);
|
|
313
|
+
|
|
314
|
+
if (itemRect.intersect(winRect)) {
|
|
315
|
+
startIdx == null && (startIdx = index);
|
|
316
|
+
// It is user-friendly that the last item shown in the
|
|
317
|
+
// current window is shown at the begining of next window.
|
|
318
|
+
pageNextDataIndex = child.__legendDataIndex;
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
// If the last item is shown entirely, no next page.
|
|
322
|
+
if (index === children.length - 1
|
|
323
|
+
&& itemRect[xy] + itemRect[wh] <= winRect[xy] + winRect[wh]
|
|
324
|
+
) {
|
|
325
|
+
pageNextDataIndex = null;
|
|
326
|
+
}
|
|
327
|
+
});
|
|
328
|
+
|
|
329
|
+
// Always align based on the left/top most item, so the left/top most
|
|
330
|
+
// item in the previous window is needed to be found here.
|
|
331
|
+
if (startIdx != null) {
|
|
332
|
+
var startItem = children[startIdx];
|
|
333
|
+
var startRect = getItemRect(startItem);
|
|
334
|
+
winRect[xy] = startRect[xy] + startRect[wh] - winRect[wh];
|
|
335
|
+
|
|
336
|
+
// If the first item is shown entirely, no previous page.
|
|
337
|
+
if (startIdx <= 0 && startRect[xy] >= winRect[xy]) {
|
|
338
|
+
pagePrevDataIndex = null;
|
|
339
|
+
}
|
|
340
|
+
else {
|
|
341
|
+
while (startIdx > 0 && getItemRect(children[startIdx - 1]).intersect(winRect)) {
|
|
342
|
+
startIdx--;
|
|
343
|
+
}
|
|
344
|
+
pagePrevDataIndex = children[startIdx].__legendDataIndex;
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
return {
|
|
350
|
+
contentPosition: contentPos,
|
|
351
|
+
pageIndex: pageIndex,
|
|
352
|
+
pageCount: pageCount,
|
|
353
|
+
pagePrevDataIndex: pagePrevDataIndex,
|
|
354
|
+
pageNextDataIndex: pageNextDataIndex
|
|
355
|
+
};
|
|
356
|
+
|
|
357
|
+
function getItemRect(el) {
|
|
358
|
+
var itemRect = el.getBoundingRect().clone();
|
|
359
|
+
itemRect[xy] += el.position[orientIdx];
|
|
360
|
+
return itemRect;
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
});
|
|
365
|
+
|
|
366
|
+
return ScrollableLegendView;
|
|
367
|
+
|
|
368
|
+
});
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file Legend action
|
|
3
|
+
*/
|
|
4
|
+
define(function(require) {
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* @event legendScroll
|
|
8
|
+
* @type {Object}
|
|
9
|
+
* @property {string} type 'legendScroll'
|
|
10
|
+
* @property {string} scrollDataIndex
|
|
11
|
+
*/
|
|
12
|
+
require('../../echarts').registerAction(
|
|
13
|
+
'legendScroll', 'legendscroll',
|
|
14
|
+
function (payload, ecModel) {
|
|
15
|
+
var scrollDataIndex = payload.scrollDataIndex;
|
|
16
|
+
|
|
17
|
+
scrollDataIndex != null && ecModel.eachComponent(
|
|
18
|
+
{mainType: 'legend', subType: 'scroll', query: payload},
|
|
19
|
+
function (legendModel) {
|
|
20
|
+
legendModel.setScrollDataIndex(scrollDataIndex);
|
|
21
|
+
}
|
|
22
|
+
);
|
|
23
|
+
}
|
|
24
|
+
);
|
|
25
|
+
});
|
package/src/component/legend.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Legend component entry file8
|
|
3
|
-
*/
|
|
4
1
|
define(function (require) {
|
|
5
2
|
|
|
3
|
+
// Do not contain scrollable legend, for sake of file size.
|
|
4
|
+
|
|
6
5
|
require('./legend/LegendModel');
|
|
7
6
|
require('./legend/legendAction');
|
|
8
7
|
require('./legend/LegendView');
|
|
@@ -10,4 +9,10 @@ define(function (require) {
|
|
|
10
9
|
var echarts = require('../echarts');
|
|
11
10
|
// Series Filter
|
|
12
11
|
echarts.registerProcessor(require('./legend/legendFilter'));
|
|
12
|
+
|
|
13
|
+
require('../model/Component').registerSubTypeDefaulter('legend', function () {
|
|
14
|
+
// Default 'plain' when no type specified.
|
|
15
|
+
return 'plain';
|
|
16
|
+
});
|
|
17
|
+
|
|
13
18
|
});
|
|
@@ -221,32 +221,18 @@ define(function (require) {
|
|
|
221
221
|
)
|
|
222
222
|
);
|
|
223
223
|
|
|
224
|
-
polygon.hoverStyle = itemModel.getModel('itemStyle.
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
else {
|
|
237
|
-
polygon.style.text = '';
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
if (labelHoverModel.getShallow('show')) {
|
|
241
|
-
graphic.setText(polygon.hoverStyle, labelHoverModel, textColor);
|
|
242
|
-
polygon.hoverStyle.text = zrUtil.retrieve(
|
|
243
|
-
maModel.getFormattedLabel(idx, 'emphasis'),
|
|
244
|
-
defaultValue
|
|
245
|
-
);
|
|
246
|
-
}
|
|
247
|
-
else {
|
|
248
|
-
polygon.hoverStyle.text = '';
|
|
249
|
-
}
|
|
224
|
+
polygon.hoverStyle = itemModel.getModel('itemStyle.emphasis').getItemStyle();
|
|
225
|
+
|
|
226
|
+
graphic.setLabelStyle(
|
|
227
|
+
polygon.style, polygon.hoverStyle, labelModel, labelHoverModel,
|
|
228
|
+
{
|
|
229
|
+
labelFetcher: maModel,
|
|
230
|
+
labelDataIndex: idx,
|
|
231
|
+
defaultText: areaData.getName(idx) || '',
|
|
232
|
+
isRectText: true,
|
|
233
|
+
autoColor: color
|
|
234
|
+
}
|
|
235
|
+
);
|
|
250
236
|
|
|
251
237
|
graphic.setHoverStyle(polygon, {});
|
|
252
238
|
|
|
@@ -54,7 +54,7 @@ define(function (require) {
|
|
|
54
54
|
|
|
55
55
|
var precision = mlModel.get('precision');
|
|
56
56
|
if (precision >= 0 && typeof value === 'number') {
|
|
57
|
-
value = +value.toFixed(precision);
|
|
57
|
+
value = +value.toFixed(Math.min(precision, 20));
|
|
58
58
|
}
|
|
59
59
|
|
|
60
60
|
mlFrom.coord[valueIndex] = mlTo.coord[valueIndex] = value;
|
|
@@ -200,7 +200,7 @@ define(function (require) {
|
|
|
200
200
|
]);
|
|
201
201
|
});
|
|
202
202
|
|
|
203
|
-
this.markerGroupMap.get(seriesModel.
|
|
203
|
+
this.markerGroupMap.get(seriesModel.id).updateLayout();
|
|
204
204
|
|
|
205
205
|
}
|
|
206
206
|
}, this);
|
|
@@ -208,12 +208,12 @@ define(function (require) {
|
|
|
208
208
|
|
|
209
209
|
renderSeries: function (seriesModel, mlModel, ecModel, api) {
|
|
210
210
|
var coordSys = seriesModel.coordinateSystem;
|
|
211
|
-
var
|
|
211
|
+
var seriesId = seriesModel.id;
|
|
212
212
|
var seriesData = seriesModel.getData();
|
|
213
213
|
|
|
214
214
|
var lineDrawMap = this.markerGroupMap;
|
|
215
|
-
var lineDraw = lineDrawMap.get(
|
|
216
|
-
|| lineDrawMap.set(
|
|
215
|
+
var lineDraw = lineDrawMap.get(seriesId)
|
|
216
|
+
|| lineDrawMap.set(seriesId, new LineDraw());
|
|
217
217
|
this.group.add(lineDraw.group);
|
|
218
218
|
|
|
219
219
|
var mlData = createList(coordSys, seriesModel, mlModel);
|
|
@@ -53,19 +53,19 @@ define(function (require) {
|
|
|
53
53
|
var mpModel = seriesModel.markPointModel;
|
|
54
54
|
if (mpModel) {
|
|
55
55
|
updateMarkerLayout(mpModel.getData(), seriesModel, api);
|
|
56
|
-
this.markerGroupMap.get(seriesModel.
|
|
56
|
+
this.markerGroupMap.get(seriesModel.id).updateLayout(mpModel);
|
|
57
57
|
}
|
|
58
58
|
}, this);
|
|
59
59
|
},
|
|
60
60
|
|
|
61
61
|
renderSeries: function (seriesModel, mpModel, ecModel, api) {
|
|
62
62
|
var coordSys = seriesModel.coordinateSystem;
|
|
63
|
-
var
|
|
63
|
+
var seriesId = seriesModel.id;
|
|
64
64
|
var seriesData = seriesModel.getData();
|
|
65
65
|
|
|
66
66
|
var symbolDrawMap = this.markerGroupMap;
|
|
67
|
-
var symbolDraw = symbolDrawMap.get(
|
|
68
|
-
|| symbolDrawMap.set(
|
|
67
|
+
var symbolDraw = symbolDrawMap.get(seriesId)
|
|
68
|
+
|| symbolDrawMap.set(seriesId, new SymbolDraw());
|
|
69
69
|
|
|
70
70
|
var mpData = createList(coordSys, seriesModel, mpModel);
|
|
71
71
|
|
|
@@ -9,10 +9,7 @@ define(function (require) {
|
|
|
9
9
|
var encodeHTML = formatUtil.encodeHTML;
|
|
10
10
|
|
|
11
11
|
function fillLabel(opt) {
|
|
12
|
-
modelUtil.defaultEmphasis(
|
|
13
|
-
opt.label,
|
|
14
|
-
modelUtil.LABEL_OPTIONS
|
|
15
|
-
);
|
|
12
|
+
modelUtil.defaultEmphasis(opt.label, ['show']);
|
|
16
13
|
}
|
|
17
14
|
var MarkerModel = require('../../echarts').extendComponentModel({
|
|
18
15
|
|
|
@@ -38,6 +38,7 @@ define(function (require) {
|
|
|
38
38
|
coordArr[targetCoordIndex] = data.get(targetDataDim, dataIndex, true);
|
|
39
39
|
|
|
40
40
|
var precision = getPrecision(data, targetDataDim, dataIndex);
|
|
41
|
+
precision = Math.min(precision, 20);
|
|
41
42
|
if (precision >= 0) {
|
|
42
43
|
coordArr[targetCoordIndex] = +coordArr[targetCoordIndex].toFixed(precision);
|
|
43
44
|
}
|
|
@@ -5,7 +5,7 @@ define(function (require) {
|
|
|
5
5
|
var graphic = require('../../util/graphic');
|
|
6
6
|
|
|
7
7
|
var axisBuilderAttrs = [
|
|
8
|
-
'axisLine', '
|
|
8
|
+
'axisLine', 'axisTickLabel', 'axisName'
|
|
9
9
|
];
|
|
10
10
|
|
|
11
11
|
return require('../../echarts').extendComponentView({
|
|
@@ -99,10 +99,12 @@ define(function (require) {
|
|
|
99
99
|
}
|
|
100
100
|
// Polyyon
|
|
101
101
|
else {
|
|
102
|
-
var realSplitNumber
|
|
102
|
+
var realSplitNumber;
|
|
103
103
|
var axesTicksPoints = zrUtil.map(indicatorAxes, function (indicatorAxis, idx) {
|
|
104
104
|
var ticksCoords = indicatorAxis.getTicksCoords();
|
|
105
|
-
realSplitNumber =
|
|
105
|
+
realSplitNumber = realSplitNumber == null
|
|
106
|
+
? ticksCoords.length - 1
|
|
107
|
+
: Math.min(ticksCoords.length - 1, realSplitNumber);
|
|
106
108
|
return zrUtil.map(ticksCoords, function (tickCoord) {
|
|
107
109
|
return radar.coordToPoint(tickCoord, idx);
|
|
108
110
|
});
|
|
@@ -123,6 +125,7 @@ define(function (require) {
|
|
|
123
125
|
console.error('Can\'t draw value axis ' + i);
|
|
124
126
|
}
|
|
125
127
|
}
|
|
128
|
+
|
|
126
129
|
if (showSplitLine) {
|
|
127
130
|
var colorIndex = getColorIndex(splitLines, splitLineColors, i);
|
|
128
131
|
splitLines[colorIndex].push(new graphic.Polyline({
|
|
@@ -45,15 +45,13 @@ define(function(require) {
|
|
|
45
45
|
interval: 'auto',
|
|
46
46
|
rotate: 0,
|
|
47
47
|
// formatter: null,
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
}
|
|
48
|
+
// 其余属性默认使用全局文本样式,详见TEXTSTYLE
|
|
49
|
+
color: '#304654'
|
|
51
50
|
},
|
|
52
51
|
emphasis: {
|
|
53
52
|
show: true,
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
}
|
|
53
|
+
// 其余属性默认使用全局文本样式,详见TEXTSTYLE
|
|
54
|
+
color: '#c23531'
|
|
57
55
|
}
|
|
58
56
|
},
|
|
59
57
|
itemStyle: {
|
|
@@ -135,10 +135,6 @@ define(function (require) {
|
|
|
135
135
|
})[orient][labelPosOpt];
|
|
136
136
|
}
|
|
137
137
|
|
|
138
|
-
// FIXME
|
|
139
|
-
// 暂没有实现用户传入
|
|
140
|
-
// var labelAlign = timelineModel.get('label.normal.textStyle.align');
|
|
141
|
-
// var labelBaseline = timelineModel.get('label.normal.textStyle.baseline');
|
|
142
138
|
var labelAlignMap = {
|
|
143
139
|
horizontal: 'center',
|
|
144
140
|
vertical: (labelPosOpt >= 0 || labelPosOpt === '+') ? 'left' : 'right'
|
|
@@ -203,8 +199,10 @@ define(function (require) {
|
|
|
203
199
|
rotation: rotationMap[orient],
|
|
204
200
|
labelRotation: labelRotation,
|
|
205
201
|
labelPosOpt: labelPosOpt,
|
|
206
|
-
labelAlign: labelAlignMap[orient],
|
|
207
|
-
labelBaseline:
|
|
202
|
+
labelAlign: timelineModel.get('label.normal.align') || labelAlignMap[orient],
|
|
203
|
+
labelBaseline: timelineModel.get('label.normal.verticalAlign')
|
|
204
|
+
|| timelineModel.get('label.normal.baseline')
|
|
205
|
+
|| labelBaselineMap[orient],
|
|
208
206
|
|
|
209
207
|
// Based on mainGroup.
|
|
210
208
|
playPosition: playPosition,
|
|
@@ -401,25 +399,25 @@ define(function (require) {
|
|
|
401
399
|
}
|
|
402
400
|
|
|
403
401
|
var itemModel = data.getItemModel(dataIndex);
|
|
404
|
-
var
|
|
405
|
-
var
|
|
402
|
+
var normalLabelModel = itemModel.getModel('label.normal');
|
|
403
|
+
var hoverLabelModel = itemModel.getModel('label.emphasis');
|
|
406
404
|
var tickCoord = axis.dataToCoord(tick);
|
|
407
405
|
var textEl = new graphic.Text({
|
|
408
|
-
style: {
|
|
409
|
-
text: labels[dataIndex],
|
|
410
|
-
textAlign: layoutInfo.labelAlign,
|
|
411
|
-
textVerticalAlign: layoutInfo.labelBaseline,
|
|
412
|
-
textFont: itemTextStyleModel.getFont(),
|
|
413
|
-
fill: itemTextStyleModel.getTextColor()
|
|
414
|
-
},
|
|
415
406
|
position: [tickCoord, 0],
|
|
416
407
|
rotation: layoutInfo.labelRotation - layoutInfo.rotation,
|
|
417
408
|
onclick: bind(this._changeTimeline, this, dataIndex),
|
|
418
409
|
silent: false
|
|
419
410
|
});
|
|
411
|
+
graphic.setTextStyle(textEl.style, normalLabelModel, {
|
|
412
|
+
text: labels[dataIndex],
|
|
413
|
+
textAlign: layoutInfo.labelAlign,
|
|
414
|
+
textVerticalAlign: layoutInfo.labelBaseline
|
|
415
|
+
});
|
|
420
416
|
|
|
421
417
|
group.add(textEl);
|
|
422
|
-
graphic.setHoverStyle(
|
|
418
|
+
graphic.setHoverStyle(
|
|
419
|
+
textEl, graphic.setTextStyle({}, hoverLabelModel)
|
|
420
|
+
);
|
|
423
421
|
|
|
424
422
|
}, this);
|
|
425
423
|
},
|