I am working with highcharts.js, and will ultimately have a number of charts that will need to change based upon a chosen select value. All of the different charts will be read from csv files in the final product.
Here is an example fiddle: https://jsfiddle.net/o0d3mpnb/1/
And here is the code i'm using in the final project to pull from the csv:
$(function() {
Highcharts.setOptions({
lang: {
decimalPoint: '.',
thousandsSep: ','
}
});
$.get('/procurement/reports/voucher-total-dollar.csv', function(csv) {
$('#donut-1').highcharts({
credits: {
enabled: false
},
chart: {
type: 'column',
height: 300
},
title: {
text: 'VOUCHERS TOTAL $ AMOUNT',
xAxis: {
categories: [
'Totals'
],
crosshair: true
},
yAxis: {
title: {
text: 'Total'
}
},
legend: {
enabled: true
},
tooltip: {
pointFormat: 'Total: <b>${point.y}</b>'
},
data: {
csv: csv,
firstRowAsNames: true
}
});
});
});
I have figured out how to update the data and redraw the chart depending on the value of the selection chosen. What I haven't figured out is how to go back to the original data-set if the "all" option is selected.
For the purpose of sharing, the code is pulling the original "csv data" from an id in the document, but this will need to be an external file eventually, as in the code above.
So my question is two-fold:
How do i revert back to the data from the original csv file when the "all" select option is chosen? and
How do I load the updated data from different csv files rather than from data-array that is currently in the jquery?
I've fairly new to jquery and have never used highcharts before this project, and have been simply stumbling my way through all this until now. Any help would be greatly appreciated. Thanks!!