SUPPORT-8904: remove bar indexes; + new parameters
This commit is contained in:
parent
31dd9c3091
commit
2fb0ea3d78
11 changed files with 43 additions and 124 deletions
|
|
@ -128,6 +128,17 @@ public class ErvuMultiChartDataSetService extends AbstractChartDatasetService im
|
|||
chartDataSetDto.setTension(aggFuncData.tension);
|
||||
chartDataSetDto.setOrder(aggFuncData.drawOrder);
|
||||
chartDataSetDto.setStack(aggFuncData.stack);
|
||||
|
||||
chartDataSetDto.setBorderRadius(aggFuncData.borderRadius);
|
||||
chartDataSetDto.setBorderWidth(aggFuncData.borderWidth);
|
||||
chartDataSetDto.setBarPercentage(aggFuncData.barPercentage);
|
||||
chartDataSetDto.setBarThickness(aggFuncData.barThickness);
|
||||
chartDataSetDto.setCategoryPercentage(aggFuncData.categoryPercentage);
|
||||
chartDataSetDto.setBorderDash(aggFuncData.borderDash);
|
||||
chartDataSetDto.setBorderDashOffset(aggFuncData.borderDashOffset);
|
||||
chartDataSetDto.setPointBorderWidth(aggFuncData.pointBorderWidth);
|
||||
chartDataSetDto.setPointRadius(aggFuncData.pointRadius);
|
||||
|
||||
return chartDataSetDto;
|
||||
}).collect(Collectors.toList())).flatMap(Collection::stream).collect(Collectors.toList());
|
||||
}
|
||||
|
|
@ -166,6 +177,17 @@ public class ErvuMultiChartDataSetService extends AbstractChartDatasetService im
|
|||
chartDataSetDto.setTension(staticChartData.tension);
|
||||
chartDataSetDto.setOrder(staticChartData.drawOrder);
|
||||
chartDataSetDto.setStack(staticChartData.stack);
|
||||
|
||||
chartDataSetDto.setBorderRadius(staticChartData.borderRadius);
|
||||
chartDataSetDto.setBorderWidth(staticChartData.borderWidth);
|
||||
chartDataSetDto.setBarPercentage(staticChartData.barPercentage);
|
||||
chartDataSetDto.setBarThickness(staticChartData.barThickness);
|
||||
chartDataSetDto.setCategoryPercentage(staticChartData.categoryPercentage);
|
||||
chartDataSetDto.setBorderDash(staticChartData.borderDash);
|
||||
chartDataSetDto.setBorderDashOffset(staticChartData.borderDashOffset);
|
||||
chartDataSetDto.setPointBorderWidth(staticChartData.pointBorderWidth);
|
||||
chartDataSetDto.setPointRadius(staticChartData.pointRadius);
|
||||
|
||||
return chartDataSetDto;
|
||||
}).collect(Collectors.toList());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ public class ColumnAggregationDataSet {
|
|||
|
||||
public String yAxesId;
|
||||
|
||||
public Float tension;
|
||||
public String tension;
|
||||
|
||||
public Integer drawOrder;
|
||||
|
||||
|
|
|
|||
|
|
@ -25,7 +25,6 @@ import {
|
|||
UnsupportedOperationError,
|
||||
Visible
|
||||
} from "@webbpm/base-package";
|
||||
import {BarPositions} from "./model/BarPositions";
|
||||
import {ChartBarSettings} from "./model/ChartBarSettings";
|
||||
import {ChartLegendSettings} from "./model/ChartLegendSettings";
|
||||
import {Options} from "./model/Options";
|
||||
|
|
@ -296,17 +295,10 @@ export class ErvuChartV2 extends Control implements Filterable {
|
|||
if (this.bars.shadowBar && datasetsLength > 0) {
|
||||
this.initShadowBar(datasets);
|
||||
}
|
||||
// bar positions treatment
|
||||
if (this.bars.barPositions && datasetsLength > 0) {
|
||||
this.initBarPositions(chartOptions, datasets, this.bars.barPositions);
|
||||
}
|
||||
}
|
||||
|
||||
if (this.options) {
|
||||
if (this.options.borderRadiusNumber || this.options.borderRadius) {
|
||||
// border radius treatment
|
||||
this.initBorderRadius(chartOptions);
|
||||
}
|
||||
Object.assign(chartOptions, this.options);
|
||||
}
|
||||
|
||||
chartConfig.tooltips = {
|
||||
|
|
@ -328,19 +320,6 @@ export class ErvuChartV2 extends Control implements Filterable {
|
|||
this.chartConfig = chartConfig;
|
||||
}
|
||||
|
||||
private initBorderRadius(options) {
|
||||
if (this.options.borderRadiusNumber
|
||||
|| (this.options.borderRadius &&
|
||||
(this.options.borderRadius.topLeft ||
|
||||
this.options.borderRadius.topRight ||
|
||||
this.options.borderRadius.bottomLeft ||
|
||||
this.options.borderRadius.bottomRight))) {
|
||||
|
||||
const borderRadiusNumber: number = this.options.borderRadiusNumber;
|
||||
options.borderRadius = borderRadiusNumber ? borderRadiusNumber : this.options.borderRadius;
|
||||
}
|
||||
}
|
||||
|
||||
private initShadowBar(datasets) {
|
||||
const shadowBarStack: string = this.bars.shadowBar;
|
||||
const shadowBarIndex = datasets.findIndex(element => element.stack === shadowBarStack);
|
||||
|
|
@ -377,42 +356,6 @@ export class ErvuChartV2 extends Control implements Filterable {
|
|||
}
|
||||
}
|
||||
|
||||
private initBarPositions(options, datasets, barPositions: BarPositions) {
|
||||
if (barPositions.barStackIndexes && barPositions.barStackIndexes.length > 0) {
|
||||
options.grouped = false;
|
||||
if (barPositions.barThickness) {
|
||||
options.barThickness = barPositions.barThickness;
|
||||
}
|
||||
|
||||
const indexScales = options.scales[this.indexAxis];
|
||||
indexScales.type = 'linear';
|
||||
if (barPositions.max || barPositions.max === 0) {
|
||||
indexScales.max = barPositions.max;
|
||||
}
|
||||
if (barPositions.min || barPositions.min === 0) {
|
||||
indexScales.min = barPositions.min;
|
||||
}
|
||||
|
||||
barPositions.barStackIndexes.forEach(barStackIndex => {
|
||||
if (barStackIndex.barStack && (barStackIndex.index || barStackIndex.index === 0)) {
|
||||
datasets.forEach(dataset => {
|
||||
if (dataset.stack == barStackIndex.barStack) {
|
||||
dataset.data.forEach(dataObject => {
|
||||
dataObject[this.indexAxis] = barStackIndex.index;
|
||||
});
|
||||
}
|
||||
})
|
||||
}
|
||||
});
|
||||
|
||||
options.plugins.tooltip.callbacks = {
|
||||
title: function (tooltipItems) {
|
||||
return tooltipItems.length > 0 ? tooltipItems[0].dataset.stack : undefined;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private repaint(chartData) {
|
||||
if (this.chart) {
|
||||
this.chart.destroy();
|
||||
|
|
|
|||
|
|
@ -1,8 +0,0 @@
|
|||
import {BarStackIndex} from "./BarStackIndex";
|
||||
|
||||
export class BarPositions {
|
||||
public barThickness: number;
|
||||
public max: number;
|
||||
public min: number;
|
||||
public barStackIndexes: BarStackIndex[];
|
||||
}
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
import {NotNull} from "@webbpm/base-package";
|
||||
|
||||
export class BarStackIndex {
|
||||
@NotNull()
|
||||
public barStack: string;
|
||||
@NotNull()
|
||||
public index: number;
|
||||
}
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
import {BorderRadius as ChartBorderRadius} from "chart.js";
|
||||
|
||||
export class BorderRadius implements ChartBorderRadius {
|
||||
public topLeft: number;
|
||||
public topRight: number;
|
||||
public bottomLeft: number;
|
||||
public bottomRight: number;
|
||||
}
|
||||
|
|
@ -1,11 +1,7 @@
|
|||
import {AdvancedProperty} from "@webbpm/base-package";
|
||||
import {AxisSettings} from "./AxisSettings";
|
||||
import {BarPositions} from "./BarPositions";
|
||||
|
||||
export class ChartBarSettings {
|
||||
public shadowBar: string;
|
||||
public x: AxisSettings;
|
||||
public y: AxisSettings;
|
||||
@AdvancedProperty()
|
||||
public barPositions: BarPositions;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,8 +1,16 @@
|
|||
import {Visible} from "@webbpm/base-package";
|
||||
import {BorderRadius} from "./BorderRadius";
|
||||
|
||||
export class Options {
|
||||
public borderRadiusNumber: number;
|
||||
@Visible("borderRadiusNumber == null")
|
||||
public borderRadius: BorderRadius;
|
||||
// bar, doughnut
|
||||
public borderRadius: number;
|
||||
// bar, line
|
||||
public borderWidth: number;
|
||||
// bar
|
||||
public barPercentage: number;
|
||||
public barThickness: number;
|
||||
public categoryPercentage: number;
|
||||
// line
|
||||
public borderDash: number[];
|
||||
public borderDashOffset: number;
|
||||
public pointBorderWidth: number;
|
||||
public pointRadius: number;
|
||||
public tension: number;
|
||||
}
|
||||
|
|
|
|||
Binary file not shown.
2
pom.xml
2
pom.xml
|
|
@ -40,7 +40,7 @@
|
|||
<dependency>
|
||||
<groupId>ru.cg.webbpm.packages.base</groupId>
|
||||
<artifactId>backend</artifactId>
|
||||
<version>3.185.1</version>
|
||||
<version>3.185.3-SNAPSHOT</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>xerces</groupId>
|
||||
|
|
|
|||
|
|
@ -1545,7 +1545,7 @@
|
|||
<value>
|
||||
<complex>
|
||||
<entry>
|
||||
<key>borderRadiusNumber</key>
|
||||
<key>borderRadius</key>
|
||||
<value>
|
||||
<simple>15.0</simple>
|
||||
</value>
|
||||
|
|
@ -2674,19 +2674,6 @@
|
|||
<key>bars</key>
|
||||
<value>
|
||||
<complex>
|
||||
<entry>
|
||||
<key>barPositions</key>
|
||||
<value>
|
||||
<complex>
|
||||
<entry>
|
||||
<key>barStackIndexes</key>
|
||||
<value>
|
||||
<item id="9c532899-04ee-45e7-9e5e-04be73c76667" removed="true"/>
|
||||
</value>
|
||||
</entry>
|
||||
</complex>
|
||||
</value>
|
||||
</entry>
|
||||
<entry>
|
||||
<key>shadowBar</key>
|
||||
<value>
|
||||
|
|
@ -2823,7 +2810,7 @@
|
|||
<value>
|
||||
<complex>
|
||||
<entry>
|
||||
<key>borderRadiusNumber</key>
|
||||
<key>borderRadius</key>
|
||||
<value>
|
||||
<simple>15.0</simple>
|
||||
</value>
|
||||
|
|
@ -3984,7 +3971,7 @@
|
|||
<value>
|
||||
<complex>
|
||||
<entry>
|
||||
<key>borderRadiusNumber</key>
|
||||
<key>borderRadius</key>
|
||||
<value>
|
||||
<simple>15.0</simple>
|
||||
</value>
|
||||
|
|
@ -5121,19 +5108,6 @@
|
|||
<key>bars</key>
|
||||
<value>
|
||||
<complex>
|
||||
<entry>
|
||||
<key>barPositions</key>
|
||||
<value>
|
||||
<complex>
|
||||
<entry>
|
||||
<key>barStackIndexes</key>
|
||||
<value>
|
||||
<item id="9c532899-04ee-45e7-9e5e-04be73c76667" removed="true"/>
|
||||
</value>
|
||||
</entry>
|
||||
</complex>
|
||||
</value>
|
||||
</entry>
|
||||
<entry>
|
||||
<key>shadowBar</key>
|
||||
<value>
|
||||
|
|
@ -5270,7 +5244,7 @@
|
|||
<value>
|
||||
<complex>
|
||||
<entry>
|
||||
<key>borderRadiusNumber</key>
|
||||
<key>borderRadius</key>
|
||||
<value>
|
||||
<simple>15.0</simple>
|
||||
</value>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue