You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@echarts.apache.org by wa...@apache.org on 2020/07/23 10:31:05 UTC
[incubator-echarts] 01/01: fix(timeline): fix a bug which may bring
a crash of browser when using dataURI as icon.
This is an automated email from the ASF dual-hosted git repository.
wangzx pushed a commit to branch fix-timeline-control
in repository https://gitbox.apache.org/repos/asf/incubator-echarts.git
commit f3aec1ee5a6892c757c2c1789fb692b4b2cf8d41
Author: plainheart <yh...@all-my-life.cn>
AuthorDate: Thu Jul 23 18:22:17 2020 +0800
fix(timeline): fix a bug which may bring a crash of browser when using dataURI as icon.
---
src/component/timeline/SliderTimelineView.js | 11 +--
test/timeline-dynamic-series.html | 136 ++++++++++++++-------------
2 files changed, 73 insertions(+), 74 deletions(-)
diff --git a/src/component/timeline/SliderTimelineView.js b/src/component/timeline/SliderTimelineView.js
index f88c9da..71594d0 100644
--- a/src/component/timeline/SliderTimelineView.js
+++ b/src/component/timeline/SliderTimelineView.js
@@ -618,14 +618,11 @@ function getViewRect(model, api) {
}
function makeIcon(timelineModel, objPath, rect, opts) {
- var icon = graphic.makePath(
- timelineModel.get(objPath).replace(/^path:\/\//, ''),
- zrUtil.clone(opts || {}),
- new BoundingRect(rect[0], rect[1], rect[2], rect[3]),
- 'center'
+ return graphic.createIcon(
+ timelineModel.get(objPath),
+ opts || {},
+ new BoundingRect(rect[0], rect[1], rect[2], rect[3])
);
-
- return icon;
}
/**
diff --git a/test/timeline-dynamic-series.html b/test/timeline-dynamic-series.html
index 1c786ac..d36a761 100644
--- a/test/timeline-dynamic-series.html
+++ b/test/timeline-dynamic-series.html
@@ -74,72 +74,74 @@ under the License.
});
-var option = {
- baseOption: {
- timeline: {
- // y: 0,
- axisType: 'category',
- // realtime: false,
- // loop: false,
- autoPlay: false,
- // currentIndex: 2,
- playInterval: 1000,
- // controlStyle: {
- // position: 'left'
- // },
- data: [
- '2002-01-01','2003-01-01'
- ],
- label: {
- formatter : function(s) {
- return (new Date(s)).getFullYear();
- }
- }
- },
- title: {
- subtext: '数据来自国家统计局'
- },
- tooltip: {
- trigger:'axis',
- axisPointer: {
- type: 'shadow'
- }
- },
- calculable: true,
- grid: {
- top:80, bottom: 100
- },
- xAxis: {
- 'type':'category',
- 'axisLabel':{'interval':0},
- 'data':[
- '北京','\n天津','河北','\n山西'
- ],
- splitLine: {show: false}
- },
- yAxis: [
- {
- type: 'value',
- name: 'GDP(亿元)'
- }
- ],
- series: [
- ]
- },
- options: [
- {
- series: [
- {id: 'a', type: 'bar', data: [12, 33, 44, 55]}
- ]
- },
- {
- series : [
- {id: 'a', type: 'bar', data: [22, 33, 44, 55]},
- {id: 'b', type: 'bar', data: [55, 66, 77, 88]}
- ]
- }
- ]
-};
+ var option = {
+ baseOption: {
+ timeline: {
+ // y: 0,
+ axisType: 'category',
+ // realtime: false,
+ // loop: false,
+ autoPlay: false,
+ // currentIndex: 2,
+ playInterval: 1000,
+ controlStyle: {
+ //position: 'left'
+ stopIcon: 'image://data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAGpJREFUWAntlkEKwDAIBKP+/znt82xrD6FIpSSHXDpCQBeXDXOyNQoCBQEz21T1eL7QivUuj/qkO1MTwUm6R3cvPbEw6tO3kJUaH4AABCAAAQhAAAIQgEBJQET2fJxe2udZPuvLWcz/IXACuUMWMJDzUAgAAAAASUVORK5CYII=',
+ playIcon: 'path://M41.365908,29.4271388 L41.3664843,29.4265626 L26.3794329,19.1497136 L26.3747509,19.1541315 C26.0642269,18.8592621 25.6429678,18.677793 25.1786824,18.677793 C24.2236284,18.677793 23.4494433,19.4443188 23.4494433,20.3905371 C23.4494433,20.910214 23.4270417,21.9276946 23.4494433,21.9056292 L23.4494433,30.6673861 L23.4494433,39.8901629 C23.4494433,39.8977982 23.4494433,40.4825908 23.4494433,40.9444991 C23.4494433,41.8901412 24.2236284,42.6566 [...]
+ },
+ data: [
+ '2002-01-01','2003-01-01'
+ ],
+ label: {
+ formatter : function(s) {
+ return (new Date(s)).getFullYear();
+ }
+ }
+ },
+ title: {
+ subtext: '数据来自国家统计局'
+ },
+ tooltip: {
+ trigger:'axis',
+ axisPointer: {
+ type: 'shadow'
+ }
+ },
+ calculable: true,
+ grid: {
+ top:80, bottom: 100
+ },
+ xAxis: {
+ 'type':'category',
+ 'axisLabel':{'interval':0},
+ 'data':[
+ '北京','\n天津','河北','\n山西'
+ ],
+ splitLine: {show: false}
+ },
+ yAxis: [
+ {
+ type: 'value',
+ name: 'GDP(亿元)'
+ }
+ ],
+ series: [
+ ]
+ },
+ options: [
+ {
+ series: [
+ {id: 'a', type: 'bar', data: [12, 33, 44, 55]}
+ ]
+ },
+ {
+ series : [
+ {id: 'a', type: 'bar', data: [22, 33, 44, 55]},
+ {id: 'b', type: 'bar', data: [55, 66, 77, 88]}
+ ]
+ }
+ ]
+ };
chart.setOption(option);
@@ -147,4 +149,4 @@ var option = {
});
</script>
</body>
-</html>
\ No newline at end of file
+</html>
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org