-
Notifications
You must be signed in to change notification settings - Fork 0
/
old_chart_json.html
51 lines (50 loc) · 1.34 KB
/
old_chart_json.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
{% for index in range(charts.__len__()) %}
var xLabels{{ index }} = {{ xlabels[index]|safe }}
var ctx{{ index }} = document.getElementById('chart{{ index+1 }}');
var data{{ index }} = {
labels: xLabels{{ index }},
datasets: [
{
label: '{{ charts[index].activityName }}',
fill: false,
lineTension: 0,
backgroundColor: "{{ chartColors[index] }}",
borderColor: "{{ chartColors[index] }}",
borderCapStyle: 'butt',
borderDash: [],
borderDashOffset: 0.0,
borderJoinStyle: 'miter',
pointBorderColor: "{{ chartColors[index] }}",
pointBackgroundColor: "#fff",
pointBorderWidth: 5,
pointHoverRadius: 5,
pointHoverBackgroundColor: "{{ chartColors[index] }}",
pointHoverBorderColor: "{{ chartColors[index] }}",
pointHoverBorderWidth: 2,
pointRadius: 1,
pointHitRadius: 10,
data: {{ data_values[index] }}
}]
};
var chart{{ index }} = new Chart(ctx{{ index }}, {
type: '{{ charts[index].chartType }}',
data: data{{ index }},
options: {
title: {
display: true,
text: '{{ charts[index].activityName }}',
fontSize: 24,
fontColor: 'black',
fontFamily: 'Roboto'
},
scales: {
yAxes: [{
ticks: {
beginAtZero:true
}
}]
}
},
});
{% endfor %}
, data_values=data_values, xlabels=xlabels, chartColors=colors