提交 d775fadb 编写于 作者: L lang

Update examples

上级 66a28420
......@@ -9,12 +9,19 @@
html,
body,
#main,
#main2 {
width: 100%;
height: 300px;
#main2,
#main3 {
width: 90%;
height: 200px;
margin: 0;
padding: 0;
}
#main2 {
width: 75%;
}
#main3 {
width: 50%;
}
#middle {
text-align: center;
padding: 10px;
......@@ -26,6 +33,7 @@
上面是降水量,下面是流量。这是两个echarts实例。
</div>
<div id="main2"></div>
<div id="main3"></div>
<script>
......@@ -43,8 +51,9 @@
], function (data, echarts) {
var chart1 = createChart1(data, echarts);
var chart2 = createChart2(data, echarts);
var chart3 = createChart3(data, echarts);
echarts.connect([chart1, chart2]);
echarts.connect([chart1, chart2, chart3]);
// chart1.on('dataZoom', function (payload) {
// chart2.dispatchAction({
......@@ -81,7 +90,11 @@
grid: [
{
show: true,
borderWidth: 0
borderWidth: 0,
left: 0,
right: 0,
top: 0,
bottom: 0
}
],
toolbox: {
......@@ -158,7 +171,86 @@
grid: [
{
show: true,
borderWidth: 0
borderWidth: 0,
left: 0,
right: 0,
top: 0,
bottom: 0
}
],
xAxis: [
{
type: 'category',
boundaryGap: true,
axisLabel: {show: true},
splitLine: {show: false},
axisLine: {
show: true,
},
data: data.category
}
],
yAxis: [
{
boundaryGap: false,
position: 'right',
inverse: true,
axisLabel: {
textStyle: {
color: '#666'
}
},
axisLine: {
lineStyle: {
color: '#666'
}
}
}
],
series: [
{
name: '流量',
type: 'line',
data: data.flow,
itemStyle: {
normal: {
areaStyle: {}
}
}
}
],
dataZoom: [
{
type: 'inside',
start: 30,
end: 40
}
]
});
return chart;
}
function createChart3(data, echarts) {
var chart = echarts.init(document.getElementById('main3'), null, {
renderer: 'canvas'
});
chart.setOption({
tooltip: {
trigger: 'axis',
},
legend: {
data: ['流量']
},
grid: [
{
show: true,
borderWidth: 0,
left: 0,
right: 0,
top: 0,
bottom: 0
}
],
xAxis: [
......
......@@ -47,7 +47,11 @@
node.itemStyle = null;
node.symbolSize = 10;
node.value = node.symbolSize;
node.label.normal.show = node.symbolSize > 30;
node.label = {
normal: {
show: node.symbolSize > 30
}
};
node.category = node.attributes['modularity_class'];
node.x = node.y = null;
});
......
......@@ -48,7 +48,6 @@
graph.nodes.forEach(function (node) {
delete node.itemStyle;
node.value = node.symbolSize;
// node.label.normal.show = node.symbolSize > 30;
node.label = {
normal: {
show: node.symbolSize > 30
......
<html>
<head>
<meta charset="utf-8">
<script src="esl.js"></script>
<script src="config.js"></script>
<meta name="viewport" content="width=device-width, initial-scale=1" />
</head>
<body>
<style>
html, body, #main {
width: 100%;
height: 100%;
margin: 0;
}
</style>
<div id="timing"></div>
<script>
require([
'echarts',
'echarts/chart/bar',
'echarts/chart/line',
'echarts/component/legend',
'echarts/component/grid',
'echarts/component/dataZoom',
'echarts/component/tooltip'
], function (echarts) {
var myChart;
var lineCount = 2;
var pointCount = 10000;
var chartCount = 5;
var option = {
tooltip : {
trigger: 'axis',
showContent: false,
axisPointer: {
animation: false
}
},
legend: {
data:[]
},
dataZoom: [{
show: true,
realtime: true,
// showDataShadow: false,
start: 50,
end: 60
}],
xAxis : [
{
type : 'time'
}
],
yAxis : [
{
type : 'value'
}
],
series: [],
animation: false
};
var lineStyle = {
normal: {
width: 2,
opacity: 1
}
};
var date = [];
var oneDay = 24 * 3600 * 1000;
var base = +new Date(1897, 9, 3);
for (var j = 0; j < pointCount; j++) {
var now = new Date(base += oneDay);
date.push([now.getFullYear(), now.getMonth() + 1, now.getDate()].join('-'));
}
for (var i = 0; i < lineCount; i++) {
var y = Math.random() * 1000;
var values = [];
for (var j = 0; j < pointCount; j++) {
y += Math.round(10 + Math.random() * (-10 - 10));
values.push(
[
date[j],
// Math.random() < 0.1 ? '-' : y
y
]
);
}
option.legend.data.push( 'line' + i );
option.series.push({
name: 'line' + i,
type: 'line',
sampling: 'average',
hoverAnimation: false,
showSymbol: false,
data: values,
lineStyle: lineStyle
});
}
function refresh(isBtnRefresh){
var start = new Date();
for( var n = 0; n < chartCount; n++ ) {
var el = document.createElement('div');
el.innerHTML = '<h1>'+n+'</h1><div id="chart'+n+'" style="width: 860px; height: 320px"></div>';
document.body.appendChild(el);
myChart = echarts.init(document.getElementById('chart'+n));
myChart.setOption(option, true);
}
var end = new Date();
document.getElementById('timing').innerHTML = 'Graphs loaded in ' + ( end - start ) + ' ms.';
};
refresh();
});
</script>
</body>
</html>
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册