I need to update the chart based on time period.
currently chart is updating all values.
Now i need to update the chart by
- 3 months
- 6 months
- 9 months
- 12 months
- 15 months
- 18 months
how to do in javascript or jquery.??
i have created fiddle to explain my situation
this is the html
<select id="SelectPeriod" >
<option value="last3Months">Last 3 months</option>
<option value="last6Months">Last 6 months</option>
<option value="last9Months">Last 9 months</option>
<option value="last12Months">Last 12 months</option>
<option value="last15Months">Last 15 months</option>
<option value="last18Months">Last 18 months</option>
<option value="last24Months">Last 24 months</option>
</select>
<div id="chart"></div>
JS
var calculation = [["Actual value","Targeted value"]],
result = [[100, 190],[115,190],[250, 190],[23,190],[190, 190],[170,190],
[100, 190],[115,190],[250, 190],[23,190],[190, 190],[170,190],[100, 190],
[115,190],[250, 190],[23,190],[190, 190],[170,190],[100, 190],[115,190],
[250, 190],[23,190],[190, 190],[170,190]];
calculation = calculation.concat(result.sort(function (a, b) { }));
var chart = c3.generate({
bindto: '#chart',
data: {
rows: calculation,
type: 'bar',
}
});
this is my customisation , trying
$("#SelectPeriod").change(function (evt) {
var chartSelection = $("#SelectPeriod").val();
var chart = c3.generate({
data: {
rows: calculation
}
});
});
in detail explanation
I need to update the charts based on time frame.
If user selects 6 months dropdown, i need to show only 6 months chart.
currently it is updating whole 24 months.
Now i need to categorise the data.
How to do it in javascript or jquery?? please help me.
Any help is appreciated