-
Notifications
You must be signed in to change notification settings - Fork 0
/
demo2.html
141 lines (126 loc) · 3.63 KB
/
demo2.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Echarts demo2</title>
<style type="text/css">
*{
margin: 0;
padding: 0;
}
body{
font-size: 12px;
font-family: "Arial";
}
.demo{
width: 70%;
margin: 100px auto 70px;
}
.demo p{
margin-bottom: 5px;
}
#chart{
width: 100%;
}
a,a:link{
text-decoration: none;
color: #188F83;
}
</style>
</head>
<body>
<div class="demo">
<div id="chart" style="height:400px"></div>
<p>Note: Six other candidates received 1% or less. </p>
<p><a href="http://www.wsj.com/articles/donald-trump-leads-republican-presidential-pack-wsj-nbc-poll-finds-1438520400" target="_blank">Source: WSJ/NBC News poll</a></p>
<p>Poll completed July 30, 2015</p>
</div>
<script src="./build/echarts.js"></script>
<script type="text/javascript">
require.config({
paths: {
echarts: './build'
}
});
require(
[
'echarts',
'echarts/chart/bar',
],
function(ec){
var chart = ec.init(document.getElementById('chart'));
var option = {
title : {
text: 'Preference among GOP primary voters',
textStyle:{
fontFamily: 'helvetica',
fontSize: 15,
},
y : 10,
},
tooltip : {
trigger: 'item',
backgroundColor: '#fff',
borderColor: '#ccc',
borderWidth: 1.5,
formatter: function(params){
return params.value + '%';
},
textStyle : {
color : 'rgb(198,73,70)',
fontWeight: 'bolder',
fontFamily:'Arial',
},
},
grid: {
borderWidth: 0,
},
calculable : true,
xAxis : [
{
type : 'value',
splitLine: {
lineStyle : {
type : "dashed",
color : "#ccc",
width : 1,
}
},
axisLine:'none',
}
],
yAxis : [
{
type : 'category',
splitLine: 'none',
axisTick: 'none',
data : ['John Kasich','Rick Perry','Christie','Marco Rubio','Rand Paul','Huckabee','Ted Cruz','Ben Carson','Jeb Bush','Scott Walker','Donald'],
axisLabel: {
textStyle:{
fontFamily:'Arial',
fontWeight:'bolder',
},
},
},
],
series : [
{
name:'percentage',
type:'bar',
itemStyle : {
normal :{
color :"rgb(198,73,70)",
}
},
barCategoryGap: '50%',
data:[3, 3, 3, 5, 6, 6,9,10,14,15,19]
},
]
};
chart.setOption(option);
window.onresize = chart.resize;
}
);
</script>
</body>
</html>