-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathchart.peity.js
49 lines (35 loc) · 1.09 KB
/
chart.peity.js
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
$(function(){
'use strict'
// Line chart
$('.peity-line').peity('line');
// Bar charts
$('.peity-bar').peity('bar');
// Pie chart
$('.peity-pie').peity('pie');
// Donut chart
$('.peity-donut').peity('donut');
// Using data attributes
$(".data-attributes span").peity("donut")
// Evented example.
$("select").change(function() {
var text = $(this).val() + "/" + 5
$(this)
.siblings("span.graph")
.text(text)
.change()
$("#notice").text("Chart updated: " + text)
}).change()
$("span.graph").peity("pie")
// Updating charts.
var updatingChart = $(".updating-chart").peity("line", { width: "100%",height:150 })
setInterval(function() {
var random = Math.round(Math.random() * 20)
var values = updatingChart.text().split(",")
values.shift()
values.push(random)
updatingChart
.text(values.join(","))
.change()
}, 2500)
// Bar chart is already initialized found in bracket.js
});