diff --git a/ng2-components/ng2-activiti-analytics/src/components/analytics-report-parameters.component.ts b/ng2-components/ng2-activiti-analytics/src/components/analytics-report-parameters.component.ts index f1768acc42..15a4377d2f 100644 --- a/ng2-components/ng2-activiti-analytics/src/components/analytics-report-parameters.component.ts +++ b/ng2-components/ng2-activiti-analytics/src/components/analytics-report-parameters.component.ts @@ -134,7 +134,11 @@ export class AnalyticsReportParametersComponent implements OnInit, OnChanges { this.reportParamsSub = this.analyticsService.getReportParams(reportId).subscribe( (res: ReportParametersModel) => { this.reportParameters = res; - this.onSuccessReportParams.emit(res); + if (this.reportParameters.hasParameters()) { + this.onSuccessReportParams.emit(res); + } else { + this.onSuccess.emit(); + } }, (err: any) => { console.log(err); diff --git a/ng2-components/ng2-activiti-analytics/src/models/chart.model.ts b/ng2-components/ng2-activiti-analytics/src/models/chart.model.ts index 15ab95b87a..658f2e34f1 100644 --- a/ng2-components/ng2-activiti-analytics/src/models/chart.model.ts +++ b/ng2-components/ng2-activiti-analytics/src/models/chart.model.ts @@ -106,23 +106,25 @@ export class BarChart extends Chart { this.yAxisType = obj && obj.yAxisType || null; this.options.scales.xAxes[0].ticks.callback = this.xAxisTickFormatFunction(this.xAxisType); this.options.scales.yAxes[0].ticks.callback = this.yAxisTickFormatFunction(this.yAxisType); - obj.values.forEach((params: any) => { - let dataValue = []; - params.values.forEach((info: any) => { - info.forEach((value: any, index: any) => { - if (index % 2 === 0) { - if (!this.labels.includes(value)) { - this.labels.push(value); + if (obj.values) { + obj.values.forEach((params: any) => { + let dataValue = []; + params.values.forEach((info: any) => { + info.forEach((value: any, index: any) => { + if (index % 2 === 0) { + if (!this.labels.includes(value)) { + this.labels.push(value); + } + } else { + dataValue.push(value); } - } else { - dataValue.push(value); - } + }); }); + if (dataValue && dataValue.length > 0) { + this.datasets.push({data: dataValue, label: params.key}); + } }); - if (dataValue && dataValue.length > 0) { - this.datasets.push({data: dataValue, label: params.key}); - } - }); + } } xAxisTickFormatFunction = function (xAxisType) { diff --git a/ng2-components/ng2-activiti-analytics/src/models/report.model.ts b/ng2-components/ng2-activiti-analytics/src/models/report.model.ts index 549f841add..54ef72c176 100644 --- a/ng2-components/ng2-activiti-analytics/src/models/report.model.ts +++ b/ng2-components/ng2-activiti-analytics/src/models/report.model.ts @@ -38,7 +38,7 @@ export class ReportParametersModel { } hasParameters() { - return (this.definition && this.definition.parameters) ? true : false; + return (this.definition && this.definition.parameters && this.definition.parameters.length > 0) ? true : false; } }