echarts 4.7.0 → 4.8.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/dist/echarts-en.common.js +370 -150
- package/dist/echarts-en.common.min.js +1 -1
- package/dist/echarts-en.js +508 -229
- package/dist/echarts-en.js.map +1 -1
- package/dist/echarts-en.min.js +1 -1
- package/dist/echarts-en.simple.js +312 -123
- package/dist/echarts-en.simple.min.js +1 -1
- package/dist/echarts.common.js +344 -150
- package/dist/echarts.common.min.js +1 -1
- package/dist/echarts.js +482 -229
- package/dist/echarts.js.map +1 -1
- package/dist/echarts.min.js +1 -1
- package/dist/echarts.simple.js +286 -123
- package/dist/echarts.simple.min.js +1 -1
- package/dist/extension/bmap.js +336 -2
- package/dist/extension/bmap.js.map +1 -1
- package/dist/extension/bmap.min.js +1 -1
- package/extension/bmap/BMapView.js +6 -2
- package/extension-src/bmap/BMapView.js +3 -2
- package/lib/chart/bar/BarView.js +20 -5
- package/lib/chart/heatmap/HeatmapView.js +2 -2
- package/lib/chart/helper/EffectSymbol.js +2 -1
- package/lib/chart/helper/LineDraw.js +5 -1
- package/lib/chart/helper/Symbol.js +1 -2
- package/lib/chart/helper/createClipPathFromCoordSys.js +4 -1
- package/lib/chart/line/LineView.js +33 -0
- package/lib/chart/map/MapSeries.js +3 -2
- package/lib/chart/pie/PieView.js +20 -13
- package/lib/chart/sankey/sankeyLayout.js +18 -0
- package/lib/chart/sunburst/SunburstPiece.js +1 -0
- package/lib/chart/sunburst/SunburstSeries.js +12 -7
- package/lib/chart/sunburst/SunburstView.js +5 -1
- package/lib/chart/tree/TreeSeries.js +4 -4
- package/lib/chart/treemap/TreemapSeries.js +15 -3
- package/lib/chart/treemap/TreemapView.js +23 -11
- package/lib/component/helper/MapDraw.js +32 -4
- package/lib/component/title.js +6 -2
- package/lib/component/toolbox/ToolboxView.js +1 -1
- package/lib/component/toolbox/feature/MagicType.js +2 -1
- package/lib/component/toolbox/feature/SaveAsImage.js +2 -1
- package/lib/component/tooltip/TooltipView.js +1 -1
- package/lib/component/visualMap/PiecewiseModel.js +3 -6
- package/lib/coord/axisHelper.js +22 -16
- package/lib/coord/calendar/Calendar.js +8 -4
- package/lib/coord/geo/geoJSONLoader.js +3 -2
- package/lib/coord/geo/geoSourceManager.js +3 -2
- package/lib/coord/geo/parseGeoJson.js +3 -2
- package/lib/coord/radar/Radar.js +1 -1
- package/lib/data/Tree.js +8 -19
- package/lib/echarts.js +57 -34
- package/lib/langEN.js +26 -0
- package/lib/loading/default.js +43 -27
- package/lib/model/Series.js +1 -1
- package/lib/util/format.js +19 -2
- package/lib/util/graphic.js +11 -8
- package/lib/visual/symbol.js +12 -2
- package/map/js/province/gansu.js +2 -2
- package/package.json +2 -2
- package/src/chart/bar/BarView.js +16 -3
- package/src/chart/heatmap/HeatmapView.js +2 -2
- package/src/chart/helper/EffectSymbol.js +2 -1
- package/src/chart/helper/LineDraw.js +5 -1
- package/src/chart/helper/Symbol.js +2 -2
- package/src/chart/helper/createClipPathFromCoordSys.js +4 -0
- package/src/chart/line/LineView.js +39 -0
- package/src/chart/map/MapSeries.js +3 -2
- package/src/chart/pie/PieView.js +18 -13
- package/src/chart/sankey/sankeyLayout.js +21 -2
- package/src/chart/sunburst/SunburstPiece.js +2 -0
- package/src/chart/sunburst/SunburstSeries.js +12 -7
- package/src/chart/sunburst/SunburstView.js +2 -1
- package/src/chart/tree/TreeSeries.js +3 -6
- package/src/chart/treemap/TreemapSeries.js +15 -5
- package/src/chart/treemap/TreemapView.js +20 -14
- package/src/component/helper/MapDraw.js +26 -3
- package/src/component/title.js +3 -2
- package/src/component/toolbox/ToolboxView.js +1 -1
- package/src/component/toolbox/feature/MagicType.js +2 -1
- package/src/component/toolbox/feature/SaveAsImage.js +2 -1
- package/src/component/tooltip/TooltipView.js +1 -1
- package/src/component/visualMap/PiecewiseModel.js +5 -9
- package/src/coord/axisHelper.js +26 -19
- package/src/coord/calendar/Calendar.js +12 -5
- package/src/coord/geo/geoJSONLoader.js +3 -2
- package/src/coord/geo/geoSourceManager.js +3 -2
- package/src/coord/geo/parseGeoJson.js +3 -2
- package/src/coord/radar/Radar.js +1 -1
- package/src/data/Tree.js +11 -18
- package/src/echarts.js +60 -36
- package/src/langEN.js +26 -0
- package/src/layout/barGrid.js +4 -2
- package/src/loading/default.js +46 -34
- package/src/model/Series.js +1 -1
- package/src/util/format.js +17 -1
- package/src/util/graphic.js +10 -7
- package/src/visual/symbol.js +11 -2
package/src/echarts.js
CHANGED
|
@@ -51,10 +51,10 @@ var isFunction = zrUtil.isFunction;
|
|
|
51
51
|
var isObject = zrUtil.isObject;
|
|
52
52
|
var parseClassType = ComponentModel.parseClassType;
|
|
53
53
|
|
|
54
|
-
export var version = '4.
|
|
54
|
+
export var version = '4.8.0';
|
|
55
55
|
|
|
56
56
|
export var dependencies = {
|
|
57
|
-
zrender: '4.3.
|
|
57
|
+
zrender: '4.3.1'
|
|
58
58
|
};
|
|
59
59
|
|
|
60
60
|
var TEST_FRAME_REMAIN_TIME = 1;
|
|
@@ -473,7 +473,7 @@ echartsProto.getRenderedCanvas = function (opts) {
|
|
|
473
473
|
* Get svg data url
|
|
474
474
|
* @return {string}
|
|
475
475
|
*/
|
|
476
|
-
echartsProto.
|
|
476
|
+
echartsProto.getSvgDataURL = function () {
|
|
477
477
|
if (!env.svgSupported) {
|
|
478
478
|
return;
|
|
479
479
|
}
|
|
@@ -485,7 +485,7 @@ echartsProto.getSvgDataUrl = function () {
|
|
|
485
485
|
el.stopAnimation(true);
|
|
486
486
|
});
|
|
487
487
|
|
|
488
|
-
return zr.painter.
|
|
488
|
+
return zr.painter.toDataURL();
|
|
489
489
|
};
|
|
490
490
|
|
|
491
491
|
/**
|
|
@@ -521,7 +521,7 @@ echartsProto.getDataURL = function (opts) {
|
|
|
521
521
|
});
|
|
522
522
|
|
|
523
523
|
var url = this._zr.painter.getType() === 'svg'
|
|
524
|
-
? this.
|
|
524
|
+
? this.getSvgDataURL()
|
|
525
525
|
: this.getRenderedCanvas(opts).toDataURL(
|
|
526
526
|
'image/' + (opts && opts.type || 'png')
|
|
527
527
|
);
|
|
@@ -550,6 +550,7 @@ echartsProto.getConnectedDataURL = function (opts) {
|
|
|
550
550
|
if (!env.canvasSupported) {
|
|
551
551
|
return;
|
|
552
552
|
}
|
|
553
|
+
var isSvg = opts.type === 'svg';
|
|
553
554
|
var groupId = this.group;
|
|
554
555
|
var mathMin = Math.min;
|
|
555
556
|
var mathMax = Math.max;
|
|
@@ -564,9 +565,9 @@ echartsProto.getConnectedDataURL = function (opts) {
|
|
|
564
565
|
|
|
565
566
|
zrUtil.each(instances, function (chart, id) {
|
|
566
567
|
if (chart.group === groupId) {
|
|
567
|
-
var canvas =
|
|
568
|
-
|
|
569
|
-
|
|
568
|
+
var canvas = isSvg
|
|
569
|
+
? chart.getZr().painter.getSvgDom().innerHTML
|
|
570
|
+
: chart.getRenderedCanvas(zrUtil.clone(opts));
|
|
570
571
|
var boundingRect = chart.getDom().getBoundingClientRect();
|
|
571
572
|
left = mathMin(boundingRect.left, left);
|
|
572
573
|
top = mathMin(boundingRect.top, top);
|
|
@@ -587,38 +588,61 @@ echartsProto.getConnectedDataURL = function (opts) {
|
|
|
587
588
|
var width = right - left;
|
|
588
589
|
var height = bottom - top;
|
|
589
590
|
var targetCanvas = zrUtil.createCanvas();
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
591
|
+
var zr = zrender.init(targetCanvas, {
|
|
592
|
+
renderer: isSvg ? 'svg' : 'canvas'
|
|
593
|
+
});
|
|
594
|
+
zr.resize({
|
|
595
|
+
width: width,
|
|
596
|
+
height: height
|
|
597
|
+
});
|
|
598
|
+
|
|
599
|
+
if (isSvg) {
|
|
600
|
+
var content = '';
|
|
601
|
+
each(canvasList, function (item) {
|
|
602
|
+
var x = item.left - left;
|
|
603
|
+
var y = item.top - top;
|
|
604
|
+
content += '<g transform="translate(' + x + ','
|
|
605
|
+
+ y + ')">' + item.dom + '</g>';
|
|
606
|
+
});
|
|
607
|
+
zr.painter.getSvgRoot().innerHTML = content;
|
|
608
|
+
|
|
609
|
+
if (opts.connectedBackgroundColor) {
|
|
610
|
+
zr.painter.setBackgroundColor(opts.connectedBackgroundColor);
|
|
611
|
+
}
|
|
612
|
+
|
|
613
|
+
zr.refreshImmediately();
|
|
614
|
+
return zr.painter.toDataURL();
|
|
607
615
|
}
|
|
616
|
+
else {
|
|
617
|
+
// Background between the charts
|
|
618
|
+
if (opts.connectedBackgroundColor) {
|
|
619
|
+
zr.add(new graphic.Rect({
|
|
620
|
+
shape: {
|
|
621
|
+
x: 0,
|
|
622
|
+
y: 0,
|
|
623
|
+
width: width,
|
|
624
|
+
height: height
|
|
625
|
+
},
|
|
626
|
+
style: {
|
|
627
|
+
fill: opts.connectedBackgroundColor
|
|
628
|
+
}
|
|
629
|
+
}));
|
|
630
|
+
}
|
|
608
631
|
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
632
|
+
each(canvasList, function (item) {
|
|
633
|
+
var img = new graphic.Image({
|
|
634
|
+
style: {
|
|
635
|
+
x: item.left * dpr - left,
|
|
636
|
+
y: item.top * dpr - top,
|
|
637
|
+
image: item.dom
|
|
638
|
+
}
|
|
639
|
+
});
|
|
640
|
+
zr.add(img);
|
|
616
641
|
});
|
|
617
|
-
zr.add(img);
|
|
618
|
-
});
|
|
619
|
-
zr.refreshImmediately();
|
|
620
642
|
|
|
621
|
-
|
|
643
|
+
zr.refreshImmediately();
|
|
644
|
+
return targetCanvas.toDataURL('image/' + (opts && opts.type || 'png'));
|
|
645
|
+
}
|
|
622
646
|
}
|
|
623
647
|
else {
|
|
624
648
|
return this.getDataURL(opts);
|
package/src/langEN.js
CHANGED
|
@@ -65,6 +65,32 @@ export default {
|
|
|
65
65
|
lang: ['Right Click to Save Image']
|
|
66
66
|
}
|
|
67
67
|
},
|
|
68
|
+
series: {
|
|
69
|
+
typeNames: {
|
|
70
|
+
pie: 'Pie chart',
|
|
71
|
+
bar: 'Bar chart',
|
|
72
|
+
line: 'Line chart',
|
|
73
|
+
scatter: 'Scatter plot',
|
|
74
|
+
effectScatter: 'Ripple scatter plot',
|
|
75
|
+
radar: 'Radar chart',
|
|
76
|
+
tree: 'Tree',
|
|
77
|
+
treemap: 'Treemap',
|
|
78
|
+
boxplot: 'Boxplot',
|
|
79
|
+
candlestick: 'Candlestick',
|
|
80
|
+
k: 'K line chart',
|
|
81
|
+
heatmap: 'Heat map',
|
|
82
|
+
map: 'Map',
|
|
83
|
+
parallel: 'Parallel coordinate map',
|
|
84
|
+
lines: 'Line graph',
|
|
85
|
+
graph: 'Relationship graph',
|
|
86
|
+
sankey: 'Sankey diagram',
|
|
87
|
+
funnel: 'Funnel chart',
|
|
88
|
+
gauge: 'Guage',
|
|
89
|
+
pictorialBar: 'Pictorial bar',
|
|
90
|
+
themeRiver: 'Theme River Map',
|
|
91
|
+
sunburst: 'Sunburst'
|
|
92
|
+
}
|
|
93
|
+
},
|
|
68
94
|
aria: {
|
|
69
95
|
general: {
|
|
70
96
|
withTitle: 'This is a chart about "{title}"',
|
package/src/layout/barGrid.js
CHANGED
|
@@ -533,9 +533,11 @@ export var largeLayout = {
|
|
|
533
533
|
|
|
534
534
|
coord = cartesian.dataToPoint(valuePair, null, coord);
|
|
535
535
|
// Data index might not be in order, depends on `progressiveChunkMode`.
|
|
536
|
-
largeBackgroundPoints[pointsOffset] = valueAxisHorizontal
|
|
536
|
+
largeBackgroundPoints[pointsOffset] = valueAxisHorizontal
|
|
537
|
+
? coordLayout.x + coordLayout.width : coord[0];
|
|
537
538
|
largePoints[pointsOffset++] = coord[0];
|
|
538
|
-
largeBackgroundPoints[pointsOffset] = valueAxisHorizontal
|
|
539
|
+
largeBackgroundPoints[pointsOffset] = valueAxisHorizontal
|
|
540
|
+
? coord[1] : coordLayout.y + coordLayout.height;
|
|
539
541
|
largePoints[pointsOffset++] = coord[1];
|
|
540
542
|
largeDataIndices[idxOffset++] = dataIndex;
|
|
541
543
|
}
|
package/src/loading/default.js
CHANGED
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
|
|
20
20
|
import * as zrUtil from 'zrender/src/core/util';
|
|
21
21
|
import * as graphic from '../util/graphic';
|
|
22
|
+
import * as textContain from 'zrender/src/contain/text';
|
|
22
23
|
|
|
23
24
|
var PI = Math.PI;
|
|
24
25
|
|
|
@@ -34,11 +35,16 @@ export default function (api, opts) {
|
|
|
34
35
|
opts = opts || {};
|
|
35
36
|
zrUtil.defaults(opts, {
|
|
36
37
|
text: 'loading',
|
|
37
|
-
color: '#c23531',
|
|
38
38
|
textColor: '#000',
|
|
39
|
+
fontSize: '12px',
|
|
39
40
|
maskColor: 'rgba(255, 255, 255, 0.8)',
|
|
41
|
+
showSpinner: true,
|
|
42
|
+
color: '#c23531',
|
|
43
|
+
spinnerRadius: 10,
|
|
44
|
+
lineWidth: 5,
|
|
40
45
|
zlevel: 0
|
|
41
46
|
});
|
|
47
|
+
var group = new graphic.Group();
|
|
42
48
|
var mask = new graphic.Rect({
|
|
43
49
|
style: {
|
|
44
50
|
fill: opts.maskColor
|
|
@@ -46,24 +52,13 @@ export default function (api, opts) {
|
|
|
46
52
|
zlevel: opts.zlevel,
|
|
47
53
|
z: 10000
|
|
48
54
|
});
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
startAngle: -PI / 2,
|
|
52
|
-
endAngle: -PI / 2 + 0.1,
|
|
53
|
-
r: 10
|
|
54
|
-
},
|
|
55
|
-
style: {
|
|
56
|
-
stroke: opts.color,
|
|
57
|
-
lineCap: 'round',
|
|
58
|
-
lineWidth: 5
|
|
59
|
-
},
|
|
60
|
-
zlevel: opts.zlevel,
|
|
61
|
-
z: 10001
|
|
62
|
-
});
|
|
55
|
+
group.add(mask);
|
|
56
|
+
var font = opts.fontSize + ' sans-serif';
|
|
63
57
|
var labelRect = new graphic.Rect({
|
|
64
58
|
style: {
|
|
65
59
|
fill: 'none',
|
|
66
60
|
text: opts.text,
|
|
61
|
+
font: font,
|
|
67
62
|
textPosition: 'right',
|
|
68
63
|
textDistance: 10,
|
|
69
64
|
textFill: opts.textColor
|
|
@@ -71,32 +66,49 @@ export default function (api, opts) {
|
|
|
71
66
|
zlevel: opts.zlevel,
|
|
72
67
|
z: 10001
|
|
73
68
|
});
|
|
74
|
-
|
|
75
|
-
arc.animateShape(true)
|
|
76
|
-
.when(1000, {
|
|
77
|
-
endAngle: PI * 3 / 2
|
|
78
|
-
})
|
|
79
|
-
.start('circularInOut');
|
|
80
|
-
arc.animateShape(true)
|
|
81
|
-
.when(1000, {
|
|
82
|
-
startAngle: PI * 3 / 2
|
|
83
|
-
})
|
|
84
|
-
.delay(300)
|
|
85
|
-
.start('circularInOut');
|
|
86
|
-
|
|
87
|
-
var group = new graphic.Group();
|
|
88
|
-
group.add(arc);
|
|
89
69
|
group.add(labelRect);
|
|
90
|
-
|
|
70
|
+
if (opts.showSpinner) {
|
|
71
|
+
var arc = new graphic.Arc({
|
|
72
|
+
shape: {
|
|
73
|
+
startAngle: -PI / 2,
|
|
74
|
+
endAngle: -PI / 2 + 0.1,
|
|
75
|
+
r: opts.spinnerRadius
|
|
76
|
+
},
|
|
77
|
+
style: {
|
|
78
|
+
stroke: opts.color,
|
|
79
|
+
lineCap: 'round',
|
|
80
|
+
lineWidth: opts.lineWidth
|
|
81
|
+
},
|
|
82
|
+
zlevel: opts.zlevel,
|
|
83
|
+
z: 10001
|
|
84
|
+
});
|
|
85
|
+
arc.animateShape(true)
|
|
86
|
+
.when(1000, {
|
|
87
|
+
endAngle: PI * 3 / 2
|
|
88
|
+
})
|
|
89
|
+
.start('circularInOut');
|
|
90
|
+
arc.animateShape(true)
|
|
91
|
+
.when(1000, {
|
|
92
|
+
startAngle: PI * 3 / 2
|
|
93
|
+
})
|
|
94
|
+
.delay(300)
|
|
95
|
+
.start('circularInOut');
|
|
96
|
+
group.add(arc);
|
|
97
|
+
}
|
|
91
98
|
// Inject resize
|
|
92
99
|
group.resize = function () {
|
|
93
|
-
var
|
|
100
|
+
var textWidth = textContain.getWidth(opts.text, font);
|
|
101
|
+
var r = opts.showSpinner ? opts.spinnerRadius : 0;
|
|
102
|
+
// cx = (containerWidth - arcDiameter - textDistance - textWidth) / 2
|
|
103
|
+
// textDistance needs to be calculated when both animation and text exist
|
|
104
|
+
var cx = (api.getWidth() - r * 2 - (opts.showSpinner && textWidth ? 10 : 0) - textWidth) / 2
|
|
105
|
+
// only show the text
|
|
106
|
+
- (opts.showSpinner ? 0 : textWidth / 2);
|
|
94
107
|
var cy = api.getHeight() / 2;
|
|
95
|
-
arc.setShape({
|
|
108
|
+
opts.showSpinner && arc.setShape({
|
|
96
109
|
cx: cx,
|
|
97
110
|
cy: cy
|
|
98
111
|
});
|
|
99
|
-
var r = arc.shape.r;
|
|
100
112
|
labelRect.setShape({
|
|
101
113
|
x: cx - r,
|
|
102
114
|
y: cy - r,
|
package/src/model/Series.js
CHANGED
|
@@ -584,7 +584,7 @@ function dataTaskReset(context) {
|
|
|
584
584
|
|
|
585
585
|
function dataTaskProgress(param, context) {
|
|
586
586
|
// Avoid repead cloneShallow when data just created in reset.
|
|
587
|
-
if (param.end > context.outputData.count()) {
|
|
587
|
+
if (context.outputData && param.end > context.outputData.count()) {
|
|
588
588
|
context.model.getRawData().cloneShallow(context.outputData);
|
|
589
589
|
}
|
|
590
590
|
}
|
package/src/util/format.js
CHANGED
|
@@ -23,7 +23,7 @@ import * as numberUtil from './number';
|
|
|
23
23
|
// import Text from 'zrender/src/graphic/Text';
|
|
24
24
|
|
|
25
25
|
/**
|
|
26
|
-
*
|
|
26
|
+
* add commas after every three numbers
|
|
27
27
|
* @param {string|number} x
|
|
28
28
|
* @return {string}
|
|
29
29
|
*/
|
|
@@ -275,3 +275,19 @@ export function getTextRect(
|
|
|
275
275
|
text, font, textAlign, textVerticalAlign, textPadding, textLineHeight, rich, truncate
|
|
276
276
|
);
|
|
277
277
|
}
|
|
278
|
+
|
|
279
|
+
/**
|
|
280
|
+
* open new tab
|
|
281
|
+
* @param {string} link url
|
|
282
|
+
* @param {string} target blank or self
|
|
283
|
+
*/
|
|
284
|
+
export function windowOpen(link, target) {
|
|
285
|
+
if (target === '_blank' || target === 'blank') {
|
|
286
|
+
var blank = window.open();
|
|
287
|
+
blank.opener = null;
|
|
288
|
+
blank.location = link;
|
|
289
|
+
}
|
|
290
|
+
else {
|
|
291
|
+
window.open(link, target);
|
|
292
|
+
}
|
|
293
|
+
}
|
package/src/util/graphic.js
CHANGED
|
@@ -652,11 +652,13 @@ export function getHighlightDigit(highlightKey) {
|
|
|
652
652
|
* @param {Object} opt Check `opt` of `setTextStyleCommon` to find other props.
|
|
653
653
|
* @param {string|Function} [opt.defaultText]
|
|
654
654
|
* @param {module:echarts/model/Model} [opt.labelFetcher] Fetch text by
|
|
655
|
-
* `opt.labelFetcher.getFormattedLabel(opt.labelDataIndex, 'normal'/'emphasis', null, opt.labelDimIndex)`
|
|
656
|
-
* @param {
|
|
657
|
-
* `opt.textFetcher.getFormattedLabel(opt.labelDataIndex, 'normal'/'emphasis', null, opt.labelDimIndex)`
|
|
658
|
-
* @param {
|
|
659
|
-
* `opt.textFetcher.getFormattedLabel(opt.labelDataIndex, 'normal'/'emphasis', null, opt.labelDimIndex)`
|
|
655
|
+
* `opt.labelFetcher.getFormattedLabel(opt.labelDataIndex, 'normal'/'emphasis', null, opt.labelDimIndex, opt.labelProp)`
|
|
656
|
+
* @param {number} [opt.labelDataIndex] Fetch text by
|
|
657
|
+
* `opt.textFetcher.getFormattedLabel(opt.labelDataIndex, 'normal'/'emphasis', null, opt.labelDimIndex, opt.labelProp)`
|
|
658
|
+
* @param {number} [opt.labelDimIndex] Fetch text by
|
|
659
|
+
* `opt.textFetcher.getFormattedLabel(opt.labelDataIndex, 'normal'/'emphasis', null, opt.labelDimIndex, opt.labelProp)`
|
|
660
|
+
* @param {string} [opt.labelProp] Fetch text by
|
|
661
|
+
* `opt.textFetcher.getFormattedLabel(opt.labelDataIndex, 'normal'/'emphasis', null, opt.labelDimIndex, opt.labelProp)`
|
|
660
662
|
* @param {Object} [normalSpecified]
|
|
661
663
|
* @param {Object} [emphasisSpecified]
|
|
662
664
|
*/
|
|
@@ -670,6 +672,7 @@ export function setLabelStyle(
|
|
|
670
672
|
var labelFetcher = opt.labelFetcher;
|
|
671
673
|
var labelDataIndex = opt.labelDataIndex;
|
|
672
674
|
var labelDimIndex = opt.labelDimIndex;
|
|
675
|
+
var labelProp = opt.labelProp;
|
|
673
676
|
|
|
674
677
|
// This scenario, `label.normal.show = true; label.emphasis.show = false`,
|
|
675
678
|
// is not supported util someone requests.
|
|
@@ -683,7 +686,7 @@ export function setLabelStyle(
|
|
|
683
686
|
var baseText;
|
|
684
687
|
if (showNormal || showEmphasis) {
|
|
685
688
|
if (labelFetcher) {
|
|
686
|
-
baseText = labelFetcher.getFormattedLabel(labelDataIndex, 'normal', null, labelDimIndex);
|
|
689
|
+
baseText = labelFetcher.getFormattedLabel(labelDataIndex, 'normal', null, labelDimIndex, labelProp);
|
|
687
690
|
}
|
|
688
691
|
if (baseText == null) {
|
|
689
692
|
baseText = zrUtil.isFunction(opt.defaultText) ? opt.defaultText(labelDataIndex, opt) : opt.defaultText;
|
|
@@ -693,7 +696,7 @@ export function setLabelStyle(
|
|
|
693
696
|
var emphasisStyleText = showEmphasis
|
|
694
697
|
? zrUtil.retrieve2(
|
|
695
698
|
labelFetcher
|
|
696
|
-
? labelFetcher.getFormattedLabel(labelDataIndex, 'emphasis', null, labelDimIndex)
|
|
699
|
+
? labelFetcher.getFormattedLabel(labelDataIndex, 'emphasis', null, labelDimIndex, labelProp)
|
|
697
700
|
: null,
|
|
698
701
|
baseText
|
|
699
702
|
)
|
package/src/visual/symbol.js
CHANGED
|
@@ -33,12 +33,15 @@ export default function (seriesType, defaultSymbolType, legendSymbol) {
|
|
|
33
33
|
var symbolType = seriesModel.get('symbol');
|
|
34
34
|
var symbolSize = seriesModel.get('symbolSize');
|
|
35
35
|
var keepAspect = seriesModel.get('symbolKeepAspect');
|
|
36
|
+
var symbolRotate = seriesModel.get('symbolRotate');
|
|
36
37
|
|
|
37
38
|
var hasSymbolTypeCallback = isFunction(symbolType);
|
|
38
39
|
var hasSymbolSizeCallback = isFunction(symbolSize);
|
|
39
|
-
var
|
|
40
|
+
var hasSymbolRotateCallback = isFunction(symbolRotate);
|
|
41
|
+
var hasCallback = hasSymbolTypeCallback || hasSymbolSizeCallback || hasSymbolRotateCallback;
|
|
40
42
|
var seriesSymbol = (!hasSymbolTypeCallback && symbolType) ? symbolType : defaultSymbolType;
|
|
41
43
|
var seriesSymbolSize = !hasSymbolSizeCallback ? symbolSize : null;
|
|
44
|
+
var seriesSymbolRotate = !hasSymbolRotateCallback ? seriesSymbolRotate : null;
|
|
42
45
|
|
|
43
46
|
data.setVisual({
|
|
44
47
|
legendSymbol: legendSymbol || seriesSymbol,
|
|
@@ -48,7 +51,8 @@ export default function (seriesType, defaultSymbolType, legendSymbol) {
|
|
|
48
51
|
// some cases but generally it is not recommanded.
|
|
49
52
|
symbol: seriesSymbol,
|
|
50
53
|
symbolSize: seriesSymbolSize,
|
|
51
|
-
symbolKeepAspect: keepAspect
|
|
54
|
+
symbolKeepAspect: keepAspect,
|
|
55
|
+
symbolRotate: symbolRotate
|
|
52
56
|
});
|
|
53
57
|
|
|
54
58
|
// Only visible series has each data be visual encoded
|
|
@@ -62,12 +66,14 @@ export default function (seriesType, defaultSymbolType, legendSymbol) {
|
|
|
62
66
|
var params = seriesModel.getDataParams(idx);
|
|
63
67
|
hasSymbolTypeCallback && data.setItemVisual(idx, 'symbol', symbolType(rawValue, params));
|
|
64
68
|
hasSymbolSizeCallback && data.setItemVisual(idx, 'symbolSize', symbolSize(rawValue, params));
|
|
69
|
+
hasSymbolRotateCallback && data.setItemVisual(idx, 'symbolRotate', symbolRotate(rawValue, params));
|
|
65
70
|
}
|
|
66
71
|
|
|
67
72
|
if (data.hasItemOption) {
|
|
68
73
|
var itemModel = data.getItemModel(idx);
|
|
69
74
|
var itemSymbolType = itemModel.getShallow('symbol', true);
|
|
70
75
|
var itemSymbolSize = itemModel.getShallow('symbolSize', true);
|
|
76
|
+
var itemSymbolRotate = itemModel.getShallow('symbolRotate', true);
|
|
71
77
|
var itemSymbolKeepAspect = itemModel.getShallow('symbolKeepAspect', true);
|
|
72
78
|
|
|
73
79
|
// If has item symbol
|
|
@@ -78,6 +84,9 @@ export default function (seriesType, defaultSymbolType, legendSymbol) {
|
|
|
78
84
|
// PENDING Transform symbolSize ?
|
|
79
85
|
data.setItemVisual(idx, 'symbolSize', itemSymbolSize);
|
|
80
86
|
}
|
|
87
|
+
if (itemSymbolRotate != null) {
|
|
88
|
+
data.setItemVisual(idx, 'symbolRotate', itemSymbolRotate);
|
|
89
|
+
}
|
|
81
90
|
if (itemSymbolKeepAspect != null) {
|
|
82
91
|
data.setItemVisual(idx, 'symbolKeepAspect', itemSymbolKeepAspect);
|
|
83
92
|
}
|