mdt-charts 1.11.1 → 1.12.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 +25 -12
- package/lib/designer/designerConfig.d.ts +3 -5
- package/lib/engine/features/aggregator/aggregator.d.ts +8 -6
- package/lib/engine/features/aggregator/aggregator.js +45 -32
- package/lib/engine/features/legend/legend.d.ts +10 -1
- package/lib/engine/features/legend/legend.js +10 -22
- package/lib/engine/features/legend/legendHelper.d.ts +4 -5
- package/lib/engine/features/legend/legendHelper.js +19 -23
- package/lib/engine/features/legend/legendHelperService.d.ts +12 -0
- package/lib/engine/features/legend/legendHelperService.js +30 -0
- package/lib/engine/features/recordOverflowAlert/recordOverflowAlertCore.d.ts +28 -0
- package/lib/engine/features/recordOverflowAlert/recordOverflowAlertCore.js +50 -0
- package/lib/engine/intervalNotation/intervalManager.js +0 -3
- package/lib/engine/polarNotation/donut/donut.js +1 -1
- package/lib/engine/polarNotation/extenders/polarRecordOverflowAlert.d.ts +15 -0
- package/lib/engine/polarNotation/extenders/polarRecordOverflowAlert.js +40 -0
- package/lib/engine/polarNotation/polarManager.js +11 -6
- package/lib/engine/twoDimensionalNotation/extenders/twoDimRecordOverflowAlert.d.ts +15 -0
- package/lib/engine/twoDimensionalNotation/extenders/twoDimRecordOverflowAlert.js +32 -0
- package/lib/engine/twoDimensionalNotation/twoDimensionalManager.js +9 -3
- package/lib/model/chartStyleModel/TwoDimensionalChartStyleModel.d.ts +4 -4
- package/lib/model/{dataManagerModel.d.ts → dataManagerModel/dataManagerModel.d.ts} +18 -7
- package/lib/model/{dataManagerModel.js → dataManagerModel/dataManagerModel.js} +51 -45
- package/lib/model/dataManagerModel/dataManagerModelService.d.ts +5 -0
- package/lib/model/dataManagerModel/dataManagerModelService.js +28 -0
- package/lib/model/featuresModel/axisModel.d.ts +5 -4
- package/lib/model/featuresModel/axisModel.js +14 -12
- package/lib/model/featuresModel/axisModelService.d.ts +4 -0
- package/lib/model/featuresModel/axisModelService.js +11 -0
- package/lib/model/featuresModel/legendModel/legendCanvasModel.d.ts +4 -2
- package/lib/model/featuresModel/legendModel/legendCanvasModel.js +42 -29
- package/lib/model/featuresModel/legendModel/legendModel.d.ts +1 -4
- package/lib/model/featuresModel/legendModel/legendModel.js +15 -16
- package/lib/model/featuresModel/legendModel/polarMarginCalculator.d.ts +11 -0
- package/lib/model/featuresModel/legendModel/polarMarginCalculator.js +42 -0
- package/lib/model/featuresModel/scaleModel.d.ts +6 -6
- package/lib/model/featuresModel/titleModel.js +4 -4
- package/lib/model/marginModel.d.ts +3 -2
- package/lib/model/marginModel.js +11 -7
- package/lib/model/model.d.ts +19 -8
- package/lib/model/modelBuilder.js +9 -9
- package/lib/model/modelInstance/canvasModel/canvasModel.d.ts +2 -0
- package/lib/model/modelInstance/canvasModel/canvasModel.js +2 -0
- package/lib/model/modelInstance/canvasModel/legendCanvasModel.d.ts +7 -0
- package/lib/model/modelInstance/canvasModel/legendCanvasModel.js +13 -0
- package/lib/model/modelInstance/dataModel.d.ts +11 -0
- package/lib/model/modelInstance/dataModel.js +23 -0
- package/lib/model/modelInstance/modelInstance.d.ts +3 -0
- package/lib/model/modelInstance/modelInstance.js +7 -1
- package/lib/model/notations/intervalModel.d.ts +2 -2
- package/lib/model/notations/intervalModel.js +2 -3
- package/lib/model/notations/polar/donut/donutAggregatorService.d.ts +12 -0
- package/lib/model/notations/polar/donut/donutAggregatorService.js +25 -0
- package/lib/model/notations/polar/donut/donutModel.d.ts +10 -0
- package/lib/model/notations/polar/donut/donutModel.js +32 -0
- package/lib/model/notations/polar/donut/donutThicknessService.d.ts +9 -0
- package/lib/model/notations/polar/donut/donutThicknessService.js +30 -0
- package/lib/model/notations/polar/polarModel.d.ts +16 -0
- package/lib/model/notations/polar/polarModel.js +55 -0
- package/lib/model/notations/polarModel.d.ts +7 -1
- package/lib/model/notations/polarModel.js +24 -2
- package/lib/model/notations/twoDimensionalModel.d.ts +4 -4
- package/lib/model/notations/twoDimensionalModel.js +2 -3
- package/lib/style/charts-main.css +29 -9
- package/lib/style/charts-main.less +29 -9
- package/package.json +2 -2
- package/tsconfig.production.json +23 -0
- package/lib/engine/features/recordOverflowAlert/recordOverflowAlert.d.ts +0 -14
- package/lib/engine/features/recordOverflowAlert/recordOverflowAlert.js +0 -97
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { MdtChartsDataSource, MdtChartsPolarOptions } from "../../../config/config";
|
|
2
|
+
import { DesignerConfig } from "../../../designer/designerConfig";
|
|
3
|
+
import { PolarOptionsModel, LegendCoordinate } from "../../model";
|
|
4
|
+
import { CanvasModel } from "../../modelInstance/canvasModel/canvasModel";
|
|
5
|
+
import { ModelInstance } from "../../modelInstance/modelInstance";
|
|
6
|
+
/** If donut block has width less than this const, legend change postion from "right" to "bottom" */
|
|
7
|
+
export declare const MIN_DONUT_BLOCK_SIZE = 120;
|
|
8
|
+
export declare class PolarModel {
|
|
9
|
+
private static donutModel;
|
|
10
|
+
static getOptions(options: MdtChartsPolarOptions, data: MdtChartsDataSource, designerConfig: DesignerConfig, modelInstance: ModelInstance): PolarOptionsModel;
|
|
11
|
+
static getLegendPositionByBlockSize(canvasModel: CanvasModel): "bottom" | "right";
|
|
12
|
+
static doesChartBlockHasEnoughWidthForContainsLegend(chartBlockWidth: number, legendWidth: number, legendCoordinate: LegendCoordinate): boolean;
|
|
13
|
+
static doesChartBlockHasEnoughHeightForContainsLegend(chartBlockHeight: number, legendCoordinate: LegendCoordinate): boolean;
|
|
14
|
+
private static getDonutSettings;
|
|
15
|
+
private static getChartsModel;
|
|
16
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { ChartStyleModelService } from "../../chartStyleModel/chartStyleModel";
|
|
2
|
+
import { DonutModel } from "./donut/donutModel";
|
|
3
|
+
/** If donut block has width less than this const, legend change postion from "right" to "bottom" */
|
|
4
|
+
export const MIN_DONUT_BLOCK_SIZE = 120;
|
|
5
|
+
export class PolarModel {
|
|
6
|
+
static getOptions(options, data, designerConfig, modelInstance) {
|
|
7
|
+
const dataRows = data[options.data.dataSource];
|
|
8
|
+
return {
|
|
9
|
+
type: options.type,
|
|
10
|
+
selectable: !!options.selectable,
|
|
11
|
+
title: options.title,
|
|
12
|
+
data: Object.assign({}, options.data),
|
|
13
|
+
charts: this.getChartsModel(options.chart, dataRows.length, designerConfig.chartStyle),
|
|
14
|
+
legend: modelInstance.canvasModel.legendCanvas.getModel(),
|
|
15
|
+
tooltip: options.tooltip,
|
|
16
|
+
chartCanvas: this.getDonutSettings(designerConfig.canvas.chartOptions.donut, options.chart, dataRows)
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
//TODO: type for returned value
|
|
20
|
+
static getLegendPositionByBlockSize(canvasModel) {
|
|
21
|
+
const widthCoefficientWhenLegendShouldInBottom = 1.5;
|
|
22
|
+
const avgLegendWidth = 100;
|
|
23
|
+
const blockWidth = canvasModel.getBlockSize().width;
|
|
24
|
+
const blockHeight = canvasModel.getBlockSize().height;
|
|
25
|
+
return canvasModel.getChartBlockWidth() < MIN_DONUT_BLOCK_SIZE + avgLegendWidth
|
|
26
|
+
&& blockWidth * widthCoefficientWhenLegendShouldInBottom < blockHeight
|
|
27
|
+
? 'bottom'
|
|
28
|
+
: 'right';
|
|
29
|
+
}
|
|
30
|
+
static doesChartBlockHasEnoughWidthForContainsLegend(chartBlockWidth, legendWidth, legendCoordinate) {
|
|
31
|
+
const rightLegendMargin = legendCoordinate.right.margin;
|
|
32
|
+
return chartBlockWidth - legendWidth - rightLegendMargin.left - rightLegendMargin.right >= MIN_DONUT_BLOCK_SIZE;
|
|
33
|
+
}
|
|
34
|
+
static doesChartBlockHasEnoughHeightForContainsLegend(chartBlockHeight, legendCoordinate) {
|
|
35
|
+
const minHeightForLegend = 30;
|
|
36
|
+
const bottomLegendMargin = legendCoordinate.bottom.margin;
|
|
37
|
+
const heightForLegend = chartBlockHeight - bottomLegendMargin.bottom - bottomLegendMargin.top - MIN_DONUT_BLOCK_SIZE;
|
|
38
|
+
return heightForLegend >= minHeightForLegend;
|
|
39
|
+
}
|
|
40
|
+
static getDonutSettings(settings, chartOptions, dataRows) {
|
|
41
|
+
return this.donutModel.getSettings(settings, chartOptions, dataRows);
|
|
42
|
+
}
|
|
43
|
+
static getChartsModel(chart, dataLength, chartStyleConfig) {
|
|
44
|
+
const chartsModel = [];
|
|
45
|
+
chartsModel.push({
|
|
46
|
+
type: chart.type,
|
|
47
|
+
data: Object.assign({}, chart.data),
|
|
48
|
+
tooltip: chart.tooltip,
|
|
49
|
+
cssClasses: ChartStyleModelService.getCssClasses(0),
|
|
50
|
+
style: ChartStyleModelService.getChartStyle(dataLength, chartStyleConfig)
|
|
51
|
+
});
|
|
52
|
+
return chartsModel;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
PolarModel.donutModel = new DonutModel();
|
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
import { MdtChartsDataSource, MdtChartsPolarOptions } from "../../config/config";
|
|
2
2
|
import { DesignerConfig } from "../../designer/designerConfig";
|
|
3
|
-
import { PolarOptionsModel } from "../model";
|
|
3
|
+
import { PolarOptionsModel, LegendCoordinate } from "../model";
|
|
4
|
+
import { CanvasModel } from "../modelInstance/canvasModel/canvasModel";
|
|
4
5
|
import { ModelInstance } from "../modelInstance/modelInstance";
|
|
6
|
+
/** If donut block has width less than this const, legend change postion from "right" to "bottom" */
|
|
7
|
+
export declare const MIN_DONUT_BLOCK_SIZE = 120;
|
|
5
8
|
export declare class PolarModel {
|
|
6
9
|
static getOptions(options: MdtChartsPolarOptions, data: MdtChartsDataSource, designerConfig: DesignerConfig, modelInstance: ModelInstance): PolarOptionsModel;
|
|
10
|
+
static getLegendPositionByBlockSize(canvasModel: CanvasModel): "bottom" | "right";
|
|
11
|
+
static doesChartBlockHasEnoughWidthForContainsLegend(chartBlockWidth: number, legendWidth: number, legendCoordinate: LegendCoordinate): boolean;
|
|
12
|
+
static doesChartBlockHasEnoughHeightForContainsLegend(chartBlockHeight: number, legendCoordinate: LegendCoordinate): boolean;
|
|
7
13
|
private static getDonutSettings;
|
|
8
14
|
private static getChartsModel;
|
|
9
15
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ChartStyleModelService } from "../chartStyleModel/chartStyleModel";
|
|
2
|
-
|
|
2
|
+
/** If donut block has width less than this const, legend change postion from "right" to "bottom" */
|
|
3
|
+
export const MIN_DONUT_BLOCK_SIZE = 120;
|
|
3
4
|
export class PolarModel {
|
|
4
5
|
static getOptions(options, data, designerConfig, modelInstance) {
|
|
5
6
|
return {
|
|
@@ -8,11 +9,32 @@ export class PolarModel {
|
|
|
8
9
|
title: options.title,
|
|
9
10
|
data: Object.assign({}, options.data),
|
|
10
11
|
charts: this.getChartsModel(options.chart, data[options.data.dataSource].length, designerConfig.chartStyle),
|
|
11
|
-
legend:
|
|
12
|
+
legend: modelInstance.canvasModel.legendCanvas.getModel(),
|
|
12
13
|
tooltip: options.tooltip,
|
|
13
14
|
chartCanvas: this.getDonutSettings(designerConfig.canvas.chartOptions.donut, options.chart)
|
|
14
15
|
};
|
|
15
16
|
}
|
|
17
|
+
//TODO: type for returned value
|
|
18
|
+
static getLegendPositionByBlockSize(canvasModel) {
|
|
19
|
+
const widthCoefficientWhenLegendShouldInBottom = 1.5;
|
|
20
|
+
const avgLegendWidth = 100;
|
|
21
|
+
const blockWidth = canvasModel.getBlockSize().width;
|
|
22
|
+
const blockHeight = canvasModel.getBlockSize().height;
|
|
23
|
+
return canvasModel.getChartBlockWidth() < MIN_DONUT_BLOCK_SIZE + avgLegendWidth
|
|
24
|
+
&& blockWidth * widthCoefficientWhenLegendShouldInBottom < blockHeight
|
|
25
|
+
? 'bottom'
|
|
26
|
+
: 'right';
|
|
27
|
+
}
|
|
28
|
+
static doesChartBlockHasEnoughWidthForContainsLegend(chartBlockWidth, legendWidth, legendCoordinate) {
|
|
29
|
+
const rightLegendMargin = legendCoordinate.right.margin;
|
|
30
|
+
return chartBlockWidth - legendWidth - rightLegendMargin.left - rightLegendMargin.right >= MIN_DONUT_BLOCK_SIZE;
|
|
31
|
+
}
|
|
32
|
+
static doesChartBlockHasEnoughHeightForContainsLegend(chartBlockHeight, legendCoordinate) {
|
|
33
|
+
const minHeightForLegend = 30;
|
|
34
|
+
const bottomLegendMargin = legendCoordinate.bottom.margin;
|
|
35
|
+
const heightForLegend = chartBlockHeight - bottomLegendMargin.bottom - bottomLegendMargin.top - MIN_DONUT_BLOCK_SIZE;
|
|
36
|
+
return heightForLegend >= minHeightForLegend;
|
|
37
|
+
}
|
|
16
38
|
static getDonutSettings(settings, chartOptions) {
|
|
17
39
|
return {
|
|
18
40
|
padAngle: settings.padAngle,
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import { ChartOrientation, MdtChartsDataSource,
|
|
1
|
+
import { ChartOrientation, MdtChartsDataSource, MdtChartsTwoDimensionalChart, MdtChartsTwoDimensionalOptions } from "../../config/config";
|
|
2
2
|
import { BarOptionsCanvas, DesignerConfig } from "../../designer/designerConfig";
|
|
3
3
|
import { DataScope, TwoDimensionalOptionsModel, TwoDimChartElementsSettings } from "../model";
|
|
4
4
|
import { ModelInstance } from "../modelInstance/modelInstance";
|
|
5
5
|
export declare class TwoDimensionalModel {
|
|
6
6
|
static getOptions(options: MdtChartsTwoDimensionalOptions, designerConfig: DesignerConfig, dataScope: DataScope, data: MdtChartsDataSource, modelInstance: ModelInstance): TwoDimensionalOptionsModel;
|
|
7
|
-
static getChartsEmbeddedLabelsFlag(charts:
|
|
7
|
+
static getChartsEmbeddedLabelsFlag(charts: MdtChartsTwoDimensionalChart[], chartOrientation: ChartOrientation): boolean;
|
|
8
8
|
/**
|
|
9
9
|
* Сортирует список чартов в порядке: area - bar - line.
|
|
10
10
|
* Используется для того, чтобы при рендере графики с наибольшей площадью (area) не перекрывали графики с меньшей площадью (bar, line).
|
|
11
11
|
* @param charts Чарты из конфига
|
|
12
12
|
*/
|
|
13
|
-
static sortCharts(charts:
|
|
13
|
+
static sortCharts(charts: MdtChartsTwoDimensionalChart[]): void;
|
|
14
14
|
static getChartsSettings(barSettings: BarOptionsCanvas): TwoDimChartElementsSettings;
|
|
15
15
|
private static getChartsModel;
|
|
16
16
|
private static findChartsWithEmbeddedKeyLabels;
|
|
17
17
|
private static getEmbeddedLabelType;
|
|
18
18
|
private static getAdditionalElements;
|
|
19
19
|
private static getChartsByType;
|
|
20
|
-
static getChartsValueFieldsAmount(charts:
|
|
20
|
+
static getChartsValueFieldsAmount(charts: MdtChartsTwoDimensionalChart[]): number[];
|
|
21
21
|
}
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import { ChartStyleModelService } from "../chartStyleModel/chartStyleModel";
|
|
2
2
|
import { TwoDimensionalChartStyleModel } from "../chartStyleModel/TwoDimensionalChartStyleModel";
|
|
3
3
|
import { AxisModel } from "../featuresModel/axisModel";
|
|
4
|
-
import { LegendModel } from "../featuresModel/legendModel/legendModel";
|
|
5
4
|
import { ScaleModel } from "../featuresModel/scaleModel";
|
|
6
5
|
export class TwoDimensionalModel {
|
|
7
6
|
static getOptions(options, designerConfig, dataScope, data, modelInstance) {
|
|
8
7
|
const canvasModel = modelInstance.canvasModel;
|
|
9
8
|
return {
|
|
10
|
-
legend:
|
|
9
|
+
legend: canvasModel.legendCanvas.getModel(),
|
|
11
10
|
title: options.title,
|
|
12
11
|
selectable: !!options.selectable,
|
|
13
12
|
orient: options.orientation,
|
|
@@ -16,7 +15,7 @@ export class TwoDimensionalModel {
|
|
|
16
15
|
value: ScaleModel.getScaleLinear(options, data, canvasModel)
|
|
17
16
|
},
|
|
18
17
|
axis: {
|
|
19
|
-
key: AxisModel.getKeyAxis(options
|
|
18
|
+
key: AxisModel.getKeyAxis(options, data, designerConfig.canvas.axisLabel, canvasModel, designerConfig.elementsOptions.tooltip),
|
|
20
19
|
value: AxisModel.getValueAxis(options.orientation, options.axis.value, designerConfig.canvas.axisLabel, canvasModel)
|
|
21
20
|
},
|
|
22
21
|
type: options.type,
|
|
@@ -41,28 +41,45 @@
|
|
|
41
41
|
|
|
42
42
|
|
|
43
43
|
/*========================================================================== Legend */
|
|
44
|
+
.legend-block {
|
|
45
|
+
display: flex;
|
|
46
|
+
height: 100%;
|
|
47
|
+
}
|
|
48
|
+
.legend-block-column {
|
|
49
|
+
flex-direction: column;
|
|
50
|
+
}
|
|
51
|
+
.legend-block-row {
|
|
52
|
+
flex-direction: row;
|
|
53
|
+
flex-wrap: wrap;
|
|
54
|
+
}
|
|
55
|
+
.legend-block-centered {
|
|
56
|
+
justify-content: center;
|
|
57
|
+
}
|
|
44
58
|
.legend-item {
|
|
45
59
|
cursor: default;
|
|
46
60
|
transition: opacity 0.1s;
|
|
61
|
+
/* will-change: opacity; */
|
|
62
|
+
}
|
|
63
|
+
.legend-block-column .legend-item:not(:first-of-type) {
|
|
64
|
+
margin-top: 15px;
|
|
47
65
|
}
|
|
48
66
|
.legend-item-inline {
|
|
49
67
|
white-space: nowrap;
|
|
68
|
+
overflow: hidden;
|
|
69
|
+
text-overflow: ellipsis;
|
|
50
70
|
}
|
|
51
|
-
.legend-item-inline:not(:first-of-type) {
|
|
71
|
+
.legend-wrapper-without-wrap .legend-item-inline:not(:first-of-type) {
|
|
52
72
|
margin-left: 20px;
|
|
53
73
|
}
|
|
74
|
+
.legend-wrapper-with-wrap .legend-item-inline {
|
|
75
|
+
margin: 5px;
|
|
76
|
+
}
|
|
54
77
|
.legend-item-row {
|
|
55
78
|
display: flex;
|
|
56
79
|
}
|
|
57
80
|
.legend-item-row > span {
|
|
58
81
|
display: block;
|
|
59
82
|
}
|
|
60
|
-
.mt-15 {
|
|
61
|
-
margin-top: 15px;
|
|
62
|
-
}
|
|
63
|
-
.mt-10 {
|
|
64
|
-
margin-top: 10px;
|
|
65
|
-
}
|
|
66
83
|
|
|
67
84
|
.legend-label {
|
|
68
85
|
font-size: 12px;
|
|
@@ -183,12 +200,15 @@
|
|
|
183
200
|
line-height: 1;
|
|
184
201
|
}
|
|
185
202
|
.aggregator-value {
|
|
186
|
-
margin-top:
|
|
203
|
+
margin-top: 0.5em;
|
|
187
204
|
pointer-events: auto;
|
|
188
205
|
}
|
|
189
206
|
.aggregator-name {
|
|
190
|
-
margin-top:
|
|
207
|
+
margin-top: 0.5em;
|
|
191
208
|
pointer-events: auto;
|
|
209
|
+
max-width: 90%;
|
|
210
|
+
overflow: hidden;
|
|
211
|
+
text-overflow: ellipsis;
|
|
192
212
|
}
|
|
193
213
|
|
|
194
214
|
/* Grid */
|
|
@@ -41,28 +41,45 @@
|
|
|
41
41
|
|
|
42
42
|
|
|
43
43
|
/*========================================================================== Legend */
|
|
44
|
+
.legend-block {
|
|
45
|
+
display: flex;
|
|
46
|
+
height: 100%;
|
|
47
|
+
}
|
|
48
|
+
.legend-block-column {
|
|
49
|
+
flex-direction: column;
|
|
50
|
+
}
|
|
51
|
+
.legend-block-row {
|
|
52
|
+
flex-direction: row;
|
|
53
|
+
flex-wrap: wrap;
|
|
54
|
+
}
|
|
55
|
+
.legend-block-centered {
|
|
56
|
+
justify-content: center;
|
|
57
|
+
}
|
|
44
58
|
.legend-item {
|
|
45
59
|
cursor: default;
|
|
46
60
|
transition: opacity 0.1s;
|
|
61
|
+
/* will-change: opacity; */
|
|
62
|
+
}
|
|
63
|
+
.legend-block-column .legend-item:not(:first-of-type) {
|
|
64
|
+
margin-top: 15px;
|
|
47
65
|
}
|
|
48
66
|
.legend-item-inline {
|
|
49
67
|
white-space: nowrap;
|
|
68
|
+
overflow: hidden;
|
|
69
|
+
text-overflow: ellipsis;
|
|
50
70
|
}
|
|
51
|
-
.legend-item-inline:not(:first-of-type) {
|
|
71
|
+
.legend-wrapper-without-wrap .legend-item-inline:not(:first-of-type) {
|
|
52
72
|
margin-left: 20px;
|
|
53
73
|
}
|
|
74
|
+
.legend-wrapper-with-wrap .legend-item-inline {
|
|
75
|
+
margin: 5px;
|
|
76
|
+
}
|
|
54
77
|
.legend-item-row {
|
|
55
78
|
display: flex;
|
|
56
79
|
}
|
|
57
80
|
.legend-item-row > span {
|
|
58
81
|
display: block;
|
|
59
82
|
}
|
|
60
|
-
.mt-15 {
|
|
61
|
-
margin-top: 15px;
|
|
62
|
-
}
|
|
63
|
-
.mt-10 {
|
|
64
|
-
margin-top: 10px;
|
|
65
|
-
}
|
|
66
83
|
|
|
67
84
|
.legend-label {
|
|
68
85
|
font-size: 12px;
|
|
@@ -183,12 +200,15 @@
|
|
|
183
200
|
line-height: 1;
|
|
184
201
|
}
|
|
185
202
|
.aggregator-value {
|
|
186
|
-
margin-top:
|
|
203
|
+
margin-top: 0.5em;
|
|
187
204
|
pointer-events: auto;
|
|
188
205
|
}
|
|
189
206
|
.aggregator-name {
|
|
190
|
-
margin-top:
|
|
207
|
+
margin-top: 0.5em;
|
|
191
208
|
pointer-events: auto;
|
|
209
|
+
max-width: 90%;
|
|
210
|
+
overflow: hidden;
|
|
211
|
+
text-overflow: ellipsis;
|
|
192
212
|
}
|
|
193
213
|
|
|
194
214
|
/* Grid */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mdt-charts",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.12.3",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "lib/main.js",
|
|
6
6
|
"scripts": {
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"build": "npx webpack --mode production",
|
|
9
9
|
"watch": "npx webpack --mode development --watch",
|
|
10
10
|
"test": "jest",
|
|
11
|
-
"build-lib": "npx tsc -p ."
|
|
11
|
+
"build-lib": "npx tsc -p tsconfig.production.json"
|
|
12
12
|
},
|
|
13
13
|
"homepage": "https://github.com/VishulaKnow/charts",
|
|
14
14
|
"author": "",
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"outDir": "./lib/",
|
|
4
|
+
"noImplicitAny": true,
|
|
5
|
+
"target": "es6",
|
|
6
|
+
"lib": ["ES2017", "DOM"],
|
|
7
|
+
"jsx": "react",
|
|
8
|
+
"allowJs": true,
|
|
9
|
+
"types": [
|
|
10
|
+
"jest"
|
|
11
|
+
],
|
|
12
|
+
"declaration": true
|
|
13
|
+
},
|
|
14
|
+
"include": [
|
|
15
|
+
"src"
|
|
16
|
+
],
|
|
17
|
+
"exclude": [
|
|
18
|
+
"node_modules",
|
|
19
|
+
"**/__tests__/*",
|
|
20
|
+
"src/playground/*",
|
|
21
|
+
"**/*Example.ts"
|
|
22
|
+
]
|
|
23
|
+
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { ChartOrientation } from "../../../config/config";
|
|
2
|
-
import { Block } from "../../block/block";
|
|
3
|
-
declare type AlertBlockPosition = 'top' | 'bottom' | 'right' | 'left';
|
|
4
|
-
export declare class RecordOverflowAlert {
|
|
5
|
-
private static readonly blockClass;
|
|
6
|
-
static render(block: Block, hidedRecordsAmount: number, position: AlertBlockPosition, chartOrientation?: ChartOrientation): void;
|
|
7
|
-
static update(block: Block, hidedRecordsAmount: number, position: AlertBlockPosition, chartOrientation?: ChartOrientation): void;
|
|
8
|
-
private static setAlertPosition;
|
|
9
|
-
private static getAlertText;
|
|
10
|
-
private static getWordTextEndingByAmount;
|
|
11
|
-
private static getBlockPositionAttrs;
|
|
12
|
-
private static getLeftAttrForRightBlock;
|
|
13
|
-
}
|
|
14
|
-
export {};
|
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
import { DomHelper } from '../../helpers/domHelper';
|
|
2
|
-
import { Legend } from '../legend/legend';
|
|
3
|
-
export class RecordOverflowAlert {
|
|
4
|
-
static render(block, hidedRecordsAmount, position, chartOrientation = null) {
|
|
5
|
-
const alertBlock = block.getWrapper()
|
|
6
|
-
.append('div')
|
|
7
|
-
.attr('class', this.blockClass)
|
|
8
|
-
.text(this.getAlertText(hidedRecordsAmount, chartOrientation));
|
|
9
|
-
const attrs = this.getBlockPositionAttrs(position, block);
|
|
10
|
-
this.setAlertPosition(alertBlock, attrs);
|
|
11
|
-
}
|
|
12
|
-
static update(block, hidedRecordsAmount, position, chartOrientation = null) {
|
|
13
|
-
let alertBlock = block.getWrapper()
|
|
14
|
-
.select(`div.${this.blockClass}`);
|
|
15
|
-
if (alertBlock.empty()) {
|
|
16
|
-
if (hidedRecordsAmount === 0)
|
|
17
|
-
return;
|
|
18
|
-
else
|
|
19
|
-
this.render(block, hidedRecordsAmount, position, chartOrientation);
|
|
20
|
-
}
|
|
21
|
-
else {
|
|
22
|
-
if (hidedRecordsAmount === 0)
|
|
23
|
-
alertBlock.remove();
|
|
24
|
-
else
|
|
25
|
-
alertBlock.text(this.getAlertText(hidedRecordsAmount, chartOrientation));
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
static setAlertPosition(alertBlock, attrs) {
|
|
29
|
-
alertBlock
|
|
30
|
-
.style('position', 'absolute')
|
|
31
|
-
.style('left', attrs.left)
|
|
32
|
-
.style('right', attrs.right)
|
|
33
|
-
.style('top', attrs.top)
|
|
34
|
-
.style('bottom', attrs.bottom);
|
|
35
|
-
}
|
|
36
|
-
static getAlertText(hidedRecordsAmount, chartOrientation) {
|
|
37
|
-
return `+ ${hidedRecordsAmount} ${this.getWordTextEndingByAmount(hidedRecordsAmount, chartOrientation)}`;
|
|
38
|
-
}
|
|
39
|
-
static getWordTextEndingByAmount(hidedRecordsAmount, chartOrientation) {
|
|
40
|
-
const lastDigit = hidedRecordsAmount % 10;
|
|
41
|
-
if (chartOrientation === 'vertical') {
|
|
42
|
-
if (hidedRecordsAmount >= 10 && hidedRecordsAmount <= 20)
|
|
43
|
-
return 'столбцов';
|
|
44
|
-
if (lastDigit === 1)
|
|
45
|
-
return 'столбец';
|
|
46
|
-
if (lastDigit >= 2 && lastDigit <= 4)
|
|
47
|
-
return 'столбца';
|
|
48
|
-
return 'столбцов';
|
|
49
|
-
}
|
|
50
|
-
else if (chartOrientation === 'horizontal') {
|
|
51
|
-
if (hidedRecordsAmount >= 10 && hidedRecordsAmount <= 20)
|
|
52
|
-
return 'строк';
|
|
53
|
-
if (lastDigit === 1)
|
|
54
|
-
return 'строка';
|
|
55
|
-
if (lastDigit >= 2 && lastDigit <= 4)
|
|
56
|
-
return 'строки';
|
|
57
|
-
return 'строк';
|
|
58
|
-
}
|
|
59
|
-
else {
|
|
60
|
-
if (hidedRecordsAmount >= 10 && hidedRecordsAmount <= 20)
|
|
61
|
-
return 'категорий';
|
|
62
|
-
if (lastDigit === 1)
|
|
63
|
-
return 'категория';
|
|
64
|
-
if (lastDigit >= 2 && lastDigit <= 4)
|
|
65
|
-
return 'категории';
|
|
66
|
-
return 'категорий';
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
static getBlockPositionAttrs(position, block) {
|
|
70
|
-
const attrs = {
|
|
71
|
-
bottom: null,
|
|
72
|
-
top: null,
|
|
73
|
-
right: null,
|
|
74
|
-
left: null
|
|
75
|
-
};
|
|
76
|
-
if (position === 'top') {
|
|
77
|
-
attrs.right = '17px';
|
|
78
|
-
attrs.top = '1rem';
|
|
79
|
-
}
|
|
80
|
-
if (position === 'right') {
|
|
81
|
-
attrs.bottom = '20px';
|
|
82
|
-
attrs.left = this.getLeftAttrForRightBlock(block) + 'px';
|
|
83
|
-
}
|
|
84
|
-
if (position === 'bottom') {
|
|
85
|
-
attrs.left = '20px';
|
|
86
|
-
attrs.bottom = '20px';
|
|
87
|
-
}
|
|
88
|
-
return attrs;
|
|
89
|
-
}
|
|
90
|
-
static getLeftAttrForRightBlock(block) {
|
|
91
|
-
const legendBlock = block.getSvg().select(`.${Legend.objectClass}`);
|
|
92
|
-
if (legendBlock.empty())
|
|
93
|
-
return null;
|
|
94
|
-
return DomHelper.getSelectionNumericAttr(legendBlock, 'x');
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
RecordOverflowAlert.blockClass = 'record-overflow-alert';
|