Home forums Chart Support Apply dropdown filter in php with database search Reply To: Apply dropdown filter in php with database search

#31474

hi everyone,

i have tried to put default year in the dropdwon but couldnot able to do show using chagne function. here is my code:
$( “.dropdown” ).change(function() {
chart.options.data[0].dataPoints = [];
var e = document.getElementById(“dd”);
var selectedYear = e.options[e.selectedIndex].value;
if( !isNaN(Number(selectedYear)) ) {
chart.options.title.text = “Year: ” + selectedYear;
chart.options.title.verticalAlign = “top”;
var data = { “year” : selectedYear }
$.getJSON(“getData.php”, data, function(result){
chart.options.data[0].dataPoints2019 = result;
chart.render();
})
} else {

chart.options.title.text = “Select Year From Dropdown”;
chart.options.title.verticalAlign = “center”;

}
chart.render()

});