Skip to content

Commit

Permalink
Update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
pissang committed Dec 29, 2015
1 parent 1dfbd90 commit 50b6d14
Show file tree
Hide file tree
Showing 41 changed files with 297 additions and 308 deletions.
8 changes: 4 additions & 4 deletions test/axes.html
Expand Up @@ -582,10 +582,10 @@
],
parallelAxis: makeParallelAxisOption(),
parallel: {
x: 40,
y: 40,
x2: 40,
y2: 40,
left: 40,
top: 40,
right: 40,
bottom: 40,
parallelAxisDefault: {
type: 'value'
}
Expand Down
1 change: 1 addition & 0 deletions test/bar.html
Expand Up @@ -65,6 +65,7 @@
};

chart.setOption({
backgroundColor: '#eee',
legend: {
borderWidth: 1,
data: [{
Expand Down
4 changes: 2 additions & 2 deletions test/bar2.html
Expand Up @@ -45,8 +45,8 @@
toolbox: {
show : true,
orient: 'vertical',
x: 'right',
y: 'center',
left: 'right',
top: 'center',
feature : {
mark : {show: true},
dataView : {show: true, readOnly: false},
Expand Down
232 changes: 117 additions & 115 deletions test/boxplot-multi.html
Expand Up @@ -37,132 +37,134 @@
renderer: 'canvas'
});

// Generate data.
data = [];
for (var seriesIndex = 0; seriesIndex < 5; seriesIndex++) {
var seriesData = [];
for (var i = 0; i < 18; i++) {
var cate = [];
for (var j = 0; j < 100; j++) {
cate.push(Math.random() * 200);
}
seriesData.push(cate);
}
data.push(prepareBoxplotData(seriesData));
}

update('horizontal');
})

function update(layout) {
function update(layout) {

var categoryAxis = {
type: 'category',
data: data[0].axisData,
boundaryGap: true,
nameGap: 30,
splitArea: {
show: true
},
axisLabel: {
formatter: 'expr {value}'
},
splitLine: {
show: false
}
};
var valueAxis = {
type: 'value',
name: 'Value',
splitArea: {
show: false
// Generate data.
data = [];
for (var seriesIndex = 0; seriesIndex < 5; seriesIndex++) {
var seriesData = [];
for (var i = 0; i < 18; i++) {
var cate = [];
for (var j = 0; j < 100; j++) {
cate.push(Math.random() * 200);
}
seriesData.push(cate);
}
data.push(prepareBoxplotData(seriesData, {
layout: layout
}));
}
};

chart.setOption({
title: [
{
text: 'Multiple Categories',
x: 'center',
var categoryAxis = {
type: 'category',
data: data[0].axisData,
boundaryGap: true,
nameGap: 30,
splitArea: {
show: true
},
axisLabel: {
formatter: 'expr {value}'
},
splitLine: {
show: false
}
],
legend: {
y: '10%',
data: ['category0', 'category1', 'category2', 'category3']
},
tooltip: {
trigger: 'item',
axisPointer: {
type: 'shadow'
};
var valueAxis = {
type: 'value',
name: 'Value',
splitArea: {
show: false
}
},
grid: {
x: '10%',
y: '20%',
x2: '10%',
y2: '15%'
},
xAxis: layout === 'horizontal' ? categoryAxis : valueAxis,
yAxis: layout === 'vertical' ? categoryAxis : valueAxis,
dataZoom: [
{
type: 'inside',
start: 0,
end: 20
};

chart.setOption({
title: [
{
text: 'Multiple Categories',
left: 'center',
}
],
legend: {
top: '10%',
data: ['category0', 'category1', 'category2', 'category3']
},
{
show: true,
height: 20,
type: 'slider',
y: '90%',
xAxisIndex: layout === 'horizontal' ? [0] : [],
yAxisIndex: layout === 'horizontal' ? [] : [0],
start: 0,
end: 20
}
],
series: [
{
name: 'category0',
type: 'boxplot',
data: data[0].boxData,
tooltip: {formatter: formatter}
tooltip: {
trigger: 'item',
axisPointer: {
type: 'shadow'
}
},
{
name: 'category1',
type: 'boxplot',
data: data[1].boxData,
tooltip: {formatter: formatter}
grid: {
left: '10%',
top: '20%',
right: '10%',
bottom: '15%'
},
{
name: 'category2',
type: 'boxplot',
data: data[2].boxData,
tooltip: {formatter: formatter}
}
]
});
}
xAxis: layout === 'horizontal' ? categoryAxis : valueAxis,
yAxis: layout === 'vertical' ? categoryAxis : valueAxis,
dataZoom: [
{
type: 'inside',
start: 0,
end: 20
},
{
show: true,
height: 20,
type: 'slider',
top: '10%',
// xAxisIndex: layout === 'horizontal' ? [0] : [],
yAxisIndex: layout === 'horizontal' ? [] : [0],
start: 0,
end: 20
}
],
series: [
{
name: 'category0',
type: 'boxplot',
data: data[0].boxData,
tooltip: {formatter: formatter}
},
{
name: 'category1',
type: 'boxplot',
data: data[1].boxData,
tooltip: {formatter: formatter}
},
{
name: 'category2',
type: 'boxplot',
data: data[2].boxData,
tooltip: {formatter: formatter}
}
]
});
}

function formatter(param) {
return [
'Experiment ' + param.name + ': ',
'upper: ' + param.data[0],
'Q1: ' + param.data[1],
'median: ' + param.data[2],
'Q3: ' + param.data[3],
'lower: ' + param.data[4]
].join('<br/>')
}
function formatter(param) {
return [
'Experiment ' + param.name + ': ',
'upper: ' + param.data[0],
'Q1: ' + param.data[1],
'median: ' + param.data[2],
'Q3: ' + param.data[3],
'lower: ' + param.data[4]
].join('<br/>')
}


var gui = new dat.GUI();
var config = {
layout: 'horizontal'
};
gui
.add(config, 'layout', ['horizontal', 'vertical'])
.onChange(update);
var gui = new dat.GUI();
var config = {
layout: 'horizontal'
};
gui
.add(config, 'layout', ['horizontal', 'vertical'])
.onChange(update);

update('vertical');
})

</script>
</body>
Expand Down
12 changes: 6 additions & 6 deletions test/boxplot.html
Expand Up @@ -79,7 +79,7 @@
title: [
{
text: 'Michelson-Morley Experiment',
x: 'center',
left: 'center',
},
{
text: 'upper: Q3 + 1.5 * IRQ \nlower: Q1 - 1.5 * IRQ',
Expand All @@ -88,8 +88,8 @@
textStyle: {
fontSize: 14
},
x: '10%',
y: '90%'
left: '10%',
top: '90%'
}
],
legend: {
Expand All @@ -102,9 +102,9 @@
}
},
grid: {
x: '10%',
x2: '10%',
y2: '15%'
left: '10%',
right: '10%',
bottom: '15%'
},
xAxis: layout === 'horizontal' ? categoryAxis : valueAxis,
yAxis: layout === 'vertical' ? categoryAxis : valueAxis,
Expand Down
6 changes: 3 additions & 3 deletions test/candlestick.html
Expand Up @@ -85,9 +85,9 @@
}
},
grid: {
x: '10%',
x2: '10%',
y2: '15%'
left: '10%',
right: '10%',
bottom: '15%'
},
xAxis: {
type: 'category',
Expand Down
18 changes: 9 additions & 9 deletions test/color-mix-aqi.html
Expand Up @@ -56,18 +56,18 @@

chart.setOption({
legend: {
y: 'top',
top: 'top',
data: ['北京', '上海', '广州'],
textStyle: {
color: '#fff',
fontSize: 20
}
},
grid: {
x: '10%',
x2: 200,
y: '15%',
y2: '10%'
left: '10%',
right: 200,
top: '15%',
bottom: '10%'
},
tooltip: {
padding: 10,
Expand Down Expand Up @@ -137,8 +137,8 @@
},
visualMap: [
{
x: 'right',
y: 'top',
left: 'right',
top: 'top',
dimension: 'z',
min: 0,
max: 250,
Expand All @@ -165,8 +165,8 @@
}
},
{
x: 'right',
y: 'bottom',
left: 'right',
top: 'bottom',
dimension: 6,
min: 0,
max: 50,
Expand Down

0 comments on commit 50b6d14

Please sign in to comment.