An error occurred while loading the file. Please try again.
-
Rushikesh Padsala authored27ca663e
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Syncing charts</title>
<link href="../../assets/styles.css" rel="stylesheet" />
<style>
#wrapper {
padding-top: 20px;
padding-left: 10px;
padding-right: 10px;
background: #fff;
border: 1px solid #ddd;
box-shadow: 0 22px 35px -16px rgba(0, 0, 0, 0.1);
max-width: 650px;
margin: 35px auto;
}
.github-style {
clear: both;
font-weight: 400;
height: 40px;
margin-left: 6px;
}
.github-style a {
color: #0366d6;
font-size: 18px;
}
.github-style .cmeta {
display: block;
color: #777;
font-weight: 400;
}
.github-style .userimg {
float: left;
display: block;
border-radius: 3px;
}
.github-style .userdetails {
float: left;
margin-left: 10px;
}
</style>
</head>
<body>
<div id="wrapper">
<div id="chart-area">
</div>
<h5 class="github-style">
<img class="userimg" src="https://picsum.photos/200/200/?image=1031" data-hovercard-user-id="634573" class="avatar float-left mr-2"
alt="" width="38" height="38" />
<div class="userdetails">
<a class="username">coder</a>
<span class="cmeta">
<span class="commits"></span> commits
</span>
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
</div>
</h5>
<div id="chart-area2">
</div>
</div>
<script src="https://cdn.jsdelivr.net/npm/apexcharts@latest"></script>
<script src="../../assets/github-data.js"></script>
<script>
var optionsarea2 = {
chart: {
id: 'chartyear',
type: 'area',
height: 160,
background: '#F6F8FA',
toolbar: {
show: false,
autoSelected: 'pan'
},
events: {
mounted: function (chart) {
var commitsEl = document.querySelector('p span.commits');
var commits = chart.getSeriesTotalXRange(chart.w.globals.minX, chart.w.globals.maxX)
commitsEl.innerHTML = commits
},
updated: function (chart) {
var commitsEl = document.querySelector('.cmeta span.commits');
var commits = chart.getSeriesTotalXRange(chart.w.globals.minX, chart.w.globals.maxX)
commitsEl.innerHTML = commits
}
}
},
colors: ['#FF7F00'],
stroke: {
width: 0,
curve: 'smooth'
},
dataLabels: {
enabled: false
},
fill: {
opacity: 1,
type: 'solid'
},
series: [{
name: 'commits',
data: githubdata.series
}],
yaxis: {
tickAmount: 3,
labels: {
show: false
}
},
xaxis: {
type: 'datetime',
}
}
var chartarea2 = new ApexCharts(
document.querySelector("#chart-area2"),
optionsarea2
);
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
chartarea2.render();
var options = {
chart: {
height: 200,
type: 'area',
background: '#F6F8FA',
toolbar: {
autoSelected: 'selection',
},
brush: {
enabled: true,
target: 'chartyear'
},
selection: {
enabled: true,
xaxis: {
min: new Date('05 Jan 2014').getTime(),
max: new Date('04 Jan 2015').getTime()
}
},
},
colors: ['#7BD39A'],
dataLabels: {
enabled: false
},
stroke: {
width: 0,
curve: 'smooth'
},
series: [{
name: 'commits',
data: githubdata.series
}],
fill: {
opacity: 1,
type: 'solid'
},
legend: {
position: 'top',
horizontalAlign: 'left'
},
xaxis: {
type: 'datetime'
},
}
var chart = new ApexCharts(
document.querySelector("#chart-area"),
options
);
chart.render();
</script>
</body>
</html>