generalized layouts
This commit is contained in:
parent
6bec8d8f25
commit
f9a5a7949e
4 changed files with 99 additions and 0 deletions
38
app/static/chartist.js
Normal file
38
app/static/chartist.js
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
var mychart;
|
||||
|
||||
var nation = $("#nation option:selected").text()
|
||||
var getData = $.get('/data/'.concat(nation));
|
||||
|
||||
getData.done(function(results){
|
||||
|
||||
var data = {
|
||||
labels: results.labels,
|
||||
series: [
|
||||
results.results
|
||||
]
|
||||
};
|
||||
|
||||
mychart = new Chartist.Line('.ct-chart', data);
|
||||
|
||||
})
|
||||
|
||||
function updateChart(){
|
||||
var nation = $("#nation option:selected").text()
|
||||
|
||||
var updatedData = $.get('/data/'.concat(nation));
|
||||
|
||||
updatedData.done(function(results){
|
||||
var data = {
|
||||
labels: results.labels,
|
||||
series: [
|
||||
results.results
|
||||
]
|
||||
};
|
||||
|
||||
mychart.update(data)
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
$('#update').on('click', updateChart)
|
||||
$('#nation').on('change', updateChart)
|
||||
Loading…
Add table
Add a link
Reference in a new issue