-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
151 lines (150 loc) · 5.75 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no">
<link rel="stylesheet" href="wild.min.css"/>
<link rel="stylesheet" href="css/styles/index.css"/>
<link rel="stylesheet" href="css/timeline.css"/>
<title>Timeline</title>
<style>
.timeline-module > div{
top:50%;
}
</style>
</head>
<body>
<div class="container">
<div class="timeline-wrap charts-wrap" id="charts"></div>
<div class="timeline-wrap timeline">
<div class="timeline-module" id="timeline"></div>
</div>
</div>
<script src="echarts-2.2.7/echarts-all.js"></script>
<script src="timeline.js"></script>
<script>
window.onload = function () {
var timeLine = Timeline.init({
renderTo: 'timeline',
section: [2012, 2015],
slider: {
location: ['2012-05', '2012-09']
},
slidersArea: {
show: true
}
});
var dataAll = {};
var base = +new Date(2012, 0, 0);
var oneDay = 24 * 3600 * 1000;
for (var i = 1; i < 800; i++) {
var now = new Date(base += oneDay);
var month = now.getMonth() + 1;
var year = now.getFullYear();
var day = now.getDate();
if(month < 10){
month = '0' + month;
}
if(day < 10){
day = '0' + day;
}
var time = [year,month,day].join('-');
if(1<= i <= 200){
if(i&2 == 0){
dataAll[time] = [10+parseInt(Math.random()*100),10+parseInt(Math.random()*10),10+parseInt(Math.random()*600),10+parseInt(Math.random()*800),10+parseInt(Math.random()*200),10+parseInt(Math.random()*400)];
}else{
dataAll[time] = [10+parseInt(Math.random()*900),10+parseInt(Math.random()*10),10+parseInt(Math.random()*600),10+parseInt(Math.random()*800),10+parseInt(Math.random()*200),10+parseInt(Math.random()*400)];
}
}
if(200< i <= 400 ){
if(i&2 == 0){
dataAll[time] = [10+parseInt(Math.random()*100),10+parseInt(Math.random()*10),10+parseInt(Math.random()*600),10+parseInt(Math.random()*800),10+parseInt(Math.random()*200),10+parseInt(Math.random()*400)];
}else{
dataAll[time] = [10+parseInt(Math.random()*900),10+parseInt(Math.random()*10),10+parseInt(Math.random()*600),10+parseInt(Math.random()*800),10+parseInt(Math.random()*200),10+parseInt(Math.random()*400)];
}
}
if(400< i <= 800 ){
if(i&2 == 0){
dataAll[time] = [10+parseInt(Math.random()*100),10+parseInt(Math.random()*10),10+parseInt(Math.random()*600),10+parseInt(Math.random()*800),10+parseInt(Math.random()*200),10+parseInt(Math.random()*400)];
}else{
dataAll[time] = [10+parseInt(Math.random()*900),10+parseInt(Math.random()*10),10+parseInt(Math.random()*600),10+parseInt(Math.random()*800),10+parseInt(Math.random()*200),10+parseInt(Math.random()*400)];
}
}
}
var charts = echarts.init(document.getElementById('charts'));
var option = {
title: {
text: '深圳月最低生活费组成(单位:元)',
subtext: 'From ExcelHome',
sublink: 'http://e.weibo.com/1341556070/AjQH99che'
},
tooltip : {
trigger: 'axis',
axisPointer : { // 坐标轴指示器,坐标轴触发有效
type : 'shadow' // 默认为直线,可选为:'line' | 'shadow'
},
formatter: function (params) {
var tar = params[1];
return tar.name + '<br/>' + tar.seriesName + ' : ' + tar.value;
}
},
grid: {
left: '3%',
right: '4%',
bottom: '3%',
containLabel: true
},
xAxis: {
type : 'category',
splitLine: {show:false},
data : ['总费用','房租','水电费','交通费','伙食费','日用品数']
},
yAxis: {
type : 'value'
},
series: [
{
name: '辅助',
type: 'bar',
stack: '总量',
itemStyle: {
normal: {
barBorderColor: 'rgba(0,0,0,0)',
color: 'rgba(0,0,0,0)'
},
emphasis: {
barBorderColor: 'rgba(0,0,0,0)',
color: 'rgba(0,0,0,0)'
}
},
data: [0, 1700, 1400, 1200, 300, 0]
},
{
name: '生活费',
type: 'bar',
stack: '总量',
label: {
normal: {
show: true,
position: 'inside'
}
},
data:[2900, 1200, 300, 200, 900, 300]
}
]
};
charts.setOption(option);
timeLine.drag = function (data) {
charts.setOption({
series:[
{
data:dataAll[data]
}
]
});
}
console.log(timeLine)
}
</script>
</body>
</html>