Skip to content

Commit 66f88dd

Browse files
committed
tweak cases and code check.
1 parent 157e961 commit 66f88dd

8 files changed

+118
-126
lines changed

.jshintrc-dist

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"bitwise": false,
3-
"camelcase": true,
3+
"camelcase": false,
44
"curly": true,
55
"eqeqeq": false,
66
"forin": false,

src/component/toolbox/feature/DataZoom.js

+2
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,8 @@ echarts.registerPreprocessor(function (option) {
251251

252252
if (toolboxOpt && toolboxOpt.feature) {
253253
var dataZoomOpt = toolboxOpt.feature.dataZoom;
254+
// FIXME: If add dataZoom when setOption in merge mode,
255+
// no axis info to be added. See `test/dataZoom-extreme.html`
254256
addForAxis('xAxis', dataZoomOpt);
255257
addForAxis('yAxis', dataZoomOpt);
256258
}

src/stream/Scheduler.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -466,7 +466,7 @@ function makeSeriesTaskProgress(resetDefineIdx) {
466466
else if (resetDefine && resetDefine.progress) {
467467
resetDefine.progress(params, data);
468468
}
469-
}
469+
};
470470
}
471471

472472
function seriesTaskCount(context) {

src/util/format.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,14 @@ var replaceMap = {
4242
'<': '&lt;',
4343
'>': '&gt;',
4444
'"': '&quot;',
45-
'\'': '&#39;',
45+
'\'': '&#39;'
4646
};
4747

4848
export function encodeHTML(source) {
4949
return source == null
5050
? ''
51-
: (source + '').replace(replaceReg, function (str, char) {
52-
return replaceMap[char];
51+
: (source + '').replace(replaceReg, function (str, c) {
52+
return replaceMap[c];
5353
});
5454
}
5555

test/custom-bmap-polygon.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -461,7 +461,7 @@
461461
var myChart = echarts.init(document.getElementById('main'));
462462

463463
myChart.setOption({
464-
backgroundColor: '#404a59',
464+
// backgroundColor: '#404a59',
465465
title: {
466466
text: '全国主要城市空气质量',
467467
subtext: 'data from PM25.in',

test/custom-children-remove.html

+89-104
Original file line numberDiff line numberDiff line change
@@ -42,115 +42,100 @@
4242

4343
require([
4444
'echarts'
45-
// 'echarts/chart/line',
46-
// 'echarts/chart/bar',
47-
// 'echarts/chart/pie',
48-
// 'echarts/chart/scatter',
49-
// 'echarts/chart/custom',
50-
// 'echarts/chart/parallel',
51-
// 'echarts/chart/radar',
52-
// 'echarts/component/grid',
53-
// 'echarts/component/polar',
54-
// 'echarts/component/geo',
55-
// 'echarts/component/singleAxis',
56-
// 'echarts/component/legend',
57-
// 'echarts/component/tooltip',
58-
// 'echarts/component/toolbox',
59-
// 'echarts/component/visualMap',
60-
// 'echarts/component/dataZoom'
6145
], function (ec) {
6246
echarts = ec;
6347
chart = myChart = echarts.init(document.getElementById('main'));
6448

65-
var data = [
66-
{name:'广州', value: 50},
67-
{name:'深圳', value: 72},
68-
{name:'珠海', value: 30},
69-
{name:'佛山', value: 38},
70-
{name:'杭州', value: 42},
71-
{name:'舟山', value: 32},
72-
{name:'宁波', value: 52}
73-
];
74-
75-
76-
option = {
77-
tooltip : {
78-
trigger: 'item'
79-
},
80-
legend: {
81-
data:['广州','深圳','珠海','佛山','杭州','舟山','宁波'],
82-
top: 0,
83-
left: 'center'
84-
},
85-
xAxis : [
86-
{
87-
type : 'category',
88-
data : [0],
89-
axisTick: {show: false},
90-
axisLabel: {show: false}
91-
},
92-
],
93-
yAxis : [
94-
{
95-
type : 'value'
96-
}
97-
],
98-
series : echarts.util.map(data, function (item) {
99-
return {
100-
name: item.name,
101-
type: 'bar',
102-
label: {
103-
normal: {
104-
show: true,
105-
position: 'bottom',
106-
formatter: function (param) {
107-
return param.seriesName;
108-
}
49+
var data = [
50+
{name:'广州', value: 50},
51+
{name:'深圳', value: 72},
52+
{name:'珠海', value: 30},
53+
{name:'佛山', value: 38},
54+
{name:'杭州', value: 42},
55+
{name:'舟山', value: 32},
56+
{name:'宁波', value: 52}
57+
];
58+
59+
60+
option = {
61+
tooltip : {
62+
trigger: 'item'
63+
},
64+
legend: {
65+
data:['广州','深圳','珠海','佛山','杭州','舟山','宁波'],
66+
top: 0,
67+
left: 'center'
68+
},
69+
xAxis : [
70+
{
71+
type : 'category',
72+
data : [0],
73+
axisTick: {show: false},
74+
axisLabel: {show: false}
75+
},
76+
],
77+
yAxis : [
78+
{
79+
type : 'value'
80+
}
81+
],
82+
series : echarts.util.map(data, function (item) {
83+
return {
84+
name: item.name,
85+
type: 'bar',
86+
label: {
87+
normal: {
88+
show: true,
89+
position: 'bottom',
90+
formatter: function (param) {
91+
return param.seriesName;
92+
}
93+
}
94+
},
95+
data: [item.value]
96+
}
97+
}).concat([{
98+
type: 'custom',
99+
renderItem: renderProvinceName,
100+
data: [0]
101+
}])
102+
};
103+
104+
function renderProvinceName(param, api) {
105+
var currentSeriesIndices = api.currentSeriesIndices();
106+
currentSeriesIndices.pop(); // remove custom series;
107+
108+
var barLayout = api.barLayout({
109+
barGap: '30%', barCategoryGap: '20%', count: currentSeriesIndices.length
110+
});
111+
112+
var nameTexts = echarts.util.map(currentSeriesIndices, function (serIdx, index) {
113+
var point = api.coord([0, 0]);
114+
point[0] += barLayout[index].offsetCenter;
115+
point[1] = api.getHeight() - 20;
116+
117+
return {
118+
position: point,
119+
name: serIdx,
120+
type: 'circle',
121+
shape: {
122+
cx: 0, cy: 0, r: 10
123+
},
124+
style: {
125+
text: serIdx,
126+
fill: '#333',
127+
textFill: '#eee',
128+
stroke: null
129+
}
130+
};
131+
});
132+
133+
return {
134+
type: 'group',
135+
diffChildrenByName: true,
136+
children: nameTexts
137+
};
109138
}
110-
},
111-
data: [item.value]
112-
}
113-
}).concat([{
114-
type: 'custom',
115-
renderItem: renderProvinceName,
116-
data: [0]
117-
}])
118-
};
119-
120-
function renderProvinceName(param, api) {
121-
var currentSeriesIndices = api.currentSeriesIndices();
122-
currentSeriesIndices.pop(); // remove custom series;
123-
124-
var barLayout = api.barLayout({
125-
barGap: '30%', barCategoryGap: '20%', count: currentSeriesIndices.length
126-
});
127-
128-
var nameTexts = echarts.util.map(currentSeriesIndices, function (serIdx, index) {
129-
var point = api.coord([0, 0]);
130-
point[0] += barLayout[index].offsetCenter;
131-
point[1] = api.getHeight() - 20;
132-
133-
return {
134-
position: point,
135-
name: serIdx,
136-
type: 'circle',
137-
shape: {
138-
cx: 0, cy: 0, r: 10
139-
},
140-
style: {
141-
text: serIdx,
142-
fill: '#333',
143-
stroke: null
144-
}
145-
};
146-
});
147-
148-
return {
149-
type: 'group',
150-
diffChildrenByName: true,
151-
children: nameTexts
152-
};
153-
}
154139

155140
chart.setOption(option);
156141
});

test/dataZoom-rainfall-inside.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525

2626
<h1>rainfall</h1>
2727
<div class="chart" id="rainfall"></div>
28-
<h1>zoom lock | Should not prevent default when mouse wheel.</h1>
28+
<h1>zoom lock (only inside) | Should not prevent default when mouse wheel.</h1>
2929
<div class="chart" id="zoom-lock"></div>
3030
<h1>zoomOnMouseWheel: 'shift', moveOnMouseMove: 'alt' | Should not prevent default when mouse wheel.</h1>
3131
<div class="chart" id="zoom-shift"></div>

test/graphicRemove.html

+20-15
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,13 @@
5151
id: 'text1',
5252
type: 'rect',
5353
shape: {
54-
x:0,
55-
y:0,
54+
x: 0,
55+
y: 0,
5656
width: 100,
5757
height: 100,
58-
},
59-
style: {
60-
fill: 'red',
58+
},
59+
style: {
60+
fill: 'red'
6161
}
6262
}
6363
};
@@ -82,20 +82,25 @@
8282
// });
8383
// 删除后再添加。
8484
myChart.setOption({
85-
id: 'text1',
86-
type: 'rect',
87-
shape: {
88-
x:0,
89-
y:0,
90-
width: 100,
91-
height: 100,
92-
},
93-
style: {
94-
fill: 'red',
85+
graphic: {
86+
id: 'text1',
87+
type: 'rect',
88+
shape: {
89+
x:0,
90+
y:0,
91+
width: 100,
92+
height: 100,
93+
},
94+
style: {
95+
fill: 'red',
96+
}
9597
}
9698
});
9799
}, 1000);
98100

101+
102+
document.getElementById('wid').innerText = window.innerWidth;
103+
99104
var hasRect;
100105

101106
window.onresize = function() {

0 commit comments

Comments
 (0)