@@ -71,23 +71,23 @@ const verticalLinePlugin = {
71
71
export default {
72
72
props : {
73
73
title: { type: String , },
74
- type: { type: String , required: true },
75
- datas: { type: Array , },
74
+ type: { type: String , required: true },
75
+ datas: { type: Object , },
76
76
dataSeriesTranslator: { type: Function ,},
77
77
queryUrl: { type: String , },
78
78
queryClusteredMeasure: { type: Object , },
79
79
queryMeasures: { type: Array , },
80
80
queryDataFilter: { type: Object , },
81
81
queryTimeFilter: { type: Object , },
82
82
queryGroupBy: { type: String , },
83
- colors: { type: String , required : true , default: ' DEFAULT' },
84
- labels: { type: Object , required: true },
83
+ colors: { type: String , default: ' DEFAULT' },
84
+ labels: { type: Object , required: true },
85
85
minTime: { type: String , },
86
86
maxTime: { type: String , },
87
87
fillGapDim: { type: String , },
88
88
fillGapValue: { type: Number , },
89
- timeFormat: { type: String , required : true , default: ' DD/MM/YYYY HH:mm' },
90
- verticalLines: { type: Array , }, /** {x, label, color} */
89
+ timeFormat: { type: String , default: ' DD/MM/YYYY HH:mm' },
90
+ verticalLines: { type: Array , }, /** {x, label, color} */
91
91
additionalOptions: { type: Object , },
92
92
},
93
93
created : function () {
@@ -198,17 +198,23 @@ export default {
198
198
var bubblesData = this .toChartJsBubblesData (datas, realLabels .keys (), realLabels, queryGroupBy);
199
199
chartJsDataSets = [ {data: bubblesData }];
200
200
chartOptions = this .getChartJsBubblesOptions (datas, realLabels .keys (), queryGroupBy, realLabels, chartTitle, additionalOptions);
201
- this .setChartJsColorOptions (chartJsDataSets, dataColors, 0.5 );
201
+ this .setChartJsColorOptions (chartJsDataSets, dataColors, 1 , 0.5 );
202
202
} else if (this .type === " linechart" ) {
203
203
chartJsType = ' line' ;
204
204
chartJsDataSets = this .toChartJsData (datas, dataLabels, timedSeries, queryGroupBy);
205
205
chartOptions = this .getChartJsLineOptions (datas, queryGroupBy, dataLabels, timedSeries, chartTitle, additionalOptions);
206
206
this .setChartJsColorOptions (chartJsDataSets, dataColors);
207
- } else if (this .type === " stakedbarchart " ) {
207
+ } else if (this .type === " barchart " ) {
208
208
chartJsType = ' bar' ;
209
209
chartJsDataSets = this .toChartJsData (datas, dataLabels, timedSeries, queryGroupBy);
210
+ chartOptions = this .getChartJsLineOptions (datas, queryGroupBy, dataLabels, timedSeries, chartTitle, additionalOptions);
211
+ this .setChartJsColorOptions (chartJsDataSets, dataColors, 1 , 0.5 );
212
+ } else if (this .type === " stackedbarchart" ) {
213
+ chartJsType = ' bar' ;
214
+ chartJsDataSets = this .toChartJsData (datas, dataLabels, timedSeries, queryGroupBy);
215
+ // chartOptions = this.getChartJsLineOptions(datas, queryGroupBy, dataLabels, timedSeries, chartTitle, additionalOptions);
210
216
chartOptions = this .getStackedOptions (datas, queryGroupBy, dataLabels, timedSeries, chartTitle, additionalOptions);
211
- this .setChartJsColorOptions (chartJsDataSets, dataColors);
217
+ this .setChartJsColorOptions (chartJsDataSets, dataColors, 1 , 0.5 );
212
218
} else if (this .type === " polararea" ) {
213
219
chartJsType = ' polarArea' ;
214
220
chartJsDataSets = this .toChartJsData (datas, dataLabels, timedSeries, queryGroupBy);
@@ -259,10 +265,10 @@ export default {
259
265
graphChart .update (" none" );
260
266
}
261
267
},
262
- setChartJsColorOptions : function (datasets , dataColors , opacity ) {
268
+ setChartJsColorOptions : function (datasets , dataColors , opacity , bgOpacity ) {
263
269
if (dataColors) {
264
270
var myColors = getColors (dataColors, datasets .length , opacity);
265
- var myBgColors = getColors (dataColors, datasets .length , opacity? opacity* 0.25 : 0.25 );
271
+ var myBgColors = getColors (dataColors, datasets .length , bgOpacity ? bgOpacity : ( opacity? opacity* 0.25 : 0.25 ) );
266
272
for (var i = 0 ; i< datasets .length ; i++ ) {
267
273
datasets[i].borderColor = myColors[i];
268
274
datasets[i].backgroundColor = myBgColors[i];
@@ -404,6 +410,9 @@ export default {
404
410
},
405
411
line : {
406
412
tension: 0
413
+ },
414
+ bar : {
415
+ borderWidth: 3
407
416
}
408
417
}
409
418
};
@@ -440,10 +449,18 @@ export default {
440
449
441
450
442
451
getStackedOptions : function (datas , queryGroupBy , dataLabels , timedSeries , chartTitle , additionalOptions ){
443
- var options = this .getChartJsLineOptions (datas, dataQuery, dataLabels, timedSeries, additionalOptions)
444
- options .scales .x .stacked = true ;
445
- options .scales .y .stacked = true ;
446
- return options;
452
+ var options = this .getChartJsLineOptions (datas, queryGroupBy, dataLabels, timedSeries, chartTitle, additionalOptions);
453
+ var stackedOptions = {
454
+ scales : {
455
+ x: {
456
+ stacked: true
457
+ },
458
+ y: {
459
+ stacked: true
460
+ }
461
+ }
462
+ };
463
+ return this .mergeDeep (options, stackedOptions);
447
464
},
448
465
449
466
0 commit comments