Merge branch 'test/SUPPORT-8717_default_label_color' into ervu/tmp_makets

* test/SUPPORT-8717_default_label_color:
  Правки тестовые
  SUPPORT-8717: fix default font setting
  SUPPORT-8717: test on conversion page
  SUPPORT-8717: setting default label color
This commit is contained in:
Фоат Саляхов 2025-01-09 14:16:56 +03:00
commit b0f927e0df
3 changed files with 134 additions and 31 deletions

View file

@ -11,10 +11,10 @@ import ru.cg.webbpm.modules.standard_annotations.editor.ColorEditor;
*/
public abstract class AbstractRoundLabelConfiguration implements RoundLabelConfiguration {
public Font font = Font.of("sans-serif", "500", 14);
public Font font;
@ColorEditor
public String color = "#FFFFFF";
public String color;
@Override
public ChartLabelModel getLabelModel(LoadOptions loadOptions) {

View file

@ -1,32 +1,39 @@
import {ChartPlugin} from "./ChartPlugin";
import {
AdvancedProperty,
AnalyticalScope,
Behavior,
ChartFontFamily,
ColorEditor,
Visible
} from "@webbpm/base-package";
import {Chart} from "chart.js";
import {
ChartLabelModel
} from "../../../../generated/ervu_business_metrics/model/chart/round/label/ChartLabelModel";
import {ChartUtils} from "../ChartUtils";
import {AnalyticalScope, Behavior, ChartFontFamily, Visible} from "@webbpm/base-package";
import {ErvuChartV2} from "../ErvuChartV2";
import {ChartLabelFormatter} from "./formatters/ChartLabelFormatter";
import {ChartPlugin} from "./ChartPlugin";
import {ChartUtils} from "../ChartUtils";
import {ErvuChartV2} from "../ErvuChartV2";
@AnalyticalScope(ErvuChartV2)
export class DoughnutCenterLabelsPlugin extends Behavior implements ChartPlugin {
public static readonly ID = 'doughnut-center-labels';
private static readonly DEFAULTS = {
color: 'rgb(255, 255, 255)',
font: {
family: ChartFontFamily.SANS_SERIF,
weight: '500',
size: 14
}
}
@Visible('false')
public id: string = DoughnutCenterLabelsPlugin.ID;
public id: string = 'doughnut-center-labels';
public formatters: ChartLabelFormatter[] = [];
@ColorEditor()
public defaultColor: string = 'rgb(0, 0, 0)';
@AdvancedProperty()
public defaultFontFamily: string = ChartFontFamily.SANS_SERIF;
@AdvancedProperty()
public defaultFontWeight: string = '500';
@AdvancedProperty()
public defaultFontSize: number = 14;
beforeDatasetsDraw(chart: Chart, args?: { cancellable: true }, options?: any): void {
if (!chart.data || !chart.data.datasets || !(<any>chart.data).centerLabels || ChartUtils.isEmpty(chart)) {
if (!chart.data || !chart.data.datasets || !(<any>chart.data).centerLabels
|| ChartUtils.isEmpty(chart)) {
return;
}
@ -101,18 +108,19 @@ export class DoughnutCenterLabelsPlugin extends Behavior implements ChartPlugin
formatter.format(label, labels, index);
}
label.color = label.color ? label.color : DoughnutCenterLabelsPlugin.DEFAULTS.color;
label.color = label.color ? label.color : this.defaultColor;
if (label.font) {
label.font.family =
label.font.family ? label.font.family : DoughnutCenterLabelsPlugin.DEFAULTS.font.family;
label.font.weight =
label.font.weight ? label.font.weight : DoughnutCenterLabelsPlugin.DEFAULTS.font.weight;
label.font.size =
label.font.size ? label.font.size : DoughnutCenterLabelsPlugin.DEFAULTS.font.size;
label.font.family = label.font.family ? label.font.family : this.defaultFontFamily;
label.font.weight = label.font.weight ? label.font.weight : this.defaultFontWeight;
label.font.size = label.font.size ? label.font.size : this.defaultFontSize;
}
else {
label.font = DoughnutCenterLabelsPlugin.DEFAULTS.font
label.font = {
family: this.defaultFontFamily,
weight: this.defaultFontWeight,
size: this.defaultFontSize
};
}
});
}

View file

@ -1500,7 +1500,6 @@
<componentRootId>0b71ab2a-0c7f-4268-9b59-e8ef23bcea4e</componentRootId>
<name>ГК Первый ряд показателей</name>
<container>true</container>
<expanded>false</expanded>
<childrenReordered>false</childrenReordered>
<scripts id="bf098f19-480e-44e4-9084-aa42955c4d0f">
<properties>
@ -3237,6 +3236,81 @@
<key>dataSetService</key>
<value>
<complex>
<entry>
<key>centerLabelConfigurations</key>
<value>
<item id="c34ccf66-bd7d-497b-a6af-91cba75606dc" removed="true"/>
<item id="1cda6df7-9339-4b7e-9a79-1fc88e11476c" removed="true"/>
<item id="fb47f325-51e6-42b9-92a6-cf1021780f9d" removed="true"/>
<item id="aea9ed3a-bfdc-4b87-be09-0c19e651e2a6" removed="false">
<value>
<complex>
<entry>
<key>aggregationFunction</key>
<value>
<simple>"SUM"</simple>
</value>
</entry>
<entry>
<key>font</key>
<value>
<complex>
<entry>
<key>family</key>
<value>
<simple>"GolosUI"</simple>
</value>
</entry>
<entry>
<key>size</key>
<value>
<simple>22</simple>
</value>
</entry>
<entry>
<key>weight</key>
<value>
<simple>"550"</simple>
</value>
</entry>
</complex>
</value>
</entry>
<entry>
<key>loadDao</key>
<value>
<complex>
<entry>
<key>graph</key>
<value>
<simple>{"conditionGroup":{"operator":"AND","conditions":[],"groups":[]},"nodeByIndex":{"0":{"tableName":"convert_info_loaded_records","schemaName":"metrics","x":347.0,"y":168.0,"alias":"convert_info_loaded_records","conditionGroup":{"operator":"AND","conditions":[],"groups":[]},"emptyEntityAction":"IGNORE_OR_DELETE"},"1":{"tableName":"recruitment","schemaName":"metrics","x":88.0,"y":305.0,"alias":"recruitment","conditionGroup":{"operator":"AND","conditions":[],"groups":[]},"emptyEntityAction":"IGNORE_OR_DELETE"},"2":{"tableName":"view_convert_info_loaded_records","schemaName":"metrics","x":603.0,"y":245.0,"alias":"view_convert_info_loaded_records","conditionGroup":{"operator":"AND","conditions":[],"groups":[]},"emptyEntityAction":"IGNORE_OR_DELETE"}},"nodes":[{"tableName":"convert_info_loaded_records","schemaName":"metrics","x":347.0,"y":168.0,"alias":"convert_info_loaded_records","conditionGroup":{"operator":"AND","conditions":[],"groups":[]},"emptyEntityAction":"IGNORE_OR_DELETE"},{"tableName":"recruitment","schemaName":"metrics","x":88.0,"y":305.0,"alias":"recruitment","conditionGroup":{"operator":"AND","conditions":[],"groups":[]},"emptyEntityAction":"IGNORE_OR_DELETE"},{"tableName":"view_convert_info_loaded_records","schemaName":"metrics","x":603.0,"y":245.0,"alias":"view_convert_info_loaded_records","conditionGroup":{"operator":"AND","conditions":[],"groups":[]},"emptyEntityAction":"IGNORE_OR_DELETE"}],"nodeByEntityName":{"view_convert_info_loaded_records":{"tableName":"view_convert_info_loaded_records","schemaName":"metrics","x":603.0,"y":245.0,"alias":"view_convert_info_loaded_records","conditionGroup":{"operator":"AND","conditions":[],"groups":[]},"emptyEntityAction":"IGNORE_OR_DELETE"},"recruitment":{"tableName":"recruitment","schemaName":"metrics","x":88.0,"y":305.0,"alias":"recruitment","conditionGroup":{"operator":"AND","conditions":[],"groups":[]},"emptyEntityAction":"IGNORE_OR_DELETE"},"convert_info_loaded_records":{"tableName":"convert_info_loaded_records","schemaName":"metrics","x":347.0,"y":168.0,"alias":"convert_info_loaded_records","conditionGroup":{"operator":"AND","conditions":[],"groups":[]},"emptyEntityAction":"IGNORE_OR_DELETE"}},"matrix":[[null,{"refOnEntityName":"convert_info_loaded_records","refToEntityName":"recruitment","refToColumns":[{"schema":"metrics","table":"recruitment","entity":"recruitment","name":"id"}],"refOnColumns":[{"schema":"metrics","table":"convert_info_loaded_records","entity":"convert_info_loaded_records","name":"recruitment_id"}],"required":false,"cyclic":false,"conditionGroup":{"operator":"AND","conditions":[],"groups":[]}},null],[null,null,null],[{"refOnEntityName":"view_convert_info_loaded_records","refToEntityName":"convert_info_loaded_records","refToColumns":[{"schema":"metrics","table":"convert_info_loaded_records","entity":"convert_info_loaded_records","name":"convert_info_loaded_records_id"}],"refOnColumns":[{"schema":"metrics","table":"view_convert_info_loaded_records","entity":"view_convert_info_loaded_records","name":"convert_info_loaded_records_id"}],"required":false,"cyclic":false,"conditionGroup":{"operator":"AND","conditions":[],"groups":[]}},null,null]],"mainNodeIndex":0}</simple>
</value>
</entry>
</complex>
<implRef type="JAVA">
<className>DefaultLoadDao</className>
<packageName>database.dao</packageName>
</implRef>
</value>
</entry>
<entry>
<key>valueColumn</key>
<value>
<simple>{"schema":"metrics","table":"view_convert_info_loaded_records","entity":"view_convert_info_loaded_records","name":"count_all"}</simple>
</value>
</entry>
</complex>
<implRef type="JAVA">
<className>DefaultRoundLabelConfiguration</className>
<packageName>ervu_business_metrics.component.chart.label</packageName>
</implRef>
</value>
</item>
<item id="353dd3d2-9124-45d2-8dba-de827634b087" removed="true"/>
<item id="f3cb1fe9-1cf8-403f-b078-b65f96f069ef" removed="true"/>
<item id="06396581-6874-45ff-af24-56db9b73b9ef" removed="true"/>
</value>
</entry>
<entry>
<key>dataSetConfigurations</key>
<value>
@ -3349,6 +3423,7 @@
</value>
</entry>
</complex>
<expanded>false</expanded>
</value>
</entry>
<entry>
@ -3387,6 +3462,7 @@
</value>
</entry>
</complex>
<expanded>false</expanded>
</value>
</item>
</value>
@ -3409,7 +3485,6 @@
<packageName>ervu_business_metrics.component.chart</packageName>
</classRef>
<enabled>true</enabled>
<expanded>true</expanded>
<properties>
<entry>
<key>cssClasses</key>
@ -3432,6 +3507,7 @@
</value>
</entry>
</complex>
<expanded>false</expanded>
</value>
</entry>
<entry>
@ -3448,7 +3524,6 @@
<packageName>ervu_business_metrics.component.chart.plugin</packageName>
</classRef>
<enabled>true</enabled>
<expanded>true</expanded>
</scripts>
<scripts id="02928b97-7346-49f3-a94e-288321a06db4">
<classRef type="JAVA">
@ -3456,7 +3531,6 @@
<packageName>ervu_business_metrics.component.filter</packageName>
</classRef>
<enabled>true</enabled>
<expanded>true</expanded>
<properties>
<entry>
<key>references</key>
@ -3508,7 +3582,6 @@
<packageName>ervu_business_metrics.component.filter</packageName>
</classRef>
<enabled>true</enabled>
<expanded>true</expanded>
<properties>
<entry>
<key>filterComponents</key>
@ -3533,6 +3606,25 @@
</value>
</entry>
</properties>
</scripts>
<scripts id="171cc0cc-3ffd-49d9-b872-3c8085c213c4">
<classRef type="TS">
<className>DoughnutCenterLabelsPlugin</className>
<packageName>ervu_business_metrics.component.chart.plugin</packageName>
</classRef>
<enabled>true</enabled>
<properties>
<entry>
<key>formatters</key>
<value>
<item id="a3bc5df5-5998-4f24-90f5-56bdf1c1b3ca" removed="false">
<value>
<implRef/>
</value>
</item>
</value>
</entry>
</properties>
</scripts>
</children>
<children id="007d8f06-9c43-47aa-a8a8-3888f61c3ca1">
@ -4449,6 +4541,7 @@
<componentRootId>a7b44f97-c49f-4356-b45d-64c4d6e71f8b</componentRootId>
<name>ВК Результат сопоставления csv и xml файлов</name>
<container>true</container>
<expanded>false</expanded>
<childrenReordered>false</childrenReordered>
<scripts id="bf098f19-480e-44e4-9084-aa42955c4d0f">
<properties>
@ -7038,6 +7131,7 @@
<componentRootId>ea4d0df5-9e4f-48b2-bf91-3a72d3a90640</componentRootId>
<name>ГК третий ряд показателей</name>
<container>true</container>
<expanded>false</expanded>
<childrenReordered>false</childrenReordered>
<scripts id="bf098f19-480e-44e4-9084-aa42955c4d0f">
<properties>
@ -7075,6 +7169,7 @@
<componentRootId>8b2e7937-7d15-4bba-9f68-d60fb396e615</componentRootId>
<name>ВК Отправка уведомлений в ЛК гражданина на ЕПГУ</name>
<container>true</container>
<expanded>false</expanded>
<childrenReordered>false</childrenReordered>
<scripts id="bf098f19-480e-44e4-9084-aa42955c4d0f">
<properties>