| 1 |
google.load("visualization", "1", {packages:["corechart"]}); |
| 2 |
google.setOnLoadCallback(drawChart); |
| 3 |
|
| 4 |
function drawChart() { |
| 5 |
/* Init */ |
| 6 |
var id, |
| 7 |
rows = [], |
| 8 |
output = document.getElementById('statify_chart'), |
| 9 |
data = new google.visualization.DataTable(); |
| 10 |
|
| 11 |
/* Leer? */ |
| 12 |
if ( !output || !statify.created.length ) { |
| 13 |
return; |
| 14 |
} |
| 15 |
|
| 16 |
/* Extrahieren */ |
| 17 |
var created = statify.created.split(','), |
| 18 |
count = statify.count.split(','); |
| 19 |
|
| 20 |
/* Loopen */ |
| 21 |
for (id in created) { |
| 22 |
rows[id] = [created[id], parseInt(count[id], 10)]; |
| 23 |
} |
| 24 |
|
| 25 |
data.addColumn('string', 'Datum'); |
| 26 |
data.addColumn('number', 'Aufrufe'); |
| 27 |
data.addRows(rows); |
| 28 |
|
| 29 |
var chart = new google.visualization.AreaChart(output); |
| 30 |
|
| 31 |
chart.draw( |
| 32 |
data, |
| 33 |
{ |
| 34 |
width: parseInt(jQuery('#statify_chart').parent().width(), 10), |
| 35 |
height: 120, |
| 36 |
legend: 'none', |
| 37 |
pointSize: 6, |
| 38 |
lineWidth: 3, |
| 39 |
gridlineColor: '#ececec', |
| 40 |
colors:['#3399CC'], |
| 41 |
reverseCategories: true, |
| 42 |
backgroundColor: 'transparent', |
| 43 |
vAxis: { |
| 44 |
baselineColor: 'transparent', |
| 45 |
textPosition: 'in', |
| 46 |
textStyle: { |
| 47 |
color: '#8F8F8F', |
| 48 |
fontSize: 10 |
| 49 |
} |
| 50 |
}, |
| 51 |
hAxis: { |
| 52 |
textStyle: { |
| 53 |
color: '#3399CC', |
| 54 |
fontSize: 10 |
| 55 |
} |
| 56 |
}, |
| 57 |
chartArea: { |
| 58 |
width: "100%", |
| 59 |
height: "100%" |
| 60 |
} |
| 61 |
} |
| 62 |
); |
| 63 |
} |