HTML
<select class="col-xs-4" test-id="" ng-model="paymentYear" data-ng-options="item.key as item.value for item in paymentYears" ng-change="getChartData()"></select>
<div kendo-chart k-options="riskScoreChart" class="chart-container"></div>
JS:
var self = $scope;
init();
function init() {
self.ramDashboard = [];
self.riskScoreDetailsSeries = [];
self.riskScoreDetailsLabels = [];
self.paymentYears = [];
getRamDashboardData();
}
function getRamDashboardData() {
self.paymentYear = self.paymentYears[0].key;
self.getChartData();
}
self.getChartData = function () {
var requestData = { PaymentYear: '' };
requestData.PaymentYear = self.paymentYear;
dashboardService.getRamDashboardData.save(requestData,
function(response) {
self.ramDashboard = response;
bindRiskScoreChart(response.riskScoreDetails);
});
}
function bindRiskScoreChart(riskScoreDetails) {
self.riskScoreDetailsSeries = riskScoreDetails.datasets;
self.riskScoreDetailsLabels = riskScoreDetails.labels;
self.riskScoreChart = {
chartArea: {
height: 300
},
legend: {
position: "top",
offsetX: -100
},
seriesDefaults: {
type: "column"
},
series: self.riskScoreDetailsSeries,
valueAxis: {
labels: {
format: "{0}"
},
majorGridLines: {
visible: false
},
axisCrossingValue: 0
},
categoryAxis: {
categories: self.riskScoreDetailsLabels,
majorGridLines: {
visible: false
}
}
,
tooltip: {
visible: true,
format: "{0}",
template: "#= series.name #: #= value #"
},
seriesClick: onSeriesClick
};
}
Above code is working on with initial Dropdown value selection,but once we change the paymentYear value with Dropdown chart is not getting refreshed.
please help.