Browse Source

LicenseStatisticWidget js refactor

pull/1545/head
Yunus Emre Kalkan 7 years ago
parent
commit
150eeb1101
  1. 34
      samples/DashboardDemo/src/DashboardDemo.Web/Pages/Shared/Components/LicenseStatisticWidget/Default.js

34
samples/DashboardDemo/src/DashboardDemo.Web/Pages/Shared/Components/LicenseStatisticWidget/Default.js

@ -3,27 +3,6 @@
var _chart;
var createChart = function(statistic) {
_chart = new Chart($wrapper.find('.LicenseStatisticChart'),
{
type: 'pie',
data: {
labels: Object.keys(statistic.data),
datasets: [
{
label: 'License ratios',
data: Object.values(statistic.data),
backgroundColor: [
'rgba(50, 150, 255, 1)',
'rgba(150, 255, 100, 1)',
'rgba(255, 100, 150, 1)'
]
}
]
}
});
};
var refreshChart = function(statistic) {
_chart.data = {
labels: Object.keys(statistic.data),
@ -52,14 +31,19 @@
});
};
var init = function(filters) {
render(filters, createChart);
};
var refresh = function(filters) {
render(filters, refreshChart);
};
var init = function (filters) {
_chart = new Chart($wrapper.find('.LicenseStatisticChart'),
{
type: 'pie'
});
refresh(filters);
};
return {
init: init,
refresh: refresh

Loading…
Cancel
Save