mdt-charts 1.9.11 → 1.10.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/config/config.d.ts +148 -0
- package/lib/config/config.js +1 -0
- package/lib/designer/designerConfig.d.ts +71 -0
- package/lib/designer/designerConfig.js +1 -0
- package/lib/engine/block/block.d.ts +35 -0
- package/lib/engine/block/block.js +110 -0
- package/lib/engine/block/blockHelper.d.ts +12 -0
- package/lib/engine/block/blockHelper.js +19 -0
- package/lib/engine/colorReader/colorReader.d.ts +10 -0
- package/lib/engine/colorReader/colorReader.js +21 -0
- package/lib/engine/contentManager.d.ts +9 -0
- package/lib/engine/contentManager.js +29 -0
- package/lib/engine/elementHighlighter/elementHighlighter.d.ts +30 -0
- package/lib/engine/elementHighlighter/elementHighlighter.js +198 -0
- package/lib/engine/elementHighlighter/selectHighlighter.d.ts +11 -0
- package/lib/engine/elementHighlighter/selectHighlighter.js +95 -0
- package/lib/engine/engine.d.ts +20 -0
- package/lib/engine/engine.js +64 -0
- package/lib/engine/features/aggregator/aggregator.d.ts +22 -0
- package/lib/engine/features/aggregator/aggregator.js +95 -0
- package/lib/engine/features/axis/axis.d.ts +12 -0
- package/lib/engine/features/axis/axis.js +118 -0
- package/lib/engine/features/axis/axisDomHelper.d.ts +7 -0
- package/lib/engine/features/axis/axisDomHelper.js +24 -0
- package/lib/engine/features/axis/axisHelper.d.ts +9 -0
- package/lib/engine/features/axis/axisHelper.js +53 -0
- package/lib/engine/features/axis/axisLabelDomHelper.d.ts +17 -0
- package/lib/engine/features/axis/axisLabelDomHelper.js +143 -0
- package/lib/engine/features/axis/axisLabelsEventManager.d.ts +6 -0
- package/lib/engine/features/axis/axisLabelsEventManager.js +36 -0
- package/lib/engine/features/embeddedLabels/embeddedLabels.d.ts +23 -0
- package/lib/engine/features/embeddedLabels/embeddedLabels.js +147 -0
- package/lib/engine/features/embeddedLabels/embeddedLabelsDomHelper.d.ts +8 -0
- package/lib/engine/features/embeddedLabels/embeddedLabelsDomHelper.js +30 -0
- package/lib/engine/features/embeddedLabels/embeddedLabelsHelper.d.ts +27 -0
- package/lib/engine/features/embeddedLabels/embeddedLabelsHelper.js +65 -0
- package/lib/engine/features/gridLine/gidLineHelper.d.ts +13 -0
- package/lib/engine/features/gridLine/gidLineHelper.js +30 -0
- package/lib/engine/features/gridLine/gridLine.d.ts +11 -0
- package/lib/engine/features/gridLine/gridLine.js +67 -0
- package/lib/engine/features/legend/legend.d.ts +22 -0
- package/lib/engine/features/legend/legend.js +112 -0
- package/lib/engine/features/legend/legendDomHelper.d.ts +8 -0
- package/lib/engine/features/legend/legendDomHelper.js +48 -0
- package/lib/engine/features/legend/legendEventsManager.d.ts +12 -0
- package/lib/engine/features/legend/legendEventsManager.js +47 -0
- package/lib/engine/features/legend/legendHelper.d.ts +21 -0
- package/lib/engine/features/legend/legendHelper.js +99 -0
- package/lib/engine/features/markDots/markDot.d.ts +20 -0
- package/lib/engine/features/markDots/markDot.js +68 -0
- package/lib/engine/features/markDots/markDotsHelper.d.ts +6 -0
- package/lib/engine/features/markDots/markDotsHelper.js +16 -0
- package/lib/engine/features/recordOverflowAlert/recordOverflowAlert.d.ts +14 -0
- package/lib/engine/features/recordOverflowAlert/recordOverflowAlert.js +97 -0
- package/lib/engine/features/scale/scale.d.ts +16 -0
- package/lib/engine/features/scale/scale.js +74 -0
- package/lib/engine/features/tipBox/tipBox.d.ts +11 -0
- package/lib/engine/features/tipBox/tipBox.js +32 -0
- package/lib/engine/features/tipBox/tipBoxHelper.d.ts +16 -0
- package/lib/engine/features/tipBox/tipBoxHelper.js +48 -0
- package/lib/engine/features/title/title.d.ts +9 -0
- package/lib/engine/features/title/title.js +35 -0
- package/lib/engine/features/tolltip/newTooltip/newTooltip.d.ts +16 -0
- package/lib/engine/features/tolltip/newTooltip/newTooltip.js +26 -0
- package/lib/engine/features/tolltip/newTooltip/newTooltip.test.d.ts +1 -0
- package/lib/engine/features/tolltip/newTooltip/newTooltip.test.js +186 -0
- package/lib/engine/features/tolltip/newTooltip/newTooltipService.d.ts +17 -0
- package/lib/engine/features/tolltip/newTooltip/newTooltipService.js +26 -0
- package/lib/engine/features/tolltip/tooltip.d.ts +19 -0
- package/lib/engine/features/tolltip/tooltip.js +181 -0
- package/lib/engine/features/tolltip/tooltipComponentsManager.d.ts +17 -0
- package/lib/engine/features/tolltip/tooltipComponentsManager.js +125 -0
- package/lib/engine/features/tolltip/tooltipDomHelper.d.ts +30 -0
- package/lib/engine/features/tolltip/tooltipDomHelper.js +103 -0
- package/lib/engine/features/tolltip/tooltipHelper.d.ts +18 -0
- package/lib/engine/features/tolltip/tooltipHelper.js +93 -0
- package/lib/engine/filterManager/filterEventManager.d.ts +33 -0
- package/lib/engine/filterManager/filterEventManager.js +127 -0
- package/lib/engine/helpers/domHelper.d.ts +30 -0
- package/lib/engine/helpers/domHelper.js +68 -0
- package/lib/engine/helpers/helper.d.ts +30 -0
- package/lib/engine/helpers/helper.js +89 -0
- package/lib/engine/helpers/namesHelper.d.ts +5 -0
- package/lib/engine/helpers/namesHelper.js +9 -0
- package/lib/engine/intervalNotation/gantt.d.ts +10 -0
- package/lib/engine/intervalNotation/gantt.js +62 -0
- package/lib/engine/intervalNotation/intervalManager.d.ts +7 -0
- package/lib/engine/intervalNotation/intervalManager.js +30 -0
- package/lib/engine/polarNotation/donut/DonutHelper.d.ts +15 -0
- package/lib/engine/polarNotation/donut/DonutHelper.js +60 -0
- package/lib/engine/polarNotation/donut/donut.d.ts +32 -0
- package/lib/engine/polarNotation/donut/donut.js +125 -0
- package/lib/engine/polarNotation/polarManager.d.ts +10 -0
- package/lib/engine/polarNotation/polarManager.js +55 -0
- package/lib/engine/transitionManager.d.ts +19 -0
- package/lib/engine/transitionManager.js +64 -0
- package/lib/engine/twoDimensionalNotation/area/area.d.ts +17 -0
- package/lib/engine/twoDimensionalNotation/area/area.js +131 -0
- package/lib/engine/twoDimensionalNotation/area/areaHelper.d.ts +9 -0
- package/lib/engine/twoDimensionalNotation/area/areaHelper.js +40 -0
- package/lib/engine/twoDimensionalNotation/bar/bar.d.ts +34 -0
- package/lib/engine/twoDimensionalNotation/bar/bar.js +216 -0
- package/lib/engine/twoDimensionalNotation/bar/barHelper.d.ts +24 -0
- package/lib/engine/twoDimensionalNotation/bar/barHelper.js +103 -0
- package/lib/engine/twoDimensionalNotation/line/line.d.ts +17 -0
- package/lib/engine/twoDimensionalNotation/line/line.js +132 -0
- package/lib/engine/twoDimensionalNotation/line/lineHelper.d.ts +8 -0
- package/lib/engine/twoDimensionalNotation/line/lineHelper.js +28 -0
- package/lib/engine/twoDimensionalNotation/twoDimensionalManager.d.ts +11 -0
- package/lib/engine/twoDimensionalNotation/twoDimensionalManager.js +101 -0
- package/lib/engine/valueFormatter.d.ts +6 -0
- package/lib/engine/valueFormatter.js +8 -0
- package/lib/main.d.ts +79 -0
- package/lib/main.js +88 -0
- package/lib/model/chartStyleModel.d.ts +16 -0
- package/lib/model/chartStyleModel.js +67 -0
- package/lib/model/configsValidator/configValidator.d.ts +5 -0
- package/lib/model/configsValidator/configValidator.js +7 -0
- package/lib/model/dataManagerModel.d.ts +22 -0
- package/lib/model/dataManagerModel.js +137 -0
- package/lib/model/featuresModel/axisModel.d.ts +18 -0
- package/lib/model/featuresModel/axisModel.js +111 -0
- package/lib/model/featuresModel/legendModel/legendCanvasModel.d.ts +7 -0
- package/lib/model/featuresModel/legendModel/legendCanvasModel.js +86 -0
- package/lib/model/featuresModel/legendModel/legendModel.d.ts +13 -0
- package/lib/model/featuresModel/legendModel/legendModel.js +78 -0
- package/lib/model/featuresModel/otherComponents.d.ts +6 -0
- package/lib/model/featuresModel/otherComponents.js +12 -0
- package/lib/model/featuresModel/scaleModel.d.ts +17 -0
- package/lib/model/featuresModel/scaleModel.js +100 -0
- package/lib/model/featuresModel/titleModel.d.ts +4 -0
- package/lib/model/featuresModel/titleModel.js +14 -0
- package/lib/model/featuresModel/tooltipModel.d.ts +4 -0
- package/lib/model/featuresModel/tooltipModel.js +7 -0
- package/lib/model/marginModel.d.ts +19 -0
- package/lib/model/marginModel.js +126 -0
- package/lib/model/model.d.ts +221 -0
- package/lib/model/model.js +1 -0
- package/lib/model/modelBuilder.d.ts +16 -0
- package/lib/model/modelBuilder.js +128 -0
- package/lib/model/modelHelper.d.ts +7 -0
- package/lib/model/modelHelper.js +41 -0
- package/lib/model/notations/intervalModel.d.ts +8 -0
- package/lib/model/notations/intervalModel.js +93 -0
- package/lib/model/notations/polarModel.d.ts +7 -0
- package/lib/model/notations/polarModel.js +27 -0
- package/lib/model/notations/twoDimensionalModel.d.ts +19 -0
- package/lib/model/notations/twoDimensionalModel.js +85 -0
- package/lib/optionsServices/publicOptionsService.d.ts +6 -0
- package/lib/optionsServices/publicOptionsService.js +8 -0
- package/lib/optionsServices/validators/sizeValidator.d.ts +5 -0
- package/lib/optionsServices/validators/sizeValidator.js +13 -0
- package/lib/style/charts-main.css +243 -0
- package/lib/style/charts-main.less +243 -0
- package/package.json +1 -1
- package/dist/index.html +0 -363
- package/dist/listeners.89e1e272264c0e680de8.js +0 -278
- package/dist/main.f8b6bc6fee33cef1116c.js +0 -228
- package/dist/src_engine_engine_ts.ccee2a280374e0083541.js +0 -759
- package/dist/vendors-node_modules_chroma-js_chroma_js-node_modules_d3-array_src_max_js-node_modules_d3-arr-c3fc24.b32acc465b8557229277.js +0 -1869
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
import { ChartOrientation, MdtChartsColorField, IntervalChartType, PolarChartType, Size, TooltipOptions, TwoDimensionalChartType } from "../config/config";
|
|
2
|
+
import { DataType, DonutOptionsCanvas, Formatter, TooltipSettings, Transitions } from "../designer/designerConfig";
|
|
3
|
+
declare type AxisType = "key" | "value";
|
|
4
|
+
export declare type Orient = "top" | "bottom" | "left" | "right";
|
|
5
|
+
export declare type ScaleKeyType = "band" | "point";
|
|
6
|
+
export declare type ScaleValueType = "linear" | "datetime";
|
|
7
|
+
export declare type AxisLabelPosition = "straight" | "rotated";
|
|
8
|
+
export declare type LegendPosition = "off" | "top" | "bottom" | "left" | "right";
|
|
9
|
+
export declare type EmbeddedLabelTypeModel = "none" | "key" | "value";
|
|
10
|
+
export declare type DataOptions = {
|
|
11
|
+
[option: string]: any;
|
|
12
|
+
};
|
|
13
|
+
export interface Model {
|
|
14
|
+
blockCanvas: BlockCanvas;
|
|
15
|
+
chartBlock: ChartBlock;
|
|
16
|
+
options: TwoDimensionalOptionsModel | PolarOptionsModel | IntervalOptionsModel;
|
|
17
|
+
otherComponents: OtherComponents;
|
|
18
|
+
dataSettings: DataSettings;
|
|
19
|
+
chartSettings: ChartElementsSettings;
|
|
20
|
+
transitions?: Transitions;
|
|
21
|
+
}
|
|
22
|
+
export interface BlockCanvas {
|
|
23
|
+
size: Size;
|
|
24
|
+
cssClass: string;
|
|
25
|
+
}
|
|
26
|
+
export interface ChartBlock {
|
|
27
|
+
margin: BlockMargin;
|
|
28
|
+
}
|
|
29
|
+
export interface BlockMargin {
|
|
30
|
+
top: number;
|
|
31
|
+
bottom: number;
|
|
32
|
+
left: number;
|
|
33
|
+
right: number;
|
|
34
|
+
}
|
|
35
|
+
interface OptionsModel {
|
|
36
|
+
legend: ILegendModel;
|
|
37
|
+
data: OptionsModelData;
|
|
38
|
+
title: string;
|
|
39
|
+
selectable: boolean;
|
|
40
|
+
tooltip: TooltipOptions;
|
|
41
|
+
}
|
|
42
|
+
export interface TwoDimensionalOptionsModel extends OptionsModel {
|
|
43
|
+
type: "2d";
|
|
44
|
+
scale: IScaleModel;
|
|
45
|
+
axis: IAxisModel;
|
|
46
|
+
charts: TwoDimensionalChartModel[];
|
|
47
|
+
additionalElements: AdditionalElementsOptions;
|
|
48
|
+
orient: ChartOrientation;
|
|
49
|
+
}
|
|
50
|
+
export interface PolarOptionsModel extends OptionsModel {
|
|
51
|
+
type: "polar";
|
|
52
|
+
charts: PolarChartModel[];
|
|
53
|
+
}
|
|
54
|
+
export interface IntervalOptionsModel extends OptionsModel {
|
|
55
|
+
type: "interval";
|
|
56
|
+
scale: IScaleModel;
|
|
57
|
+
axis: IAxisModel;
|
|
58
|
+
charts: IntervalChartModel[];
|
|
59
|
+
additionalElements: AdditionalElementsOptions;
|
|
60
|
+
orient: ChartOrientation;
|
|
61
|
+
}
|
|
62
|
+
export interface ILegendModel {
|
|
63
|
+
position: LegendPosition;
|
|
64
|
+
}
|
|
65
|
+
export interface OptionsModelData {
|
|
66
|
+
dataSource: string;
|
|
67
|
+
keyField: Field;
|
|
68
|
+
}
|
|
69
|
+
export interface Field {
|
|
70
|
+
name: string;
|
|
71
|
+
format: DataType;
|
|
72
|
+
}
|
|
73
|
+
export interface IScaleModel {
|
|
74
|
+
key: ScaleKeyModel;
|
|
75
|
+
value: ScaleValueModel;
|
|
76
|
+
}
|
|
77
|
+
export interface ScaleKeyModel {
|
|
78
|
+
domain: any[];
|
|
79
|
+
range: RangeModel;
|
|
80
|
+
type: ScaleKeyType;
|
|
81
|
+
elementsAmount: number;
|
|
82
|
+
}
|
|
83
|
+
export interface ScaleValueModel {
|
|
84
|
+
domain: any[];
|
|
85
|
+
range: RangeModel;
|
|
86
|
+
type: ScaleValueType;
|
|
87
|
+
}
|
|
88
|
+
export interface RangeModel {
|
|
89
|
+
start: number;
|
|
90
|
+
end: number;
|
|
91
|
+
}
|
|
92
|
+
export interface IAxisModel {
|
|
93
|
+
key: AxisModelOptions;
|
|
94
|
+
value: AxisModelOptions;
|
|
95
|
+
}
|
|
96
|
+
export interface AxisModelOptions {
|
|
97
|
+
visibility: boolean;
|
|
98
|
+
type: AxisType;
|
|
99
|
+
orient: Orient;
|
|
100
|
+
translate: TranslateModel;
|
|
101
|
+
cssClass: string;
|
|
102
|
+
ticks: AxisTicksModel;
|
|
103
|
+
labels: AxisLabelModel;
|
|
104
|
+
}
|
|
105
|
+
export interface TranslateModel {
|
|
106
|
+
translateX: number;
|
|
107
|
+
translateY: number;
|
|
108
|
+
}
|
|
109
|
+
interface AxisTicksModel {
|
|
110
|
+
flag: boolean;
|
|
111
|
+
}
|
|
112
|
+
export interface AxisLabelModel {
|
|
113
|
+
maxSize: number;
|
|
114
|
+
position: AxisLabelPosition;
|
|
115
|
+
visible: boolean;
|
|
116
|
+
defaultTooltip: boolean;
|
|
117
|
+
}
|
|
118
|
+
export interface AdditionalElementsOptions {
|
|
119
|
+
gridLine: GridLineOptions;
|
|
120
|
+
}
|
|
121
|
+
export interface GridLineOptions {
|
|
122
|
+
flag: GridLineFlag;
|
|
123
|
+
}
|
|
124
|
+
export interface GridLineFlag {
|
|
125
|
+
key: boolean;
|
|
126
|
+
value: boolean;
|
|
127
|
+
}
|
|
128
|
+
interface ChartModel {
|
|
129
|
+
tooltip: TooltipModel;
|
|
130
|
+
cssClasses: string[];
|
|
131
|
+
style: ChartStyle;
|
|
132
|
+
}
|
|
133
|
+
interface TooltipModel {
|
|
134
|
+
show: boolean;
|
|
135
|
+
}
|
|
136
|
+
export interface ChartStyle {
|
|
137
|
+
elementColors: string[];
|
|
138
|
+
opacity: number;
|
|
139
|
+
}
|
|
140
|
+
export interface TwoDimensionalChartModel extends ChartModel {
|
|
141
|
+
type: TwoDimensionalChartType;
|
|
142
|
+
data: TwoDimensionalChartDataModel;
|
|
143
|
+
index: number;
|
|
144
|
+
embeddedLabels: EmbeddedLabelTypeModel;
|
|
145
|
+
isSegmented: boolean;
|
|
146
|
+
markersOptions: MarkersOptions;
|
|
147
|
+
}
|
|
148
|
+
export interface IntervalChartModel extends ChartModel {
|
|
149
|
+
type: IntervalChartType;
|
|
150
|
+
data: IntervalChartDataModel;
|
|
151
|
+
}
|
|
152
|
+
export interface PolarChartModel extends ChartModel {
|
|
153
|
+
type: PolarChartType;
|
|
154
|
+
data: PolarChartDataModel;
|
|
155
|
+
}
|
|
156
|
+
export interface TwoDimensionalChartDataModel {
|
|
157
|
+
valueFields: ValueField[];
|
|
158
|
+
}
|
|
159
|
+
export interface ValueField extends Field {
|
|
160
|
+
title: string;
|
|
161
|
+
}
|
|
162
|
+
export interface MarkersOptions {
|
|
163
|
+
show: boolean;
|
|
164
|
+
}
|
|
165
|
+
interface IntervalChartDataModel {
|
|
166
|
+
valueField1: ValueField;
|
|
167
|
+
valueField2: ValueField;
|
|
168
|
+
}
|
|
169
|
+
export interface PolarChartDataModel {
|
|
170
|
+
valueField: ValueField;
|
|
171
|
+
colorField?: MdtChartsColorField;
|
|
172
|
+
}
|
|
173
|
+
export interface DataSettings {
|
|
174
|
+
scope: DataScope;
|
|
175
|
+
format: DataFormat;
|
|
176
|
+
}
|
|
177
|
+
export interface DataScope {
|
|
178
|
+
hidedRecordsAmount: number;
|
|
179
|
+
allowableKeys: string[];
|
|
180
|
+
}
|
|
181
|
+
export interface DataFormat {
|
|
182
|
+
formatters: Formatter;
|
|
183
|
+
}
|
|
184
|
+
export interface ChartElementsSettings {
|
|
185
|
+
bar: BarChartSettings;
|
|
186
|
+
donut: DonutChartSettings;
|
|
187
|
+
}
|
|
188
|
+
export interface BarChartSettings {
|
|
189
|
+
groupMaxDistance: number;
|
|
190
|
+
groupMinDistance: number;
|
|
191
|
+
barDistance: number;
|
|
192
|
+
maxBarWidth: number;
|
|
193
|
+
minBarWidth: number;
|
|
194
|
+
}
|
|
195
|
+
export interface DonutChartSettings extends DonutOptionsCanvas {
|
|
196
|
+
}
|
|
197
|
+
export interface OtherComponents {
|
|
198
|
+
legendBlock: LegendBlockModel;
|
|
199
|
+
titleBlock: TitleBlockModel;
|
|
200
|
+
tooltipBlock: TooltipSettings;
|
|
201
|
+
}
|
|
202
|
+
interface ComponentBlockModel {
|
|
203
|
+
margin: BlockMargin;
|
|
204
|
+
size: number;
|
|
205
|
+
pad: number;
|
|
206
|
+
}
|
|
207
|
+
export interface LegendBlockModel {
|
|
208
|
+
coordinate: LegendCoordinate;
|
|
209
|
+
standartTooltip: boolean;
|
|
210
|
+
}
|
|
211
|
+
export interface LegendCoordinate {
|
|
212
|
+
top: LegendCanvasCoordinate;
|
|
213
|
+
bottom: LegendCanvasCoordinate;
|
|
214
|
+
left: LegendCanvasCoordinate;
|
|
215
|
+
right: LegendCanvasCoordinate;
|
|
216
|
+
}
|
|
217
|
+
export interface TitleBlockModel extends ComponentBlockModel {
|
|
218
|
+
}
|
|
219
|
+
interface LegendCanvasCoordinate extends ComponentBlockModel {
|
|
220
|
+
}
|
|
221
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { MdtChartsConfig, MdtChartsDataSource } from '../config/config';
|
|
2
|
+
import { Model } from './model';
|
|
3
|
+
import { DesignerConfig } from '../designer/designerConfig';
|
|
4
|
+
export declare enum AxisType {
|
|
5
|
+
Key = 0,
|
|
6
|
+
Value = 1
|
|
7
|
+
}
|
|
8
|
+
export declare const CLASSES: {
|
|
9
|
+
dataLabel: string;
|
|
10
|
+
legendLabel: string;
|
|
11
|
+
legendColor: string;
|
|
12
|
+
legendItem: string;
|
|
13
|
+
};
|
|
14
|
+
export declare function assembleModel(config: MdtChartsConfig, data: MdtChartsDataSource, designerConfig: DesignerConfig): Model;
|
|
15
|
+
export declare function getPreparedData(model: Model, data: MdtChartsDataSource, config: MdtChartsConfig): MdtChartsDataSource;
|
|
16
|
+
export declare function getUpdatedModel(config: MdtChartsConfig, data: MdtChartsDataSource, designerConfig: DesignerConfig): Model;
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import { MarginModel } from './marginModel';
|
|
2
|
+
import { TwoDimensionalModel } from './notations/twoDimensionalModel';
|
|
3
|
+
import { PolarModel } from './notations/polarModel';
|
|
4
|
+
import { DataManagerModel } from './dataManagerModel';
|
|
5
|
+
import { IntervalModel } from './notations/intervalModel';
|
|
6
|
+
import { OtherComponentsModel } from './featuresModel/otherComponents';
|
|
7
|
+
import { ConfigValidator } from './configsValidator/configValidator';
|
|
8
|
+
export var AxisType;
|
|
9
|
+
(function (AxisType) {
|
|
10
|
+
AxisType[AxisType["Key"] = 0] = "Key";
|
|
11
|
+
AxisType[AxisType["Value"] = 1] = "Value";
|
|
12
|
+
})(AxisType || (AxisType = {}));
|
|
13
|
+
export const CLASSES = {
|
|
14
|
+
dataLabel: 'data-label',
|
|
15
|
+
legendLabel: 'legend-label',
|
|
16
|
+
legendColor: 'legend-circle',
|
|
17
|
+
legendItem: 'legend-item',
|
|
18
|
+
};
|
|
19
|
+
function getBlockCanvas(config) {
|
|
20
|
+
const size = ConfigValidator.validateCanvasSize(config.canvas.size) ? Object.assign({}, config.canvas.size) : { width: 0, height: 0 };
|
|
21
|
+
return {
|
|
22
|
+
size,
|
|
23
|
+
cssClass: config.canvas.class
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
function getChartBlock(margin) {
|
|
27
|
+
return {
|
|
28
|
+
margin
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
function getOptions(config, designerConfig, margin, dataScope, data) {
|
|
32
|
+
if (config.options.type === '2d') {
|
|
33
|
+
return TwoDimensionalModel.getOptions(config, designerConfig, margin, dataScope, data);
|
|
34
|
+
}
|
|
35
|
+
else if (config.options.type === 'polar') {
|
|
36
|
+
return PolarModel.getOptions(config, data, margin, designerConfig);
|
|
37
|
+
}
|
|
38
|
+
else if (config.options.type === 'interval') {
|
|
39
|
+
return IntervalModel.getOptions(config, designerConfig, margin, dataScope, data);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
function getDataSettings(dataScope, designerConfig) {
|
|
43
|
+
return {
|
|
44
|
+
scope: dataScope,
|
|
45
|
+
format: getDataFormat(designerConfig)
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
function getChartSettings(barSettings, donutSettings) {
|
|
49
|
+
return {
|
|
50
|
+
bar: Object.assign({}, barSettings),
|
|
51
|
+
donut: Object.assign({}, donutSettings)
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
function getDataFormat(designerConfig) {
|
|
55
|
+
return {
|
|
56
|
+
formatters: designerConfig.dataFormat.formatters
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
function getTransitions(designerConfig) {
|
|
60
|
+
return designerConfig.transitions;
|
|
61
|
+
}
|
|
62
|
+
function roundMargin(margin) {
|
|
63
|
+
margin.top = Math.ceil(margin.top);
|
|
64
|
+
margin.bottom = Math.ceil(margin.bottom);
|
|
65
|
+
margin.left = Math.ceil(margin.left);
|
|
66
|
+
margin.right = Math.ceil(margin.right);
|
|
67
|
+
}
|
|
68
|
+
export function assembleModel(config, data, designerConfig) {
|
|
69
|
+
if (!data || Object.keys(data).length === 0)
|
|
70
|
+
return {
|
|
71
|
+
blockCanvas: getBlockCanvas(config),
|
|
72
|
+
chartBlock: null,
|
|
73
|
+
otherComponents: null,
|
|
74
|
+
options: null,
|
|
75
|
+
dataSettings: null,
|
|
76
|
+
chartSettings: null
|
|
77
|
+
};
|
|
78
|
+
resetFalsyValues(data, config.options.data.keyField.name);
|
|
79
|
+
const otherComponents = OtherComponentsModel.getOtherComponentsModel(designerConfig.elementsOptions, config.options.type);
|
|
80
|
+
const margin = MarginModel.getMargin(designerConfig, config, otherComponents, data);
|
|
81
|
+
const dataScope = DataManagerModel.getDataScope(config, margin, data, designerConfig, otherComponents.legendBlock);
|
|
82
|
+
const preparedData = DataManagerModel.getPreparedData(data, dataScope.allowableKeys, config);
|
|
83
|
+
if (config.options.type === '2d' && config.options.axis.key.visibility)
|
|
84
|
+
MarginModel.recalcMarginByVerticalAxisLabel(margin, config, designerConfig, dataScope);
|
|
85
|
+
const blockCanvas = getBlockCanvas(config);
|
|
86
|
+
const chartBlock = getChartBlock(margin);
|
|
87
|
+
const options = getOptions(config, designerConfig, margin, dataScope, preparedData);
|
|
88
|
+
const dataSettings = getDataSettings(dataScope, designerConfig);
|
|
89
|
+
const chartSettings = getChartSettings(designerConfig.canvas.chartOptions.bar, designerConfig.canvas.chartOptions.donut);
|
|
90
|
+
const transitions = getTransitions(designerConfig);
|
|
91
|
+
if (options.type === 'polar')
|
|
92
|
+
MarginModel.recalcPolarMarginWithScopedData(margin, config.canvas.size, designerConfig, config, otherComponents.legendBlock, dataScope, options);
|
|
93
|
+
roundMargin(margin);
|
|
94
|
+
return {
|
|
95
|
+
blockCanvas,
|
|
96
|
+
chartBlock,
|
|
97
|
+
otherComponents,
|
|
98
|
+
options,
|
|
99
|
+
dataSettings,
|
|
100
|
+
chartSettings,
|
|
101
|
+
transitions
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
function resetFalsyValues(data, keyFieldName) {
|
|
105
|
+
for (let setName in data) {
|
|
106
|
+
data[setName].forEach(dataRow => {
|
|
107
|
+
for (let fieldName in dataRow) {
|
|
108
|
+
if (fieldName === keyFieldName && !dataRow[fieldName]) {
|
|
109
|
+
dataRow[fieldName] = '';
|
|
110
|
+
}
|
|
111
|
+
else if (dataRow[fieldName] !== 0 && !dataRow[fieldName]) {
|
|
112
|
+
dataRow[fieldName] = 0;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
export function getPreparedData(model, data, config) {
|
|
119
|
+
resetFalsyValues(data, config.options.data.keyField.name);
|
|
120
|
+
const isModelOrDataEmpty = !model || Object.keys(model).length === 0 || !data || Object.keys(data).length === 0;
|
|
121
|
+
if (isModelOrDataEmpty)
|
|
122
|
+
return null;
|
|
123
|
+
const preparedData = DataManagerModel.getPreparedData(data, model.dataSettings.scope.allowableKeys, config);
|
|
124
|
+
return preparedData;
|
|
125
|
+
}
|
|
126
|
+
export function getUpdatedModel(config, data, designerConfig) {
|
|
127
|
+
return assembleModel(config, data, designerConfig);
|
|
128
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { MdtChartsDataSource, IntervalChart } from "../config/config";
|
|
2
|
+
export declare class ModelHelper {
|
|
3
|
+
static getSum(items: number[]): number;
|
|
4
|
+
static getMinAndMaxOfIntervalData(data: MdtChartsDataSource, dataSource: string, chart: IntervalChart): [Date, Date];
|
|
5
|
+
static getUniqueValues(values: string[]): string[];
|
|
6
|
+
static getStringScore(word: string): number;
|
|
7
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
export class ModelHelper {
|
|
2
|
+
static getSum(items) {
|
|
3
|
+
return items.reduce((acc, item) => acc + item, 0);
|
|
4
|
+
}
|
|
5
|
+
static getMinAndMaxOfIntervalData(data, dataSource, chart) {
|
|
6
|
+
let min = data[dataSource][0][chart.data.valueField1.name];
|
|
7
|
+
let max = data[dataSource][0][chart.data.valueField1.name];
|
|
8
|
+
const chartData = data[dataSource];
|
|
9
|
+
const valueField1 = chart.data.valueField1.name;
|
|
10
|
+
const valueField2 = chart.data.valueField2.name;
|
|
11
|
+
chartData.forEach(dataRow => {
|
|
12
|
+
if (dataRow[valueField1] > max)
|
|
13
|
+
max = dataRow[valueField1];
|
|
14
|
+
if (dataRow[valueField1] < min)
|
|
15
|
+
min = dataRow[valueField1];
|
|
16
|
+
if (dataRow[valueField2] > max)
|
|
17
|
+
max = dataRow[valueField2];
|
|
18
|
+
if (dataRow[valueField2] < min)
|
|
19
|
+
min = dataRow[valueField2];
|
|
20
|
+
});
|
|
21
|
+
return [min, max];
|
|
22
|
+
}
|
|
23
|
+
static getUniqueValues(values) {
|
|
24
|
+
const uniqueValues = values.filter((keyValue, index, self) => self.indexOf(keyValue) === index);
|
|
25
|
+
return uniqueValues;
|
|
26
|
+
}
|
|
27
|
+
static getStringScore(word) {
|
|
28
|
+
// lower case letter width ~ 0.74 from upper case width.
|
|
29
|
+
// Number width == lower case letter width
|
|
30
|
+
let score = 0;
|
|
31
|
+
const upperLetterScore = 1;
|
|
32
|
+
const lowerLetterScore = 0.74;
|
|
33
|
+
for (let i = 0; i < word.length; i++) {
|
|
34
|
+
if (word[i].toUpperCase() === word[i] && parseFloat(word[i]).toString() !== word[i])
|
|
35
|
+
score += upperLetterScore;
|
|
36
|
+
else
|
|
37
|
+
score += lowerLetterScore;
|
|
38
|
+
}
|
|
39
|
+
return score;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { MdtChartsConfig, MdtChartsDataSource, IntervalOptions } from "../../config/config";
|
|
2
|
+
import { DesignerConfig } from "../../designer/designerConfig";
|
|
3
|
+
import { AdditionalElementsOptions, BlockMargin, DataScope, IntervalOptionsModel } from "../model";
|
|
4
|
+
export declare class IntervalModel {
|
|
5
|
+
static getOptions(config: MdtChartsConfig, designerConfig: DesignerConfig, margin: BlockMargin, dataScope: DataScope, data: MdtChartsDataSource): IntervalOptionsModel;
|
|
6
|
+
static getAdditionalElements(options: IntervalOptions): AdditionalElementsOptions;
|
|
7
|
+
private static getChartsModel;
|
|
8
|
+
}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { AxisModel } from "../featuresModel/axisModel";
|
|
2
|
+
import { ChartStyleModel } from "../chartStyleModel";
|
|
3
|
+
import { DataManagerModel } from "../dataManagerModel";
|
|
4
|
+
import { LegendModel } from "../featuresModel/legendModel/legendModel";
|
|
5
|
+
import { AxisType } from "../modelBuilder";
|
|
6
|
+
import { ScaleModel, ScaleType } from "../featuresModel/scaleModel";
|
|
7
|
+
export class IntervalModel {
|
|
8
|
+
static getOptions(config, designerConfig, margin, dataScope, data) {
|
|
9
|
+
const options = config.options;
|
|
10
|
+
return {
|
|
11
|
+
legend: LegendModel.getLegendModel(config.options.type, config.options.legend.show, config.canvas.size, margin),
|
|
12
|
+
title: options.title,
|
|
13
|
+
selectable: !!options.selectable,
|
|
14
|
+
orient: options.orientation,
|
|
15
|
+
scale: {
|
|
16
|
+
key: {
|
|
17
|
+
domain: dataScope.allowableKeys,
|
|
18
|
+
range: {
|
|
19
|
+
start: 0,
|
|
20
|
+
end: ScaleModel.getRangePeek(ScaleType.Key, options.orientation, margin, config.canvas.size)
|
|
21
|
+
},
|
|
22
|
+
type: 'band',
|
|
23
|
+
elementsAmount: 1
|
|
24
|
+
},
|
|
25
|
+
value: {
|
|
26
|
+
domain: ScaleModel.getDateValueDomain(data, options.chart, options.axis.key.position, options.data.dataSource),
|
|
27
|
+
range: {
|
|
28
|
+
start: 0,
|
|
29
|
+
end: ScaleModel.getRangePeek(ScaleType.Value, options.orientation, margin, config.canvas.size)
|
|
30
|
+
},
|
|
31
|
+
type: 'datetime'
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
axis: {
|
|
35
|
+
key: {
|
|
36
|
+
type: 'key',
|
|
37
|
+
orient: AxisModel.getAxisOrient(AxisType.Key, options.orientation, options.axis.key.position),
|
|
38
|
+
translate: {
|
|
39
|
+
translateX: AxisModel.getAxisTranslateX(AxisType.Key, options.orientation, options.axis.key.position, margin, config.canvas.size.width),
|
|
40
|
+
translateY: AxisModel.getAxisTranslateY(AxisType.Key, options.orientation, options.axis.key.position, margin, config.canvas.size.height)
|
|
41
|
+
},
|
|
42
|
+
cssClass: 'key-axis',
|
|
43
|
+
ticks: options.axis.key.ticks,
|
|
44
|
+
labels: {
|
|
45
|
+
maxSize: AxisModel.getLabelSize(designerConfig.canvas.axisLabel.maxSize.main, data[options.data.dataSource].map(d => d[options.data.keyField.name])).width,
|
|
46
|
+
position: AxisModel.getKeyAxisLabelPosition(margin, config.canvas.size, DataManagerModel.getDataValuesByKeyField(data, options.data.dataSource, options.data.keyField.name).length),
|
|
47
|
+
visible: true,
|
|
48
|
+
defaultTooltip: designerConfig.elementsOptions.tooltip.position === 'fixed'
|
|
49
|
+
},
|
|
50
|
+
visibility: options.axis.key.visibility
|
|
51
|
+
},
|
|
52
|
+
value: {
|
|
53
|
+
type: 'value',
|
|
54
|
+
orient: AxisModel.getAxisOrient(AxisType.Value, options.orientation, options.axis.value.position),
|
|
55
|
+
translate: {
|
|
56
|
+
translateX: AxisModel.getAxisTranslateX(AxisType.Value, options.orientation, options.axis.value.position, margin, config.canvas.size.width),
|
|
57
|
+
translateY: AxisModel.getAxisTranslateY(AxisType.Value, options.orientation, options.axis.value.position, margin, config.canvas.size.height)
|
|
58
|
+
},
|
|
59
|
+
cssClass: 'value-axis',
|
|
60
|
+
ticks: options.axis.value.ticks,
|
|
61
|
+
labels: {
|
|
62
|
+
maxSize: designerConfig.canvas.axisLabel.maxSize.main,
|
|
63
|
+
position: 'straight',
|
|
64
|
+
visible: true,
|
|
65
|
+
defaultTooltip: true
|
|
66
|
+
},
|
|
67
|
+
visibility: options.axis.value.visibility
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
data: Object.assign({}, options.data),
|
|
71
|
+
type: options.type,
|
|
72
|
+
charts: this.getChartsModel(options.chart, designerConfig.chartStyle),
|
|
73
|
+
additionalElements: this.getAdditionalElements(options),
|
|
74
|
+
tooltip: options.tooltip
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
static getAdditionalElements(options) {
|
|
78
|
+
return {
|
|
79
|
+
gridLine: options.additionalElements.gridLine
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
static getChartsModel(chart, chartStyleConfig) {
|
|
83
|
+
const chartsModel = [];
|
|
84
|
+
chartsModel.push({
|
|
85
|
+
type: chart.type,
|
|
86
|
+
data: Object.assign({}, chart.data),
|
|
87
|
+
tooltip: chart.tooltip,
|
|
88
|
+
cssClasses: ChartStyleModel.getCssClasses(0),
|
|
89
|
+
style: ChartStyleModel.getChartStyle(1, chartStyleConfig)
|
|
90
|
+
});
|
|
91
|
+
return chartsModel;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { MdtChartsConfig, MdtChartsDataSource } from "../../config/config";
|
|
2
|
+
import { DesignerConfig } from "../../designer/designerConfig";
|
|
3
|
+
import { BlockMargin, PolarOptionsModel } from "../model";
|
|
4
|
+
export declare class PolarModel {
|
|
5
|
+
static getOptions(config: MdtChartsConfig, data: MdtChartsDataSource, margin: BlockMargin, designerConfig: DesignerConfig): PolarOptionsModel;
|
|
6
|
+
private static getChartsModel;
|
|
7
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { ChartStyleModel } from "../chartStyleModel";
|
|
2
|
+
import { LegendModel } from "../featuresModel/legendModel/legendModel";
|
|
3
|
+
export class PolarModel {
|
|
4
|
+
static getOptions(config, data, margin, designerConfig) {
|
|
5
|
+
const options = config.options;
|
|
6
|
+
return {
|
|
7
|
+
type: options.type,
|
|
8
|
+
selectable: !!options.selectable,
|
|
9
|
+
title: options.title,
|
|
10
|
+
data: Object.assign({}, options.data),
|
|
11
|
+
charts: this.getChartsModel(options.chart, data[options.data.dataSource].length, designerConfig.chartStyle),
|
|
12
|
+
legend: LegendModel.getLegendModel(config.options.type, config.options.legend.show, config.canvas.size, margin),
|
|
13
|
+
tooltip: options.tooltip
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
static getChartsModel(chart, dataLength, chartStyleConfig) {
|
|
17
|
+
const chartsModel = [];
|
|
18
|
+
chartsModel.push({
|
|
19
|
+
type: chart.type,
|
|
20
|
+
data: Object.assign({}, chart.data),
|
|
21
|
+
tooltip: chart.tooltip,
|
|
22
|
+
cssClasses: ChartStyleModel.getCssClasses(0),
|
|
23
|
+
style: ChartStyleModel.getChartStyle(dataLength, chartStyleConfig)
|
|
24
|
+
});
|
|
25
|
+
return chartsModel;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { ChartOrientation, MdtChartsConfig, MdtChartsDataSource, TwoDimensionalChart } from "../../config/config";
|
|
2
|
+
import { DesignerConfig } from "../../designer/designerConfig";
|
|
3
|
+
import { BlockMargin, DataScope, TwoDimensionalOptionsModel } from "../model";
|
|
4
|
+
export declare class TwoDimensionalModel {
|
|
5
|
+
static getOptions(config: MdtChartsConfig, designerConfig: DesignerConfig, margin: BlockMargin, dataScope: DataScope, data: MdtChartsDataSource): TwoDimensionalOptionsModel;
|
|
6
|
+
static getChartsEmbeddedLabelsFlag(charts: TwoDimensionalChart[], chartOrientation: ChartOrientation): boolean;
|
|
7
|
+
/**
|
|
8
|
+
* Сортирует список чартов в порядке: area - bar - line.
|
|
9
|
+
* Используется для того, чтобы при рендере графики с наибольшей площадью (area) не перекрывали графики с меньшей площадью (bar, line).
|
|
10
|
+
* @param charts Чарты из конфига
|
|
11
|
+
*/
|
|
12
|
+
static sortCharts(charts: TwoDimensionalChart[]): void;
|
|
13
|
+
private static getChartsModel;
|
|
14
|
+
private static findChartsWithEmbeddedKeyLabels;
|
|
15
|
+
private static getEmbeddedLabelType;
|
|
16
|
+
private static getAdditionalElements;
|
|
17
|
+
private static getChartsByType;
|
|
18
|
+
private static getChartsValueFieldsAmount;
|
|
19
|
+
}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { ChartStyleModel } from "../chartStyleModel";
|
|
2
|
+
import { AxisModel } from "../featuresModel/axisModel";
|
|
3
|
+
import { LegendModel } from "../featuresModel/legendModel/legendModel";
|
|
4
|
+
import { ScaleModel } from "../featuresModel/scaleModel";
|
|
5
|
+
export class TwoDimensionalModel {
|
|
6
|
+
static getOptions(config, designerConfig, margin, dataScope, data) {
|
|
7
|
+
const options = config.options;
|
|
8
|
+
return {
|
|
9
|
+
legend: LegendModel.getLegendModel(config.options.type, config.options.legend.show, config.canvas.size, margin),
|
|
10
|
+
title: options.title,
|
|
11
|
+
selectable: !!options.selectable,
|
|
12
|
+
orient: options.orientation,
|
|
13
|
+
scale: {
|
|
14
|
+
key: ScaleModel.getScaleKey(dataScope.allowableKeys, options.orientation, margin, config.canvas.size, options.charts, this.getChartsByType(options.charts, 'bar')),
|
|
15
|
+
value: ScaleModel.getScaleLinear(options, data, margin, config.canvas.size)
|
|
16
|
+
},
|
|
17
|
+
axis: {
|
|
18
|
+
key: AxisModel.getKeyAxis(options.charts, data, options.data, options.orientation, options.axis.key, designerConfig.canvas.axisLabel, margin, config.canvas.size, designerConfig.elementsOptions.tooltip),
|
|
19
|
+
value: AxisModel.getValueAxis(options.orientation, options.axis.value, designerConfig.canvas.axisLabel, margin, config.canvas.size)
|
|
20
|
+
},
|
|
21
|
+
type: options.type,
|
|
22
|
+
data: Object.assign({}, options.data),
|
|
23
|
+
charts: this.getChartsModel(options.charts, options.orientation, designerConfig.chartStyle),
|
|
24
|
+
additionalElements: this.getAdditionalElements(options),
|
|
25
|
+
tooltip: options.tooltip
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
static getChartsEmbeddedLabelsFlag(charts, chartOrientation) {
|
|
29
|
+
// Если НЕ найден хотя бы один чарт, который сегментированный или хотя бы один НЕ бар чарт, то лейблы можно прятать
|
|
30
|
+
return charts.findIndex(chart => chart.isSegmented || chart.type !== 'bar') === -1
|
|
31
|
+
&& chartOrientation === 'horizontal'
|
|
32
|
+
&& charts.length === this.findChartsWithEmbeddedKeyLabels(charts).length;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Сортирует список чартов в порядке: area - bar - line.
|
|
36
|
+
* Используется для того, чтобы при рендере графики с наибольшей площадью (area) не перекрывали графики с меньшей площадью (bar, line).
|
|
37
|
+
* @param charts Чарты из конфига
|
|
38
|
+
*/
|
|
39
|
+
static sortCharts(charts) {
|
|
40
|
+
const chartOrder = ['area', 'bar', 'line'];
|
|
41
|
+
charts.sort((chart1, chart2) => chartOrder.indexOf(chart1.type) - chartOrder.indexOf(chart2.type));
|
|
42
|
+
}
|
|
43
|
+
static getChartsModel(charts, chartOrientation, chartStyleConfig) {
|
|
44
|
+
this.sortCharts(charts);
|
|
45
|
+
const chartsModel = [];
|
|
46
|
+
charts.forEach((chart, index) => {
|
|
47
|
+
chartsModel.push({
|
|
48
|
+
type: chart.type,
|
|
49
|
+
isSegmented: chart.isSegmented,
|
|
50
|
+
data: Object.assign({}, chart.data),
|
|
51
|
+
tooltip: chart.tooltip,
|
|
52
|
+
cssClasses: ChartStyleModel.getCssClasses(index),
|
|
53
|
+
style: ChartStyleModel.get2DChartStyle(charts.length, chart.type, this.getChartsValueFieldsAmount(charts), index, chart.isSegmented, chartStyleConfig),
|
|
54
|
+
embeddedLabels: this.getEmbeddedLabelType(chart, chartOrientation),
|
|
55
|
+
markersOptions: chart.markers,
|
|
56
|
+
index
|
|
57
|
+
});
|
|
58
|
+
});
|
|
59
|
+
return chartsModel;
|
|
60
|
+
}
|
|
61
|
+
static findChartsWithEmbeddedKeyLabels(charts) {
|
|
62
|
+
const chartsWithEmbeddedLabels = [];
|
|
63
|
+
charts.forEach(chart => {
|
|
64
|
+
if (chart.type === 'bar' && chart.embeddedLabels === 'key')
|
|
65
|
+
chartsWithEmbeddedLabels.push(chart);
|
|
66
|
+
});
|
|
67
|
+
return chartsWithEmbeddedLabels;
|
|
68
|
+
}
|
|
69
|
+
static getEmbeddedLabelType(currentChart, chartOrientation) {
|
|
70
|
+
if (chartOrientation === 'horizontal' && currentChart.type === 'bar')
|
|
71
|
+
return currentChart.embeddedLabels;
|
|
72
|
+
return 'none';
|
|
73
|
+
}
|
|
74
|
+
static getAdditionalElements(options) {
|
|
75
|
+
return {
|
|
76
|
+
gridLine: options.additionalElements.gridLine
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
static getChartsByType(charts, type) {
|
|
80
|
+
return charts.filter(chart => chart.type === type);
|
|
81
|
+
}
|
|
82
|
+
static getChartsValueFieldsAmount(charts) {
|
|
83
|
+
return charts.map(chart => chart.data.valueFields.length);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { SizeValidator } from "./validators/sizeValidator";
|
|
2
|
+
class PublicOptionsServiceClass {
|
|
3
|
+
validateSize(size) {
|
|
4
|
+
const validator = new SizeValidator();
|
|
5
|
+
return validator.validate(size);
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
export const PublicOptionsService = new PublicOptionsServiceClass();
|