Donut charts are not getting displayed. Getting Table has no columns error on page refresh and loading.
Html code
- class="col-md-12 text-center" ng-if="!vm.donutChartSpinner && vm.donutChartData">class="text-center col-md-3 pie-charts-placement" ng-repeat="row in vm.donutChartData.charts | filter:{ IsActive: true } track by $index" style="width: 25% !important;">
class
="text-center" style="margin-bottom: 5px;">{{row.Name}}class
="text-center" style="font-size: 0.85em; margin: 0px;">- if="row.Id==2 || row.Id==4">Not submittedspan>
"display:block; width: auto;" google-chart chart="row.chartData.chart" agc-on-select="vm.selectDonutSection(selectedItem, chartWrapper, chart, row)">
JS CODE
- google.charts.load('current', { packages: ['corechart']});
- function loadDonutChart() {
- var charts = [
- { Id: 1, Name: 'Actions', chartData: '', IsActive: true },
- { Id: 2, Name: 'CQC Notifications', chartData: '', IsActive: true }
- ];
- if (!featureToggle.isEnabled('actions')) {
- charts[0].IsActive = false
- }
- if (!featureToggle.isVersion('notifications', '1.0.0')) {
- charts[1].IsActive = false
- }
- vm.donutChartData = {
- hasData: true,
- charts: charts
- }
- /* 1. Actions */
- if (featureToggle.isEnabled('actions')) {
- dashboardTrackerService.getActionsDonutChartCount().then(function (response) {
- if (vm.homeIds.length > 0)
- getImmediatePriorityDonutChart(vm.donutChartData.charts[0], response.data);
- vm.donutChartSpinner = false;
- }, function (err) {
- vm.donutChartSpinner = false;
- });
- }
- /* 2. Notifications */
- if (featureToggle.isVersion('notifications', '1.0.0')) {
- dashboardTrackerService.getNotificationsDonutChartCount().then(function (response) {
- if (vm.homeIds.length > 0)
- getImmediatePriorityDonutChart(vm.donutChartData.charts[1], response.data);
- vm.donutChartSpinner = false;
- }, function (err) {
- vm.donutChartSpinner = false;
- });
- }
- }
- function getImmediatePriorityDonutChart(result, data) {
- var dataTable = new google.visualization.DataTable();
- dataTable.addColumn('string', 'Score');
- dataTable.addColumn('number', 'Score Count');
- result.chartData = { chart: {}, assets: {} };
- result.chartData.chart.type = "PieChart";
- result.chartData.chart.options = {
- chartArea: { 'width': '100%', 'height': '90%' },
- pieHole: 0.4,
- legend: { position: 'none' },
- tooltip: { text: 'value' },
- pieSliceText: 'value'
- }
- switch (result.Id) {
- case 1: // Actions
- result.chartData.chart.options.colors = ['#dc3912', '#ff9900', '#3366cc']; // red, orange, blue
- var section = data;
- temp.push([section.Section1, section.Section1Count]);
- temp.push([section.Section2, section.Section2Count]);
- temp.push([section.Section3, section.Section3Count]);
- dataTable.addRows(temp);
- result.chartData.chart.data = dataTable;
- break;
- case 2: // Notifications
- var section = data;
- temp.push([section.Section1, section.Section1Count]);
- temp.push([section.Section2, section.Section2Count]);
- temp.push([section.Section3, section.Section3Count]);
- temp.push([section.Section4, section.Section4Count]);
- temp.push([section.Section5, section.Section5Count]);
- dataTable.addRows(temp);
- result.chartData.chart.data = dataTable;
- break;
- }
- return result;
- }
Someone please support me in resolving this error.
Siddharth GajbhiyePosted Jan 27, 2020, 11:02 PM