Skip to content

Commit

Permalink
tweak cases and code check.
Browse files Browse the repository at this point in the history
  • Loading branch information
100pah committed Apr 22, 2018
1 parent 157e961 commit 66f88dd
Show file tree
Hide file tree
Showing 8 changed files with 118 additions and 126 deletions.
2 changes: 1 addition & 1 deletion .jshintrc-dist
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"bitwise": false,
"camelcase": true,
"camelcase": false,
"curly": true,
"eqeqeq": false,
"forin": false,
Expand Down
2 changes: 2 additions & 0 deletions src/component/toolbox/feature/DataZoom.js
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,8 @@ echarts.registerPreprocessor(function (option) {

if (toolboxOpt && toolboxOpt.feature) {
var dataZoomOpt = toolboxOpt.feature.dataZoom;
// FIXME: If add dataZoom when setOption in merge mode,
// no axis info to be added. See `test/dataZoom-extreme.html`
addForAxis('xAxis', dataZoomOpt);
addForAxis('yAxis', dataZoomOpt);
}
Expand Down
2 changes: 1 addition & 1 deletion src/stream/Scheduler.js
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,7 @@ function makeSeriesTaskProgress(resetDefineIdx) {
else if (resetDefine && resetDefine.progress) {
resetDefine.progress(params, data);
}
}
};
}

function seriesTaskCount(context) {
Expand Down
6 changes: 3 additions & 3 deletions src/util/format.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,14 @@ var replaceMap = {
'<': '&lt;',
'>': '&gt;',
'"': '&quot;',
'\'': '&#39;',
'\'': '&#39;'
};

export function encodeHTML(source) {
return source == null
? ''
: (source + '').replace(replaceReg, function (str, char) {
return replaceMap[char];
: (source + '').replace(replaceReg, function (str, c) {
return replaceMap[c];
});
}

Expand Down
2 changes: 1 addition & 1 deletion test/custom-bmap-polygon.html
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,7 @@
var myChart = echarts.init(document.getElementById('main'));

myChart.setOption({
backgroundColor: '#404a59',
// backgroundColor: '#404a59',
title: {
text: '全国主要城市空气质量',
subtext: 'data from PM25.in',
Expand Down
193 changes: 89 additions & 104 deletions test/custom-children-remove.html
Original file line number Diff line number Diff line change
Expand Up @@ -42,115 +42,100 @@

require([
'echarts'
// 'echarts/chart/line',
// 'echarts/chart/bar',
// 'echarts/chart/pie',
// 'echarts/chart/scatter',
// 'echarts/chart/custom',
// 'echarts/chart/parallel',
// 'echarts/chart/radar',
// 'echarts/component/grid',
// 'echarts/component/polar',
// 'echarts/component/geo',
// 'echarts/component/singleAxis',
// 'echarts/component/legend',
// 'echarts/component/tooltip',
// 'echarts/component/toolbox',
// 'echarts/component/visualMap',
// 'echarts/component/dataZoom'
], function (ec) {
echarts = ec;
chart = myChart = echarts.init(document.getElementById('main'));

var data = [
{name:'广州', value: 50},
{name:'深圳', value: 72},
{name:'珠海', value: 30},
{name:'佛山', value: 38},
{name:'杭州', value: 42},
{name:'舟山', value: 32},
{name:'宁波', value: 52}
];


option = {
tooltip : {
trigger: 'item'
},
legend: {
data:['广州','深圳','珠海','佛山','杭州','舟山','宁波'],
top: 0,
left: 'center'
},
xAxis : [
{
type : 'category',
data : [0],
axisTick: {show: false},
axisLabel: {show: false}
},
],
yAxis : [
{
type : 'value'
}
],
series : echarts.util.map(data, function (item) {
return {
name: item.name,
type: 'bar',
label: {
normal: {
show: true,
position: 'bottom',
formatter: function (param) {
return param.seriesName;
}
var data = [
{name:'广州', value: 50},
{name:'深圳', value: 72},
{name:'珠海', value: 30},
{name:'佛山', value: 38},
{name:'杭州', value: 42},
{name:'舟山', value: 32},
{name:'宁波', value: 52}
];


option = {
tooltip : {
trigger: 'item'
},
legend: {
data:['广州','深圳','珠海','佛山','杭州','舟山','宁波'],
top: 0,
left: 'center'
},
xAxis : [
{
type : 'category',
data : [0],
axisTick: {show: false},
axisLabel: {show: false}
},
],
yAxis : [
{
type : 'value'
}
],
series : echarts.util.map(data, function (item) {
return {
name: item.name,
type: 'bar',
label: {
normal: {
show: true,
position: 'bottom',
formatter: function (param) {
return param.seriesName;
}
}
},
data: [item.value]
}
}).concat([{
type: 'custom',
renderItem: renderProvinceName,
data: [0]
}])
};

function renderProvinceName(param, api) {
var currentSeriesIndices = api.currentSeriesIndices();
currentSeriesIndices.pop(); // remove custom series;

var barLayout = api.barLayout({
barGap: '30%', barCategoryGap: '20%', count: currentSeriesIndices.length
});

var nameTexts = echarts.util.map(currentSeriesIndices, function (serIdx, index) {
var point = api.coord([0, 0]);
point[0] += barLayout[index].offsetCenter;
point[1] = api.getHeight() - 20;

return {
position: point,
name: serIdx,
type: 'circle',
shape: {
cx: 0, cy: 0, r: 10
},
style: {
text: serIdx,
fill: '#333',
textFill: '#eee',
stroke: null
}
};
});

return {
type: 'group',
diffChildrenByName: true,
children: nameTexts
};
}
},
data: [item.value]
}
}).concat([{
type: 'custom',
renderItem: renderProvinceName,
data: [0]
}])
};

function renderProvinceName(param, api) {
var currentSeriesIndices = api.currentSeriesIndices();
currentSeriesIndices.pop(); // remove custom series;

var barLayout = api.barLayout({
barGap: '30%', barCategoryGap: '20%', count: currentSeriesIndices.length
});

var nameTexts = echarts.util.map(currentSeriesIndices, function (serIdx, index) {
var point = api.coord([0, 0]);
point[0] += barLayout[index].offsetCenter;
point[1] = api.getHeight() - 20;

return {
position: point,
name: serIdx,
type: 'circle',
shape: {
cx: 0, cy: 0, r: 10
},
style: {
text: serIdx,
fill: '#333',
stroke: null
}
};
});

return {
type: 'group',
diffChildrenByName: true,
children: nameTexts
};
}

chart.setOption(option);
});
Expand Down
2 changes: 1 addition & 1 deletion test/dataZoom-rainfall-inside.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

<h1>rainfall</h1>
<div class="chart" id="rainfall"></div>
<h1>zoom lock | Should not prevent default when mouse wheel.</h1>
<h1>zoom lock (only inside) | Should not prevent default when mouse wheel.</h1>
<div class="chart" id="zoom-lock"></div>
<h1>zoomOnMouseWheel: 'shift', moveOnMouseMove: 'alt' | Should not prevent default when mouse wheel.</h1>
<div class="chart" id="zoom-shift"></div>
Expand Down
35 changes: 20 additions & 15 deletions test/graphicRemove.html
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,13 @@
id: 'text1',
type: 'rect',
shape: {
x:0,
y:0,
x: 0,
y: 0,
width: 100,
height: 100,
},
style: {
fill: 'red',
},
style: {
fill: 'red'
}
}
};
Expand All @@ -82,20 +82,25 @@
// });
// 删除后再添加。
myChart.setOption({
id: 'text1',
type: 'rect',
shape: {
x:0,
y:0,
width: 100,
height: 100,
},
style: {
fill: 'red',
graphic: {
id: 'text1',
type: 'rect',
shape: {
x:0,
y:0,
width: 100,
height: 100,
},
style: {
fill: 'red',
}
}
});
}, 1000);


document.getElementById('wid').innerText = window.innerWidth;

var hasRect;

window.onresize = function() {
Expand Down

0 comments on commit 66f88dd

Please sign in to comment.