Skip to content

Commit

Permalink
Disables bezier curves on line charts. #20
Browse files Browse the repository at this point in the history
  • Loading branch information
Mariano Gappa committed Jul 15, 2017
1 parent f0098ad commit 551835b
Show file tree
Hide file tree
Showing 2 changed files with 353 additions and 308 deletions.
77 changes: 41 additions & 36 deletions chartjs.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,46 +43,51 @@ func init() {
title: {
display: {{ if len .Title }}true{{else}}false{{end}},
text: '{{ .Title }}'
},
tooltips: {
callbacks: {
label: function(tti, data) {
{{ .TooltipCallback }}
}
}
}
{{ if ne .ChartType "pie" }},
legend: {
display: false
},
tooltips: {
callbacks: {
label: function(tti, data) {
{{ .TooltipCallback }}
scales: {
yAxes: [{
type: "{{ .ScaleType }}",
ticks: {
beginAtZero: {{ .ZeroBased }},
callback: function(value, index, values) {
return value;
}
},
scaleLabel: {
display: {{if eq .YLabel ""}}false{{else}}true{{end}},
labelString: '{{ .YLabel }}'
}
}],
xAxes: [{
{{ if .UsesTimeScale }}
type: 'time',
position: 'bottom',
{{ else if eq .ActualChartType "scatterline" }}
type: 'linear',
position: 'bottom',
{{end}}
scaleLabel: {
display: {{if eq .XLabel ""}}false{{else}}true{{end}},
labelString: '{{ .XLabel }}'
}
}]
},
elements: {
line: {
tension: 0, // disables bezier curves
}
}
{{ if ne .ChartType "pie" }},
legend: {
display: false
},
scales: {
yAxes: [{
type: "{{ .ScaleType }}",
ticks: {
beginAtZero: {{ .ZeroBased }},
callback: function(value, index, values) {
return value;
}
},
scaleLabel: {
display: {{if eq .YLabel ""}}false{{else}}true{{end}},
labelString: '{{ .YLabel }}'
}
}],
xAxes: [{
{{ if .UsesTimeScale }}
type: 'time',
position: 'bottom',
{{ else if eq .ActualChartType "scatterline" }}
type: 'linear',
position: 'bottom',
{{end}}
scaleLabel: {
display: {{if eq .XLabel ""}}false{{else}}true{{end}},
labelString: '{{ .XLabel }}'
}
}]
}
{{end}}
}
}`
Expand Down

0 comments on commit 551835b

Please sign in to comment.