apex.radial.init.js
9.86 KB
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
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
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
document.addEventListener("DOMContentLoaded", function () {
// Basic Radial Bar Chart -------> RADIAL CHART
var options_basic = {
series: [70],
chart: {
fontFamily: "inherit",
height: 350,
type: "radialBar",
},
colors: ["#615dff"],
plotOptions: {
radialBar: {
hollow: {
size: "70%",
},
dataLabels: {
value: {
color: "#a1aab2",
show: true,
},
},
},
},
labels: ["Cricket"],
};
var chart_radial_basic = new ApexCharts(
document.querySelector("#chart-radial-basic"),
options_basic
);
chart_radial_basic.render();
// Multiple Radial Bar Chart -------> RADIAL CHART
var options_multiple = {
series: [44, 55, 67, 83],
chart: {
fontFamily: "inherit",
height: 350,
type: "radialBar",
},
colors: ["#615dff", "#3dd9eb", "#ffae1f", "#fa896b"],
plotOptions: {
radialBar: {
dataLabels: {
name: {
fontSize: "22px",
},
value: {
fontSize: "16px",
color: "#a1aab2",
},
total: {
show: true,
label: "Total",
formatter: function (w) {
// By default this function returns the average of all series. The below is just an example to show the use of custom formatter function
return 249;
},
},
},
},
},
labels: ["Apples", "Oranges", "Bananas", "Berries"],
};
var chart_radial_multiple = new ApexCharts(
document.querySelector("#chart-radial-multiple"),
options_multiple
);
chart_radial_multiple.render();
// Custome circle Radial Bar Chart -------> RADIAL CHART
var options_custom_circle = {
series: [76, 67, 61, 90],
chart: {
fontFamily: "inherit",
height: 390,
type: "radialBar",
},
plotOptions: {
radialBar: {
offsetY: 0,
startAngle: 0,
endAngle: 270,
hollow: {
margin: 5,
size: "30%",
background: "transparent",
image: undefined,
},
dataLabels: {
name: {
show: false,
},
value: {
show: false,
},
},
},
},
colors: ["#615dff", "#3dd9eb", "#ffae1f", "#fa896b"],
labels: ["Vimeo", "Messenger", "Facebook", "LinkedIn"],
legend: {
show: true,
floating: true,
fontSize: "16px",
position: "left",
offsetX: 80,
offsetY: 15,
labels: {
useSeriesColors: true,
},
markers: {
size: 0,
},
formatter: function (seriesName, opts) {
return seriesName + ": " + opts.w.globals.series[opts.seriesIndex];
},
itemMargin: {
vertical: 3,
},
},
responsive: [{
breakpoint: 480,
options: {
legend: {
show: false,
},
},
},],
};
var chart_radial_custom_circle = new ApexCharts(
document.querySelector("#chart-radial-circle"),
options_custom_circle
);
chart_radial_custom_circle.render();
// Stroked Gauge Radial Bar Chart -------> RADIAL CHART
var options_gradient = {
series: [75],
chart: {
fontFamily: "inherit",
height: 350,
type: "radialBar",
toolbar: {
show: false,
},
},
plotOptions: {
radialBar: {
startAngle: -135,
endAngle: 225,
hollow: {
margin: 0,
size: "70%",
background: "#fff",
image: undefined,
imageOffsetX: 0,
imageOffsetY: 0,
position: "front",
dropShadow: {
enabled: true,
top: 3,
left: 0,
blur: 4,
opacity: 0.24,
},
},
track: {
background: "#fff",
strokeWidth: "67%",
margin: 0, // margin is in pixels
dropShadow: {
enabled: true,
top: -3,
left: 0,
blur: 4,
opacity: 0.35,
},
},
dataLabels: {
show: true,
name: {
offsetY: -10,
show: true,
color: "#615dff",
fontSize: "17px",
},
value: {
formatter: function (val) {
return parseInt(val);
},
color: "#6610f2",
fontSize: "36px",
show: true,
},
},
},
},
fill: {
type: "gradient",
gradient: {
shade: "dark",
type: "horizontal",
shadeIntensity: 0.5,
gradientToColors: ["#615dff"],
inverseColors: true,
opacityFrom: 1,
opacityTo: 1,
stops: [0, 100],
},
},
stroke: {
lineCap: "round",
},
labels: ["Percent"],
};
var chart_radial_gradient = new ApexCharts(
document.querySelector("#chart-radial-gradient"),
options_gradient
);
chart_radial_gradient.render();
// Stroked Gauge Radial Bar Chart -------> RADIAL CHART
var options_strocked = {
series: [67],
chart: {
fontFamily: "inherit",
height: 350,
type: "radialBar",
offsetY: -10,
},
colors: ["#615dff"],
plotOptions: {
radialBar: {
startAngle: -135,
endAngle: 135,
dataLabels: {
name: {
fontSize: "16px",
color: undefined,
offsetY: 120,
},
value: {
offsetY: 76,
fontSize: "22px",
color: "#a1aab2",
formatter: function (val) {
return val + "%";
},
},
},
},
},
fill: {
type: "gradient",
gradient: {
shade: "dark",
shadeIntensity: 0.15,
inverseColors: false,
opacityFrom: 1,
opacityTo: 1,
stops: [0, 50, 65, 91],
},
},
stroke: {
dashArray: 4,
},
labels: ["Median Ratio"],
};
var chart_radial_strocked = new ApexCharts(
document.querySelector("#chart-radial-stroked-gauge"),
options_strocked
);
chart_radial_strocked.render();
// Semi Circle Radial Bar Chart -------> RADIAL CHART
var options_semi_circle = {
series: [76],
chart: {
fontFamily: "inherit",
type: "radialBar",
offsetY: -20,
width: 400,
height: 300,
sparkline: {
enabled: true,
},
},
plotOptions: {
radialBar: {
startAngle: -90,
endAngle: 90,
track: {
background: "#615dff",
strokeWidth: "97%",
margin: 5, // margin is in pixels
dropShadow: {
enabled: true,
top: 2,
left: 0,
color: "#999",
opacity: 1,
blur: 2,
},
},
dataLabels: {
name: {
show: false,
},
value: {
offsetY: -2,
fontSize: "22px",
color: "#a1aab2",
},
},
},
},
grid: {
padding: {
top: -10,
},
},
fill: {
type: "gradient",
gradient: {
color: "#6610f2",
shade: "light",
shadeIntensity: 0.4,
inverseColors: false,
opacityFrom: 1,
opacityTo: 1,
stops: [0, 50, 53, 91],
},
},
labels: ["Average Results"],
};
var chart_radial_semi_circle = new ApexCharts(
document.querySelector("#chart-radial-semi-circle"),
options_semi_circle
);
chart_radial_semi_circle.render();
});