301 lines
9.0 KiB
HTML
Generated
301 lines
9.0 KiB
HTML
Generated
|
|
<!--
|
|
Licensed to the Apache Software Foundation (ASF) under one
|
|
or more contributor license agreements. See the NOTICE file
|
|
distributed with this work for additional information
|
|
regarding copyright ownership. The ASF licenses this file
|
|
to you under the Apache License, Version 2.0 (the
|
|
"License"); you may not use this file except in compliance
|
|
with the License. You may obtain a copy of the License at
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
Unless required by applicable law or agreed to in writing,
|
|
software distributed under the License is distributed on an
|
|
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
KIND, either express or implied. See the License for the
|
|
specific language governing permissions and limitations
|
|
under the License.
|
|
-->
|
|
|
|
<html>
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
<script src="lib/simpleRequire.js"></script>
|
|
<script src="lib/config.js"></script>
|
|
<script src="lib/jquery.min.js"></script>
|
|
<script src="lib/facePrint.js"></script>
|
|
<script src="lib/testHelper.js"></script>
|
|
<link rel="stylesheet" href="lib/reset.css">
|
|
</head>
|
|
<body>
|
|
<style>
|
|
.test-title {
|
|
background: #146402;
|
|
color: #fff;
|
|
}
|
|
</style>
|
|
|
|
<div id="main0"></div>
|
|
<div id="main1"></div>
|
|
<div class="chart" id="b"></div>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
require(['echarts'], function (echarts) {
|
|
|
|
|
|
function makeSpecialTrendData() {
|
|
var data = {data1: []};
|
|
var base = -100;
|
|
for (var i = 0; i < 50; i++) {
|
|
if (i < 10) {
|
|
data.data1.push([i * 10, base += 197 + random(3)]);
|
|
}
|
|
else if (i < 20) {
|
|
data.data1.push([i * 10, base -= 17 + random(3)]);
|
|
}
|
|
else if (i < 30) {
|
|
data.data1.push([i * 10, base += 3 + random(3)]);
|
|
}
|
|
else if (i < 40) {
|
|
data.data1.push([i * 10, base -= 5 + random(3)]);
|
|
}
|
|
else {
|
|
data.data1.push([i * 10, base += 157 + random(3)]);
|
|
}
|
|
}
|
|
return data;
|
|
}
|
|
|
|
function random(max) {
|
|
return +(Math.random() * max).toFixed(3);
|
|
}
|
|
|
|
var option = {
|
|
tooltip: {
|
|
trigger: 'axis'
|
|
},
|
|
xAxis: [{
|
|
type: 'time',
|
|
boundaryGap: false
|
|
}],
|
|
yAxis: [{
|
|
type: 'value',
|
|
name: 'Github Star'
|
|
}],
|
|
dataZoom: [{
|
|
type: 'inside',
|
|
filterMode: 'none',
|
|
start: 5,
|
|
end: 40
|
|
}, {
|
|
type: 'slider',
|
|
filterMode: 'none',
|
|
start: 5,
|
|
end: 40
|
|
}],
|
|
series: [{
|
|
type: 'line',
|
|
name: 'Star',
|
|
hoverAnimation: false,
|
|
symbolSize: 25,
|
|
sampling: 'average',
|
|
// smooth: true,
|
|
// symbol: 'none',
|
|
data: makeSpecialTrendData().data1
|
|
}]
|
|
};
|
|
|
|
chart = myChart = testHelper.create(echarts, 'main0', {
|
|
title: 'Clips line and symbols (dataZoom.filterMode: "none")',
|
|
option: option
|
|
});
|
|
});
|
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
require(['echarts'], function (echarts) {
|
|
option = {
|
|
tooltip: {
|
|
trigger: 'axis'
|
|
},
|
|
legend: {
|
|
},
|
|
xAxis: {
|
|
type: 'category',
|
|
boundaryGap: false,
|
|
data: ['first', 'middle', 'last']
|
|
},
|
|
yAxis: {
|
|
type: 'value'
|
|
},
|
|
series: [
|
|
{
|
|
name:'邮件营销',
|
|
type:'line',
|
|
stack: '总量',
|
|
symbolSize: 20,
|
|
data:[120, 132, 101]
|
|
},
|
|
// {
|
|
// name:'联盟广告',
|
|
// type:'line',
|
|
// stack: '总量',
|
|
// symbolSize: 20,
|
|
// data:[220, 182, 191]
|
|
// }
|
|
]
|
|
};
|
|
|
|
chart = myChart = testHelper.create(echarts, 'main1', {
|
|
title: 'The first and last symbols (on the edge) should be displayed (test with 1000px).',
|
|
option: option
|
|
});
|
|
|
|
});
|
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
require(['echarts'], function (echarts) {
|
|
|
|
var gridLeft = 50;
|
|
var gridRight = 20;
|
|
var option = {
|
|
tooltip : {
|
|
},
|
|
legend: {
|
|
},
|
|
dataZoom: [{
|
|
}, {
|
|
type: 'inside'
|
|
}],
|
|
grid: {
|
|
id: 'cartesian',
|
|
left: gridLeft,
|
|
right: gridRight
|
|
},
|
|
xAxis: {
|
|
min: 500,
|
|
max: 2000
|
|
},
|
|
yAxis: {
|
|
min: 0,
|
|
max: 200
|
|
},
|
|
series: [
|
|
{
|
|
type:'line',
|
|
symbolSize: 20,
|
|
encode: {
|
|
tooltip: [0, 1]
|
|
},
|
|
data:[{
|
|
value: [2000, 100],
|
|
itemStyle: {
|
|
color: 'red'
|
|
}
|
|
}, {
|
|
value: [1000, 200],
|
|
itemStyle: {
|
|
color: 'red'
|
|
}
|
|
}, {
|
|
value: [500, 0],
|
|
itemStyle: {
|
|
color: 'red'
|
|
}
|
|
}, {
|
|
value: [2001, 100],
|
|
itemStyle: {
|
|
color: 'green'
|
|
}
|
|
}]
|
|
}
|
|
]
|
|
};
|
|
|
|
var chart = testHelper.create(echarts, 'b', {
|
|
title: [
|
|
'Three red symbol on grid edge should always be displayed',
|
|
'One green symbol out of the grid should not be displayed',
|
|
'(Click the button to start resize.)'
|
|
],
|
|
option: option,
|
|
button: {
|
|
text: 'Start Resize',
|
|
onclick: startResize
|
|
},
|
|
info: {
|
|
xAxis: option.xAxis,
|
|
yAxis: option.yAxis
|
|
}
|
|
});
|
|
|
|
var timer;
|
|
|
|
function startResize() {
|
|
timer && clearInterval(timer);
|
|
|
|
var delta = 3.3;
|
|
chart && (timer = setInterval(function () {
|
|
var width = chart.getWidth();
|
|
if (
|
|
(delta > 0 && gridRight > width - gridLeft - 10)
|
|
|| (delta < 0 && gridRight < 10)
|
|
) {
|
|
delta = -delta;
|
|
}
|
|
|
|
gridRight += delta;
|
|
|
|
chart.setOption({
|
|
animation: false,
|
|
grid: {
|
|
id: 'cartesian',
|
|
right: gridRight
|
|
}
|
|
});
|
|
}, 50));
|
|
}
|
|
});
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</body>
|
|
</html> |