function dataSelectChange() {

    $('#loader').show();
    $('#state-legend').empty();
    $('#state-legend').append(`
  <span><span style="background-color: #c7dfdd"></span>${layData[0]}</span>
  <span><span style="background-color: #78a5a2"></span>${layData[1]}</span>
  <span><span style="background-color: #679895"></span>${layData[2]}</span>
  <span><span style="background-color: #508a87"></span>${layData[3]}</span>
  <span><span style="background-color: #41837f"></span>${layData[4]}</span>
  <span><span style="background-color: #317b76"></span>${layData[5]}</span>
  <span><span style="background-color: #10524d"></span>${layData[6]}</span>
  <span><span style="background-color: #0a3d39"></span>${layData[7]}</span>`)
    var colors = ['#eec524', '#24cfa2', '#e70c0c']


    var selectedProv = $("#province-select").val()
    var selectedDist = $("#district-select").val()
    var type = $("#data-select").val()
    var startDate = $("#date-range").data('daterangepicker').startDate.format('YYYY-MM-DD');
    var endDate = $("#date-range").data('daterangepicker').endDate.format('YYYY-MM-DD');

    if(typeof selectedDist !== "undefined" && selectedDist != "" && selectedDist != null) {
        selectedDist = $("#district-select").val()
        selectedProv = $("#province-select").val()
        updateProvDistrictsLayer(selectedProv, startDate, endDate, type)
        var distDataURL = eachDist + "?start_date='" + startDate + "'&end_date='" + endDate + "'&type=" + type + "&district=" + parseInt(selectedDist)
        $.ajax({
            type: "GET",
            url: distDataURL,
            dataType: "json",
            success: function (districtCases) {
                modifyDistrictData(districtCases)
            }
        });
        $('#loader').hide();

    } else if(typeof selectedProv != "undefined" && selectedProv != "" && selectedProv != null) {
        updateProvDistrictsLayer(selectedProv, startDate, endDate, type)
        $('#loader').hide();

    } else {
        updateNepalGeo(startDate, endDate, type)
        $('#loader').hide();
    }
}
