mdt-charts 1.28.2 → 1.29.1
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 +18 -29
- package/lib/engine/contentManager/contentManager.d.ts +2 -1
- package/lib/engine/contentManager/contentManager.js +2 -2
- package/lib/engine/contentManager/contentManagerFactory.d.ts +2 -2
- package/lib/engine/engine.d.ts +2 -2
- package/lib/engine/engine.js +2 -2
- package/lib/engine/features/legend/legend.d.ts +0 -1
- package/lib/engine/features/legend/legend.js +0 -1
- package/lib/engine/features/legend/legendHelper.js +1 -2
- package/lib/engine/features/recordOverflowAlert/recordOverflowAlertCore.d.ts +3 -21
- package/lib/engine/features/recordOverflowAlert/recordOverflowAlertCore.js +13 -26
- package/lib/engine/filterManager/filterEventManager.d.ts +6 -2
- package/lib/engine/filterManager/filterEventManager.js +6 -4
- package/lib/engine/polarNotation/polarManager.d.ts +2 -2
- package/lib/engine/polarNotation/polarManager.js +5 -11
- package/lib/engine/twoDimensionalNotation/twoDimensionalManager.d.ts +2 -2
- package/lib/engine/twoDimensionalNotation/twoDimensionalManager.js +5 -11
- package/lib/main.d.ts +6 -2
- package/lib/main.js +2 -2
- package/lib/model/featuresModel/recordOverflowModel/recordOverflowModel.d.ts +4 -0
- package/lib/model/featuresModel/recordOverflowModel/recordOverflowModel.js +33 -0
- package/lib/model/model.d.ts +16 -19
- package/lib/model/modelInstance/dataModel/dataModel.d.ts +1 -1
- package/lib/model/modelInstance/dataModel/dataModel.js +1 -1
- package/lib/model/notations/polar/polarModel.js +8 -1
- package/lib/model/notations/twoDimensionalModel.js +9 -1
- package/package.json +1 -1
- package/lib/engine/polarNotation/extenders/polarRecordOverflowAlert.d.ts +0 -15
- package/lib/engine/polarNotation/extenders/polarRecordOverflowAlert.js +0 -40
- package/lib/engine/twoDimensionalNotation/extenders/twoDimRecordOverflowAlert.d.ts +0 -15
- package/lib/engine/twoDimensionalNotation/extenders/twoDimRecordOverflowAlert.js +0 -32
package/lib/config/config.d.ts
CHANGED
|
@@ -2,11 +2,10 @@ declare type DataType = string;
|
|
|
2
2
|
export declare type MdtChartsIconElement = () => HTMLElement;
|
|
3
3
|
export declare type AxisPosition = "start" | "end";
|
|
4
4
|
export declare type ChartOrientation = "vertical" | "horizontal";
|
|
5
|
-
export declare type ChartNotation = "2d" | "polar"
|
|
5
|
+
export declare type ChartNotation = "2d" | "polar";
|
|
6
6
|
export declare type ChartType = "bar" | "line" | "area" | "donut" | "gantt";
|
|
7
7
|
export declare type TwoDimensionalChartType = "line" | "bar" | "area" | "dot";
|
|
8
8
|
export declare type PolarChartType = "donut";
|
|
9
|
-
export declare type IntervalChartType = "gantt";
|
|
10
9
|
export declare type EmbeddedLabelType = "none" | "key" | "value";
|
|
11
10
|
export declare type ValueLabelsCollisionMode = "none" | "hide";
|
|
12
11
|
export declare type TwoDimLegendPosition = "top" | "bottom";
|
|
@@ -22,7 +21,7 @@ export interface MdtChartsDataSource {
|
|
|
22
21
|
[source: string]: MdtChartsDataRow[];
|
|
23
22
|
}
|
|
24
23
|
export declare type AxisLabelPosition = "straight" | "rotated";
|
|
25
|
-
export declare type MdtChartsConfigOptions = MdtChartsPolarOptions | MdtChartsTwoDimensionalOptions
|
|
24
|
+
export declare type MdtChartsConfigOptions = MdtChartsPolarOptions | MdtChartsTwoDimensionalOptions;
|
|
26
25
|
export interface MdtChartsConfig {
|
|
27
26
|
canvas: ChartBlockCanvas;
|
|
28
27
|
options: MdtChartsConfigOptions;
|
|
@@ -39,15 +38,13 @@ export interface NewSize {
|
|
|
39
38
|
width?: number;
|
|
40
39
|
height?: number;
|
|
41
40
|
}
|
|
42
|
-
interface
|
|
43
|
-
tooltip?: TooltipOptions;
|
|
44
|
-
data: MdtChartsBasicDataOptions;
|
|
45
|
-
}
|
|
46
|
-
interface GraphicNotationOptions extends BasicOptions {
|
|
41
|
+
interface GraphicNotationOptions {
|
|
47
42
|
data: DataOptions;
|
|
48
43
|
legend: MdtChartsTwoDimLegend;
|
|
49
44
|
title?: Title;
|
|
50
45
|
selectable: boolean;
|
|
46
|
+
tooltip?: TooltipOptions;
|
|
47
|
+
recordOverflowAlert?: RecordOverflowAlertOptions;
|
|
51
48
|
}
|
|
52
49
|
export interface MdtChartsTwoDimensionalOptions extends GraphicNotationOptions {
|
|
53
50
|
type: "2d";
|
|
@@ -61,19 +58,25 @@ export interface MdtChartsPolarOptions extends GraphicNotationOptions {
|
|
|
61
58
|
type: "polar";
|
|
62
59
|
chart: PolarChart;
|
|
63
60
|
}
|
|
64
|
-
export interface MdtChartsIntervalOptions extends GraphicNotationOptions {
|
|
65
|
-
type: "interval";
|
|
66
|
-
axis: IntervalAxis;
|
|
67
|
-
chart: IntervalChart;
|
|
68
|
-
additionalElements: AdditionalElements;
|
|
69
|
-
orientation: ChartOrientation;
|
|
70
|
-
}
|
|
71
61
|
export interface Legend {
|
|
72
62
|
show: boolean;
|
|
73
63
|
}
|
|
74
64
|
export interface MdtChartsTwoDimLegend extends Legend {
|
|
75
65
|
position?: TwoDimLegendPosition;
|
|
76
66
|
}
|
|
67
|
+
export interface RecordOverflowAlertOptions {
|
|
68
|
+
textContent: RecordOverflowBlockTextContent;
|
|
69
|
+
}
|
|
70
|
+
export interface RecordOverflowVariationTextContent {
|
|
71
|
+
one: string;
|
|
72
|
+
twoToFour: string;
|
|
73
|
+
tenToTwenty: string;
|
|
74
|
+
other: string;
|
|
75
|
+
}
|
|
76
|
+
export interface RecordOverflowFunctionTextContent {
|
|
77
|
+
create: (overflowRecordsAmount: number) => string;
|
|
78
|
+
}
|
|
79
|
+
export declare type RecordOverflowBlockTextContent = RecordOverflowVariationTextContent | RecordOverflowFunctionTextContent;
|
|
77
80
|
export interface TitleFunctionParams {
|
|
78
81
|
data: MdtChartsDataRow[];
|
|
79
82
|
}
|
|
@@ -209,12 +212,6 @@ export interface ValueLabelsStyleOptions {
|
|
|
209
212
|
fontSize?: number;
|
|
210
213
|
color?: string;
|
|
211
214
|
}
|
|
212
|
-
export interface IntervalAxis {
|
|
213
|
-
key: DiscreteAxisOptions;
|
|
214
|
-
value: DateAxisOptions;
|
|
215
|
-
}
|
|
216
|
-
interface DateAxisOptions extends AxisOptions {
|
|
217
|
-
}
|
|
218
215
|
interface MdtChartsLineLikeChart {
|
|
219
216
|
markers: MarkersOptions;
|
|
220
217
|
lineStyles?: MdtChartsLineLikeChartStyles;
|
|
@@ -282,10 +279,6 @@ export interface PolarChart {
|
|
|
282
279
|
data: PolarChartData;
|
|
283
280
|
aggregator?: MdtChartsDonutAggregator;
|
|
284
281
|
}
|
|
285
|
-
export interface IntervalChart {
|
|
286
|
-
type: IntervalChartType;
|
|
287
|
-
data: IntervalChartData;
|
|
288
|
-
}
|
|
289
282
|
export interface TwoDimensionalChartData {
|
|
290
283
|
valueFields: TwoDimValueField[];
|
|
291
284
|
valueGroup?: TwoDimensionalValueGroup;
|
|
@@ -326,8 +319,4 @@ export interface MdtChartsAggregatorContent {
|
|
|
326
319
|
value?: string | number;
|
|
327
320
|
title?: string;
|
|
328
321
|
}
|
|
329
|
-
interface IntervalChartData {
|
|
330
|
-
valueField1: MdtChartsValueField;
|
|
331
|
-
valueField2: MdtChartsValueField;
|
|
332
|
-
}
|
|
333
322
|
export {};
|
|
@@ -2,11 +2,12 @@ import { Model } from "../../model/model";
|
|
|
2
2
|
import { Engine } from "../engine";
|
|
3
3
|
import { Block } from "../block/block";
|
|
4
4
|
import { MdtChartsDataSource } from "../../config/config";
|
|
5
|
+
import { ChartClearSelectionOptions } from "../filterManager/filterEventManager";
|
|
5
6
|
export declare class ContentManager {
|
|
6
7
|
private manager;
|
|
7
8
|
constructor(model: Model);
|
|
8
9
|
render(model: Model, engine: Engine): void;
|
|
9
10
|
updateData(block: Block, model: Model, newData: MdtChartsDataSource): void;
|
|
10
11
|
updateColors(engine: Engine, model: Model): void;
|
|
11
|
-
clearSelection(engine: Engine, model: Model): void;
|
|
12
|
+
clearSelection(engine: Engine, model: Model, options?: ChartClearSelectionOptions): void;
|
|
12
13
|
}
|
|
@@ -12,7 +12,7 @@ export class ContentManager {
|
|
|
12
12
|
updateColors(engine, model) {
|
|
13
13
|
this.manager.updateColors(engine.block, model);
|
|
14
14
|
}
|
|
15
|
-
clearSelection(engine, model) {
|
|
16
|
-
this.manager.clearSelection(engine.block.filterEventManager, model);
|
|
15
|
+
clearSelection(engine, model, options) {
|
|
16
|
+
this.manager.clearSelection(engine.block.filterEventManager, model, options);
|
|
17
17
|
}
|
|
18
18
|
}
|
|
@@ -2,12 +2,12 @@ import { ChartNotation, MdtChartsDataSource } from "../../config/config";
|
|
|
2
2
|
import { Model } from "../../model/model";
|
|
3
3
|
import { Block } from "../block/block";
|
|
4
4
|
import { Engine } from "../engine";
|
|
5
|
-
import { FilterEventManager } from "../filterManager/filterEventManager";
|
|
5
|
+
import { ChartClearSelectionOptions, FilterEventManager } from "../filterManager/filterEventManager";
|
|
6
6
|
export interface ChartContentManager {
|
|
7
7
|
render(engine: Engine, model: Model): void;
|
|
8
8
|
updateData(block: Block, model: Model, newData: MdtChartsDataSource): void;
|
|
9
9
|
updateColors(block: Block, model: Model): void;
|
|
10
|
-
clearSelection(filterEventManager: FilterEventManager, model: Model): void;
|
|
10
|
+
clearSelection(filterEventManager: FilterEventManager, model: Model, options?: ChartClearSelectionOptions): void;
|
|
11
11
|
}
|
|
12
12
|
export declare class ContentManagerFactory {
|
|
13
13
|
private managers;
|
package/lib/engine/engine.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Block } from "./block/block";
|
|
2
2
|
import { Model } from "../model/model";
|
|
3
|
-
import { FilterCallback } from "./filterManager/filterEventManager";
|
|
3
|
+
import { ChartClearSelectionOptions, FilterCallback } from "./filterManager/filterEventManager";
|
|
4
4
|
import { MdtChartsDataSource } from "../config/config";
|
|
5
5
|
export declare class Engine {
|
|
6
6
|
private filterCallback;
|
|
@@ -15,7 +15,7 @@ export declare class Engine {
|
|
|
15
15
|
updateFullBlock(model: Model, data: MdtChartsDataSource): void;
|
|
16
16
|
destroy(): void;
|
|
17
17
|
updateData(model: Model, newData: MdtChartsDataSource): void;
|
|
18
|
-
clearSelection(model: Model): void;
|
|
18
|
+
clearSelection(model: Model, options?: ChartClearSelectionOptions): void;
|
|
19
19
|
updateColors(model: Model): void;
|
|
20
20
|
private renderCharts;
|
|
21
21
|
private setFilterEventManager;
|
package/lib/engine/engine.js
CHANGED
|
@@ -47,8 +47,8 @@ export class Engine {
|
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
|
-
clearSelection(model) {
|
|
51
|
-
this.contentManager.clearSelection(this, model);
|
|
50
|
+
clearSelection(model, options) {
|
|
51
|
+
this.contentManager.clearSelection(this, model, options);
|
|
52
52
|
}
|
|
53
53
|
updateColors(model) {
|
|
54
54
|
this.contentManager.updateColors(this, model);
|
|
@@ -20,7 +20,6 @@ export declare class Legend {
|
|
|
20
20
|
static readonly labelClass = "legend-label";
|
|
21
21
|
static readonly label2DClass = "legend-2d-label";
|
|
22
22
|
static readonly labelPolarClass = "legend-polar-label";
|
|
23
|
-
static readonly labelIntervalClass = "legend-interval-label";
|
|
24
23
|
static readonly itemClass = "legend-item";
|
|
25
24
|
static readonly markerClass = "legend-marker";
|
|
26
25
|
static readonly markerCircle = "legend-circle";
|
|
@@ -103,7 +103,6 @@ Legend.objectClass = "legend-object";
|
|
|
103
103
|
Legend.labelClass = "legend-label";
|
|
104
104
|
Legend.label2DClass = "legend-2d-label";
|
|
105
105
|
Legend.labelPolarClass = "legend-polar-label";
|
|
106
|
-
Legend.labelIntervalClass = "legend-interval-label";
|
|
107
106
|
Legend.itemClass = "legend-item";
|
|
108
107
|
Legend.markerClass = "legend-marker";
|
|
109
108
|
Legend.markerCircle = "legend-circle";
|
|
@@ -90,8 +90,7 @@ export class LegendHelper {
|
|
|
90
90
|
static getLegendClassByChartNotation(chartNotation) {
|
|
91
91
|
const legendClasses = {
|
|
92
92
|
"2d": Legend.label2DClass,
|
|
93
|
-
polar: Legend.labelPolarClass
|
|
94
|
-
interval: Legend.labelIntervalClass
|
|
93
|
+
polar: Legend.labelPolarClass
|
|
95
94
|
};
|
|
96
95
|
return `${Legend.labelClass} ${legendClasses[chartNotation]}`;
|
|
97
96
|
}
|
|
@@ -1,27 +1,9 @@
|
|
|
1
|
+
import { RecordOverflowAlertModel } from "../../../model/model";
|
|
1
2
|
import { Block } from "../../block/block";
|
|
2
|
-
export interface RecordOverflowAlertOptions {
|
|
3
|
-
hidedRecordsAmount: number;
|
|
4
|
-
text: RecordOverflowAlertText;
|
|
5
|
-
positionAttrs: AlertBlockPositionAttrs;
|
|
6
|
-
}
|
|
7
|
-
export interface RecordOverflowAlertText {
|
|
8
|
-
one: string;
|
|
9
|
-
twoToFour: string;
|
|
10
|
-
tenToTwenty: string;
|
|
11
|
-
other: string;
|
|
12
|
-
}
|
|
13
|
-
export interface AlertBlockPositionAttrs {
|
|
14
|
-
top?: string;
|
|
15
|
-
bottom?: string;
|
|
16
|
-
right?: string;
|
|
17
|
-
left?: string;
|
|
18
|
-
}
|
|
19
3
|
declare class RecordOverflowAlertCoreClass {
|
|
20
4
|
private readonly blockClass;
|
|
21
|
-
render(block: Block, options:
|
|
22
|
-
update(block: Block, options:
|
|
23
|
-
private getAlertText;
|
|
24
|
-
private getWordTextEndingByAmount;
|
|
5
|
+
render(block: Block, options: RecordOverflowAlertModel): void;
|
|
6
|
+
update(block: Block, options: RecordOverflowAlertModel): void;
|
|
25
7
|
private setAlertPosition;
|
|
26
8
|
}
|
|
27
9
|
export declare const RecordOverflowAlertCore: RecordOverflowAlertCoreClass;
|
|
@@ -3,41 +3,28 @@ class RecordOverflowAlertCoreClass {
|
|
|
3
3
|
this.blockClass = "record-overflow-alert";
|
|
4
4
|
}
|
|
5
5
|
render(block, options) {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
6
|
+
if (options.show) {
|
|
7
|
+
const alertBlock = block
|
|
8
|
+
.getWrapper()
|
|
9
|
+
.append("div")
|
|
10
|
+
.attr("class", this.blockClass)
|
|
11
|
+
.text(options.textContent);
|
|
12
|
+
this.setAlertPosition(alertBlock, options.positionAttrs);
|
|
13
|
+
}
|
|
12
14
|
}
|
|
13
15
|
update(block, options) {
|
|
14
|
-
let alertBlock = block.getWrapper().select(
|
|
16
|
+
let alertBlock = block.getWrapper().select(`.${this.blockClass}`);
|
|
15
17
|
if (alertBlock.empty()) {
|
|
16
|
-
if (options.
|
|
17
|
-
return;
|
|
18
|
-
else
|
|
18
|
+
if (options.show)
|
|
19
19
|
this.render(block, options);
|
|
20
20
|
}
|
|
21
21
|
else {
|
|
22
|
-
if (options.
|
|
23
|
-
alertBlock.
|
|
22
|
+
if (options.show)
|
|
23
|
+
alertBlock.text(options.textContent);
|
|
24
24
|
else
|
|
25
|
-
alertBlock.
|
|
25
|
+
alertBlock.remove();
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
|
-
getAlertText(options) {
|
|
29
|
-
return `+ ${options.hidedRecordsAmount} ${this.getWordTextEndingByAmount(options.hidedRecordsAmount, options.text)}`;
|
|
30
|
-
}
|
|
31
|
-
getWordTextEndingByAmount(hidedRecordsAmount, text) {
|
|
32
|
-
const lastDigit = hidedRecordsAmount % 10;
|
|
33
|
-
if (hidedRecordsAmount >= 10 && hidedRecordsAmount <= 20)
|
|
34
|
-
return text.tenToTwenty;
|
|
35
|
-
if (lastDigit === 1)
|
|
36
|
-
return text.one;
|
|
37
|
-
if (lastDigit >= 2 && lastDigit <= 4)
|
|
38
|
-
return text.twoToFour;
|
|
39
|
-
return text.other;
|
|
40
|
-
}
|
|
41
28
|
setAlertPosition(alertBlock, attrs) {
|
|
42
29
|
alertBlock
|
|
43
30
|
.style("position", "absolute")
|
|
@@ -11,6 +11,10 @@ export interface SelectDetails {
|
|
|
11
11
|
interface FilterEventMap {
|
|
12
12
|
change: string[];
|
|
13
13
|
}
|
|
14
|
+
export interface ChartClearSelectionOptions {
|
|
15
|
+
/** @default true */
|
|
16
|
+
firePublicEvent?: boolean;
|
|
17
|
+
}
|
|
14
18
|
export declare class FilterEventManager {
|
|
15
19
|
private callback;
|
|
16
20
|
private fullDataset;
|
|
@@ -23,8 +27,8 @@ export declare class FilterEventManager {
|
|
|
23
27
|
getSelectedKeys(): string[];
|
|
24
28
|
updateData(newDataset: MdtChartsDataRow[]): void;
|
|
25
29
|
isSelected(keyValue: string): boolean;
|
|
26
|
-
clearKeysFor2D(options: TwoDimensionalOptionsModel): void;
|
|
27
|
-
clearKeysForPolar(margin: BlockMargin, blockSize: Size, options: PolarOptionsModel): void;
|
|
30
|
+
clearKeysFor2D(options: TwoDimensionalOptionsModel, clearSelectionOptions?: ChartClearSelectionOptions): void;
|
|
31
|
+
clearKeysForPolar(margin: BlockMargin, blockSize: Size, options: PolarOptionsModel, clearSelectionOptions?: ChartClearSelectionOptions): void;
|
|
28
32
|
private setKey;
|
|
29
33
|
private addId;
|
|
30
34
|
private removeId;
|
|
@@ -25,16 +25,18 @@ export class FilterEventManager {
|
|
|
25
25
|
isSelected(keyValue) {
|
|
26
26
|
return this.selectedKeys.findIndex((key) => key === keyValue) !== -1;
|
|
27
27
|
}
|
|
28
|
-
clearKeysFor2D(options) {
|
|
28
|
+
clearKeysFor2D(options, clearSelectionOptions) {
|
|
29
|
+
var _a;
|
|
29
30
|
this.selectedKeys = [];
|
|
30
|
-
if (this.callback)
|
|
31
|
+
if (((_a = clearSelectionOptions === null || clearSelectionOptions === void 0 ? void 0 : clearSelectionOptions.firePublicEvent) !== null && _a !== void 0 ? _a : true) && this.callback)
|
|
31
32
|
this.callback([]);
|
|
32
33
|
this.eventEmitter.emit("change", this.selectedKeys);
|
|
33
34
|
SelectHighlighter.clear2D(this.block, options);
|
|
34
35
|
}
|
|
35
|
-
clearKeysForPolar(margin, blockSize, options) {
|
|
36
|
+
clearKeysForPolar(margin, blockSize, options, clearSelectionOptions) {
|
|
37
|
+
var _a;
|
|
36
38
|
this.selectedKeys = [];
|
|
37
|
-
if (this.callback)
|
|
39
|
+
if (((_a = clearSelectionOptions === null || clearSelectionOptions === void 0 ? void 0 : clearSelectionOptions.firePublicEvent) !== null && _a !== void 0 ? _a : true) && this.callback)
|
|
38
40
|
this.callback([]);
|
|
39
41
|
this.eventEmitter.emit("change", this.selectedKeys);
|
|
40
42
|
SelectHighlighter.clearPolar(margin, blockSize, this.block, options, Donut.getAllArcGroups(this.block), options.chartCanvas);
|
|
@@ -3,11 +3,11 @@ import { Block } from "../block/block";
|
|
|
3
3
|
import { Engine } from "../engine";
|
|
4
4
|
import { MdtChartsDataSource } from "../../config/config";
|
|
5
5
|
import { ChartContentManager } from "../contentManager/contentManagerFactory";
|
|
6
|
-
import { FilterEventManager } from "../filterManager/filterEventManager";
|
|
6
|
+
import { ChartClearSelectionOptions, FilterEventManager } from "../filterManager/filterEventManager";
|
|
7
7
|
export declare class PolarManager implements ChartContentManager {
|
|
8
8
|
render(engine: Engine, model: Model<PolarOptionsModel>): void;
|
|
9
9
|
updateData(block: Block, model: Model<PolarOptionsModel>, data: MdtChartsDataSource): void;
|
|
10
10
|
updateColors(block: Block, model: Model<PolarOptionsModel>): void;
|
|
11
|
-
clearSelection(filterEventManager: FilterEventManager, model: Model<PolarOptionsModel
|
|
11
|
+
clearSelection(filterEventManager: FilterEventManager, model: Model<PolarOptionsModel>, options?: ChartClearSelectionOptions): void;
|
|
12
12
|
private renderCharts;
|
|
13
13
|
}
|
|
@@ -4,7 +4,7 @@ import { ElementHighlighter } from "../elementHighlighter/elementHighlighter";
|
|
|
4
4
|
import { Tooltip } from "../features/tolltip/tooltip";
|
|
5
5
|
import { Aggregator } from "../features/aggregator/aggregator";
|
|
6
6
|
import { Donut } from "./donut/donut";
|
|
7
|
-
import {
|
|
7
|
+
import { RecordOverflowAlertCore } from "../features/recordOverflowAlert/recordOverflowAlertCore";
|
|
8
8
|
export class PolarManager {
|
|
9
9
|
render(engine, model) {
|
|
10
10
|
const options = model.options;
|
|
@@ -15,10 +15,7 @@ export class PolarManager {
|
|
|
15
15
|
Tooltip.render(engine.block, model, engine.data, model.otherComponents.tooltipBlock);
|
|
16
16
|
engine.block.filterEventManager.setListenerPolar(model.chartBlock.margin, model.blockCanvas.size, options);
|
|
17
17
|
if (model.dataSettings.scope.hidedRecordsAmount !== 0)
|
|
18
|
-
|
|
19
|
-
hidedRecordsAmount: model.dataSettings.scope.hidedRecordsAmount,
|
|
20
|
-
legendPosition: model.options.legend.position
|
|
21
|
-
});
|
|
18
|
+
RecordOverflowAlertCore.render(engine.block, options.recordOverflowAlert);
|
|
22
19
|
engine.block.getSvg().on("click", (e) => {
|
|
23
20
|
if (e.target === engine.block.getSvg().node())
|
|
24
21
|
this.clearSelection(engine.block.filterEventManager, model);
|
|
@@ -40,17 +37,14 @@ export class PolarManager {
|
|
|
40
37
|
});
|
|
41
38
|
Aggregator.update(block, options.charts[0].data.valueField, options.chartCanvas.aggregator);
|
|
42
39
|
Legend.get().update(block, data, model);
|
|
43
|
-
|
|
44
|
-
hidedRecordsAmount: model.dataSettings.scope.hidedRecordsAmount,
|
|
45
|
-
legendPosition: model.options.legend.position
|
|
46
|
-
});
|
|
40
|
+
RecordOverflowAlertCore.update(block, options.recordOverflowAlert);
|
|
47
41
|
}
|
|
48
42
|
updateColors(block, model) {
|
|
49
43
|
Legend.get().updateColors(block, model.options);
|
|
50
44
|
Donut.updateColors(block, model.options.charts[0]);
|
|
51
45
|
}
|
|
52
|
-
clearSelection(filterEventManager, model) {
|
|
53
|
-
filterEventManager.clearKeysForPolar(model.chartBlock.margin, model.blockCanvas.size, model.options);
|
|
46
|
+
clearSelection(filterEventManager, model, options) {
|
|
47
|
+
filterEventManager.clearKeysForPolar(model.chartBlock.margin, model.blockCanvas.size, model.options, options);
|
|
54
48
|
}
|
|
55
49
|
renderCharts(block, charts, data, dataSource, margin, blockSize, donutSettings) {
|
|
56
50
|
charts.forEach((chart) => {
|
|
@@ -3,7 +3,7 @@ import { Model, TwoDimensionalOptionsModel } from "../../model/model";
|
|
|
3
3
|
import { Block } from "../block/block";
|
|
4
4
|
import { ChartContentManager } from "../contentManager/contentManagerFactory";
|
|
5
5
|
import { Engine } from "../engine";
|
|
6
|
-
import { FilterEventManager } from "../filterManager/filterEventManager";
|
|
6
|
+
import { ChartClearSelectionOptions, FilterEventManager } from "../filterManager/filterEventManager";
|
|
7
7
|
export declare class TwoDimensionalManager implements ChartContentManager {
|
|
8
8
|
private canvasValueLabels?;
|
|
9
9
|
private linearGradientDef?;
|
|
@@ -11,7 +11,7 @@ export declare class TwoDimensionalManager implements ChartContentManager {
|
|
|
11
11
|
render(engine: Engine, model: Model<TwoDimensionalOptionsModel>): void;
|
|
12
12
|
updateData(block: Block, model: Model<TwoDimensionalOptionsModel>, data: MdtChartsDataSource): void;
|
|
13
13
|
updateColors(block: Block, model: Model<TwoDimensionalOptionsModel>): void;
|
|
14
|
-
clearSelection(filterEventManager: FilterEventManager, model: Model<TwoDimensionalOptionsModel
|
|
14
|
+
clearSelection(filterEventManager: FilterEventManager, model: Model<TwoDimensionalOptionsModel>, options?: ChartClearSelectionOptions): void;
|
|
15
15
|
private renderCharts;
|
|
16
16
|
private updateCharts;
|
|
17
17
|
}
|
|
@@ -11,11 +11,11 @@ import { Helper } from "../helpers/helper";
|
|
|
11
11
|
import { Area } from "./area/area";
|
|
12
12
|
import { Bar } from "./bar/bar";
|
|
13
13
|
import { BarHelper } from "./bar/barHelper";
|
|
14
|
-
import { TwoDimRecordOverflowAlert } from "./extenders/twoDimRecordOverflowAlert";
|
|
15
14
|
import { Line } from "./line/line";
|
|
16
15
|
import { CanvasValueLabels } from "../../engine/features/valueLabels/valueLabels";
|
|
17
16
|
import { LinearGradientDef } from "../../engine/block/defs/LinearGradientDef";
|
|
18
17
|
import { CanvasDotChart } from "./dot/dotChart";
|
|
18
|
+
import { RecordOverflowAlertCore } from "../features/recordOverflowAlert/recordOverflowAlertCore";
|
|
19
19
|
export class TwoDimensionalManager {
|
|
20
20
|
render(engine, model) {
|
|
21
21
|
const options = model.options;
|
|
@@ -46,10 +46,7 @@ export class TwoDimensionalManager {
|
|
|
46
46
|
Legend.get().render(engine.block, engine.data, options, model);
|
|
47
47
|
Tooltip.render(engine.block, model, engine.data, model.otherComponents.tooltipBlock, scales);
|
|
48
48
|
if (model.dataSettings.scope.hidedRecordsAmount !== 0)
|
|
49
|
-
|
|
50
|
-
hidedRecordsAmount: model.dataSettings.scope.hidedRecordsAmount,
|
|
51
|
-
chartOrientation: options.orient
|
|
52
|
-
});
|
|
49
|
+
RecordOverflowAlertCore.render(engine.block, options.recordOverflowAlert);
|
|
53
50
|
engine.block.getSvg().on("click", (e) => {
|
|
54
51
|
if (e.target === engine.block.getSvg().node())
|
|
55
52
|
this.clearSelection(engine.block.filterEventManager, model);
|
|
@@ -92,10 +89,7 @@ export class TwoDimensionalManager {
|
|
|
92
89
|
block.filterEventManager.registerEventFor2D(scales.key, model.chartBlock.margin, model.blockCanvas.size, options);
|
|
93
90
|
Tooltip.render(block, model, data, model.otherComponents.tooltipBlock, scales);
|
|
94
91
|
});
|
|
95
|
-
|
|
96
|
-
hidedRecordsAmount: model.dataSettings.scope.hidedRecordsAmount,
|
|
97
|
-
chartOrientation: options.orient
|
|
98
|
-
});
|
|
92
|
+
RecordOverflowAlertCore.update(block, options.recordOverflowAlert);
|
|
99
93
|
if (this.canvasValueLabels)
|
|
100
94
|
this.canvasValueLabels.update(scales, options.charts, data, model.options.data, options.valueLabels);
|
|
101
95
|
}
|
|
@@ -112,8 +106,8 @@ export class TwoDimensionalManager {
|
|
|
112
106
|
Area.get({ staticSettings: model.options.chartSettings.lineLike }).updateColors(block, chart);
|
|
113
107
|
});
|
|
114
108
|
}
|
|
115
|
-
clearSelection(filterEventManager, model) {
|
|
116
|
-
filterEventManager.clearKeysFor2D(model.options);
|
|
109
|
+
clearSelection(filterEventManager, model, options) {
|
|
110
|
+
filterEventManager.clearKeysFor2D(model.options, options);
|
|
117
111
|
}
|
|
118
112
|
renderCharts(block, charts, scales, data, dataOptions, margin, keyAxisOrient, chartSettings, blockSize) {
|
|
119
113
|
block.svg.renderChartClipPath(margin, blockSize);
|
package/lib/main.d.ts
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { MdtChartsConfig, MdtChartsDataSource, NewSize, Size } from "./config/config";
|
|
2
2
|
import { DesignerConfig } from "./designer/designerConfig";
|
|
3
3
|
import { FilterCallback } from "./engine/filterManager/filterEventManager";
|
|
4
|
+
interface ChartClearSelectionPublicOptions {
|
|
5
|
+
/** @default true */
|
|
6
|
+
fireEvent?: boolean;
|
|
7
|
+
}
|
|
4
8
|
export interface IChart {
|
|
5
9
|
/**
|
|
6
10
|
* Рендер графика
|
|
@@ -29,7 +33,7 @@ export interface IChart {
|
|
|
29
33
|
/**
|
|
30
34
|
* Сброс выделения ключей
|
|
31
35
|
*/
|
|
32
|
-
clearSelection(): void;
|
|
36
|
+
clearSelection(options?: ChartClearSelectionPublicOptions): void;
|
|
33
37
|
}
|
|
34
38
|
export declare class Chart implements IChart {
|
|
35
39
|
static chartCounter: number;
|
|
@@ -75,7 +79,7 @@ export declare class Chart implements IChart {
|
|
|
75
79
|
* @param newColors Новые базовые цвета
|
|
76
80
|
*/
|
|
77
81
|
updateColors(newColors: string[]): void;
|
|
78
|
-
clearSelection(): void;
|
|
82
|
+
clearSelection(options?: ChartClearSelectionPublicOptions): void;
|
|
79
83
|
private registerResizeEvent;
|
|
80
84
|
private removeResizeEvent;
|
|
81
85
|
private resizeListener;
|
package/lib/main.js
CHANGED
|
@@ -71,8 +71,8 @@ export class Chart {
|
|
|
71
71
|
this.model = assembleModel(this.config, this.data, this.designerConfig, this.id);
|
|
72
72
|
this.engine.updateColors(this.model);
|
|
73
73
|
}
|
|
74
|
-
clearSelection() {
|
|
75
|
-
this.engine.clearSelection(this.model);
|
|
74
|
+
clearSelection(options) {
|
|
75
|
+
this.engine.clearSelection(this.model, { firePublicEvent: options === null || options === void 0 ? void 0 : options.fireEvent });
|
|
76
76
|
}
|
|
77
77
|
registerResizeEvent() {
|
|
78
78
|
window.addEventListener("resize", this.resizeHandler);
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { RecordOverflowAlertOptions, RecordOverflowVariationTextContent } from "../../../config/config";
|
|
2
|
+
import { RecordOverflowAlertModel } from "../../model";
|
|
3
|
+
export declare function getTextVariationByNumber(hidedRecordsAmount: number, textVariation: RecordOverflowVariationTextContent): string;
|
|
4
|
+
export declare function createRecordOverflowModel(hiddenRecordsAmount: number, defaultTextVariation: RecordOverflowVariationTextContent, options?: RecordOverflowAlertOptions): RecordOverflowAlertModel;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export function getTextVariationByNumber(hidedRecordsAmount, textVariation) {
|
|
2
|
+
const lastDigit = hidedRecordsAmount % 10;
|
|
3
|
+
if (hidedRecordsAmount >= 10 && hidedRecordsAmount <= 20)
|
|
4
|
+
return textVariation.tenToTwenty;
|
|
5
|
+
if (lastDigit === 1)
|
|
6
|
+
return textVariation.one;
|
|
7
|
+
if (lastDigit >= 2 && lastDigit <= 4)
|
|
8
|
+
return textVariation.twoToFour;
|
|
9
|
+
return textVariation.other;
|
|
10
|
+
}
|
|
11
|
+
export function createRecordOverflowModel(hiddenRecordsAmount, defaultTextVariation, options) {
|
|
12
|
+
var _a;
|
|
13
|
+
let textContent;
|
|
14
|
+
if ((_a = options === null || options === void 0 ? void 0 : options.textContent) === null || _a === void 0 ? void 0 : _a.create) {
|
|
15
|
+
textContent = (options === null || options === void 0 ? void 0 : options.textContent).create(hiddenRecordsAmount);
|
|
16
|
+
}
|
|
17
|
+
else if (options === null || options === void 0 ? void 0 : options.textContent) {
|
|
18
|
+
textContent = `+ ${hiddenRecordsAmount} ${getTextVariationByNumber(hiddenRecordsAmount, options.textContent)}`;
|
|
19
|
+
}
|
|
20
|
+
else {
|
|
21
|
+
textContent = `+ ${hiddenRecordsAmount} ${getTextVariationByNumber(hiddenRecordsAmount, defaultTextVariation)}`;
|
|
22
|
+
}
|
|
23
|
+
return hiddenRecordsAmount === 0
|
|
24
|
+
? { show: false }
|
|
25
|
+
: {
|
|
26
|
+
show: true,
|
|
27
|
+
positionAttrs: {
|
|
28
|
+
bottom: "0",
|
|
29
|
+
right: "0"
|
|
30
|
+
},
|
|
31
|
+
textContent
|
|
32
|
+
};
|
|
33
|
+
}
|
package/lib/model/model.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ChartOrientation, MdtChartsColorField,
|
|
1
|
+
import { ChartOrientation, MdtChartsColorField, PolarChartType, Size, TooltipOptions, TwoDimensionalChartType, AxisLabelPosition, ShowTickFn, MdtChartsDataRow, TwoDimensionalValueGroup, ValueLabelsCollisionMode, ValueLabelsRotationOptions } from "../config/config";
|
|
2
2
|
import { DataType, DonutOptionsCanvas, Formatter, StaticLegendBlockCanvas, TooltipSettings, Transitions } from "../designer/designerConfig";
|
|
3
3
|
import { BoundingRect } from "../engine/features/valueLabelsCollision/valueLabelsCollision";
|
|
4
4
|
declare type AxisType = "key" | "value";
|
|
@@ -14,7 +14,7 @@ export declare type UnitsFromConfig = "%" | "px";
|
|
|
14
14
|
export declare type ValueLabelAnchor = "start" | "middle" | "end";
|
|
15
15
|
export declare type ValueLabelDominantBaseline = "hanging" | "middle" | "auto";
|
|
16
16
|
export declare type GradientId = string;
|
|
17
|
-
export declare type OptionsModel = TwoDimensionalOptionsModel | PolarOptionsModel
|
|
17
|
+
export declare type OptionsModel = TwoDimensionalOptionsModel | PolarOptionsModel;
|
|
18
18
|
export interface Model<O = OptionsModel> {
|
|
19
19
|
blockCanvas: BlockCanvas;
|
|
20
20
|
chartBlock: ChartBlockModel;
|
|
@@ -45,6 +45,7 @@ interface GraphicNotationOptionsModel extends BasicOptionsModel {
|
|
|
45
45
|
title: OptionsModelTitle;
|
|
46
46
|
selectable: boolean;
|
|
47
47
|
defs: OptionsModelGradients;
|
|
48
|
+
recordOverflowAlert: RecordOverflowAlertModel;
|
|
48
49
|
}
|
|
49
50
|
export interface TwoDimensionalOptionsModel extends GraphicNotationOptionsModel {
|
|
50
51
|
type: "2d";
|
|
@@ -61,15 +62,6 @@ export interface PolarOptionsModel extends GraphicNotationOptionsModel {
|
|
|
61
62
|
charts: PolarChartModel[];
|
|
62
63
|
chartCanvas: DonutChartSettings;
|
|
63
64
|
}
|
|
64
|
-
export interface IntervalOptionsModel extends GraphicNotationOptionsModel {
|
|
65
|
-
type: "interval";
|
|
66
|
-
scale: IScaleModel;
|
|
67
|
-
axis: IAxisModel;
|
|
68
|
-
charts: IntervalChartModel[];
|
|
69
|
-
additionalElements: AdditionalElementsOptions;
|
|
70
|
-
orient: ChartOrientation;
|
|
71
|
-
chartSettings: TwoDimChartElementsSettings;
|
|
72
|
-
}
|
|
73
65
|
export interface ILegendModel {
|
|
74
66
|
position: LegendPosition;
|
|
75
67
|
}
|
|
@@ -370,10 +362,6 @@ export interface TwoDimensionalChartModel extends ChartModel, TwoDimensionalLine
|
|
|
370
362
|
legend: ChartLegendModel;
|
|
371
363
|
valueLabels: TwoDimChartValueLabelsOptions;
|
|
372
364
|
}
|
|
373
|
-
export interface IntervalChartModel extends Omit<ChartModel, "legend"> {
|
|
374
|
-
type: IntervalChartType;
|
|
375
|
-
data: IntervalChartDataModel;
|
|
376
|
-
}
|
|
377
365
|
export interface PolarChartModel extends ChartModel {
|
|
378
366
|
type: PolarChartType;
|
|
379
367
|
data: PolarChartDataModel;
|
|
@@ -423,10 +411,6 @@ interface MarkersBaseSizeOptions {
|
|
|
423
411
|
radius: number;
|
|
424
412
|
borderSize: string;
|
|
425
413
|
}
|
|
426
|
-
interface IntervalChartDataModel {
|
|
427
|
-
valueField1: ValueField;
|
|
428
|
-
valueField2: ValueField;
|
|
429
|
-
}
|
|
430
414
|
export interface PolarChartDataModel {
|
|
431
415
|
valueField: ValueField;
|
|
432
416
|
colorField?: MdtChartsColorField;
|
|
@@ -466,4 +450,17 @@ export interface TitleBlockModel extends ComponentBlockModel {
|
|
|
466
450
|
}
|
|
467
451
|
interface LegendCanvasCoordinate extends ComponentBlockModel {
|
|
468
452
|
}
|
|
453
|
+
export declare type RecordOverflowAlertModel = {
|
|
454
|
+
show: false;
|
|
455
|
+
} | {
|
|
456
|
+
show: true;
|
|
457
|
+
textContent: string;
|
|
458
|
+
positionAttrs: RecordOverflowAlertPositionAttrs;
|
|
459
|
+
};
|
|
460
|
+
export interface RecordOverflowAlertPositionAttrs {
|
|
461
|
+
top?: string;
|
|
462
|
+
bottom?: string;
|
|
463
|
+
right?: string;
|
|
464
|
+
left?: string;
|
|
465
|
+
}
|
|
469
466
|
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { DataScope } from "../../model";
|
|
2
2
|
import { DataRepositoryModel } from "./dataRepository";
|
|
3
|
-
export declare const DEFAULT_MAX_RECORDS_AMOUNT =
|
|
3
|
+
export declare const DEFAULT_MAX_RECORDS_AMOUNT = 100;
|
|
4
4
|
export declare class DataModelInstance {
|
|
5
5
|
readonly repository: DataRepositoryModel;
|
|
6
6
|
private maxRecordsAmount;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ChartStyleModelService } from "../../chartStyleModel/chartStyleModel";
|
|
2
2
|
import { DonutModel } from "./donut/donutModel";
|
|
3
3
|
import { TitleConfigReader } from "../../modelInstance/titleConfigReader";
|
|
4
|
+
import { createRecordOverflowModel } from "../../featuresModel/recordOverflowModel/recordOverflowModel";
|
|
4
5
|
export const MIN_DONUT_BLOCK_SIZE = 120;
|
|
5
6
|
export class PolarModel {
|
|
6
7
|
static getOptions(options, designerConfig, modelInstance) {
|
|
@@ -17,7 +18,13 @@ export class PolarModel {
|
|
|
17
18
|
legend: modelInstance.canvasModel.legendCanvas.getModel(),
|
|
18
19
|
tooltip: options.tooltip,
|
|
19
20
|
chartCanvas: this.getDonutSettings(designerConfig.canvas.chartOptions.donut, options.chart, modelInstance.dataModel.repository.getRawRows()),
|
|
20
|
-
defs: { gradients: [] }
|
|
21
|
+
defs: { gradients: [] },
|
|
22
|
+
recordOverflowAlert: createRecordOverflowModel(modelInstance.dataModel.getScope().hidedRecordsAmount, {
|
|
23
|
+
one: "категория",
|
|
24
|
+
twoToFour: "категории",
|
|
25
|
+
tenToTwenty: "категорий",
|
|
26
|
+
other: "категорий"
|
|
27
|
+
}, options.recordOverflowAlert)
|
|
21
28
|
};
|
|
22
29
|
}
|
|
23
30
|
//TODO: type for returned value
|
|
@@ -7,6 +7,7 @@ import { calculateBarIndexes, getAreaViewOptions, getBarViewOptions, getLegendMa
|
|
|
7
7
|
import { calculateValueLabelAlignment, ValueLabelCoordinateCalculator } from "../../model/featuresModel/valueLabelsModel/valueLabelsModel";
|
|
8
8
|
import { TwoDimensionalModelHelper } from "../helpers/twoDimensionalModelHelper";
|
|
9
9
|
import { TitleConfigReader } from "../modelInstance/titleConfigReader";
|
|
10
|
+
import { createRecordOverflowModel } from "../featuresModel/recordOverflowModel/recordOverflowModel";
|
|
10
11
|
export class TwoDimensionalModel {
|
|
11
12
|
static getOptions(configReader, designerConfig, modelInstance) {
|
|
12
13
|
const options = configReader.options;
|
|
@@ -24,6 +25,7 @@ export class TwoDimensionalModel {
|
|
|
24
25
|
const keyAxis = AxisModel.getKeyAxis(options, modelInstance.dataModel.repository.getScopedFullSource(), designerConfig.canvas.axisLabel, canvasModel, designerConfig.elementsOptions.tooltip, () => scaleValueInfo.scaleFn(0));
|
|
25
26
|
const charts = this.getChartsModel(options.charts, configReader, options.orientation, designerConfig, modelInstance.dataModel.repository, keyAxis.orient, canvasModel, options.data.keyField.name, modelInstance);
|
|
26
27
|
const titleConfig = TitleConfigReader.create(options.title, modelInstance);
|
|
28
|
+
const isHorizontal = options.orientation === "horizontal";
|
|
27
29
|
return {
|
|
28
30
|
legend: canvasModel.legendCanvas.getModel(),
|
|
29
31
|
title: {
|
|
@@ -45,7 +47,13 @@ export class TwoDimensionalModel {
|
|
|
45
47
|
valueLabels: TwoDimensionalModelHelper.getValueLabels(options.valueLabels, canvasModel, options.orientation, configReader.getValueLabelsStyleModel()),
|
|
46
48
|
defs: {
|
|
47
49
|
gradients: TwoDimensionalModelHelper.getGradientDefs(charts, keyAxis.orient, options.orientation, modelInstance.version.getVersionNumber())
|
|
48
|
-
}
|
|
50
|
+
},
|
|
51
|
+
recordOverflowAlert: createRecordOverflowModel(modelInstance.dataModel.getScope().hidedRecordsAmount, {
|
|
52
|
+
one: isHorizontal ? "строка" : "столбец",
|
|
53
|
+
twoToFour: isHorizontal ? "строки" : "столбца",
|
|
54
|
+
tenToTwenty: isHorizontal ? "строк" : "столбцов",
|
|
55
|
+
other: isHorizontal ? "строк" : "столбцов"
|
|
56
|
+
}, options.recordOverflowAlert)
|
|
49
57
|
};
|
|
50
58
|
}
|
|
51
59
|
static getChartsEmbeddedLabelsFlag(charts, chartOrientation) {
|
package/package.json
CHANGED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { LegendPosition } from "../../../model/model";
|
|
2
|
-
import { Block } from "../../block/block";
|
|
3
|
-
interface PolarRecordOverflowAlertOptions {
|
|
4
|
-
hidedRecordsAmount: number;
|
|
5
|
-
legendPosition: LegendPosition;
|
|
6
|
-
}
|
|
7
|
-
declare class PolarRecordOverflowAlertClass {
|
|
8
|
-
private readonly text;
|
|
9
|
-
render(block: Block, options: PolarRecordOverflowAlertOptions): void;
|
|
10
|
-
update(block: Block, options: PolarRecordOverflowAlertOptions): void;
|
|
11
|
-
private buildCoreOptions;
|
|
12
|
-
private getPositionAttrs;
|
|
13
|
-
}
|
|
14
|
-
export declare const PolarRecordOverflowAlert: PolarRecordOverflowAlertClass;
|
|
15
|
-
export {};
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { RecordOverflowAlertCore } from "../../features/recordOverflowAlert/recordOverflowAlertCore";
|
|
2
|
-
class PolarRecordOverflowAlertClass {
|
|
3
|
-
constructor() {
|
|
4
|
-
this.text = {
|
|
5
|
-
one: "категория",
|
|
6
|
-
twoToFour: "категории",
|
|
7
|
-
tenToTwenty: "категорий",
|
|
8
|
-
other: "категорий"
|
|
9
|
-
};
|
|
10
|
-
}
|
|
11
|
-
render(block, options) {
|
|
12
|
-
RecordOverflowAlertCore.render(block, this.buildCoreOptions(options));
|
|
13
|
-
}
|
|
14
|
-
update(block, options) {
|
|
15
|
-
RecordOverflowAlertCore.update(block, this.buildCoreOptions(options));
|
|
16
|
-
}
|
|
17
|
-
buildCoreOptions(options) {
|
|
18
|
-
return {
|
|
19
|
-
hidedRecordsAmount: options.hidedRecordsAmount,
|
|
20
|
-
text: this.text,
|
|
21
|
-
positionAttrs: this.getPositionAttrs(options)
|
|
22
|
-
};
|
|
23
|
-
}
|
|
24
|
-
getPositionAttrs(options) {
|
|
25
|
-
const position = options.legendPosition === "off" ? "bottom" : options.legendPosition;
|
|
26
|
-
if (position === "right") {
|
|
27
|
-
return {
|
|
28
|
-
bottom: "0",
|
|
29
|
-
right: "0"
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
|
-
if (position === "bottom") {
|
|
33
|
-
return {
|
|
34
|
-
bottom: "0",
|
|
35
|
-
left: "0"
|
|
36
|
-
};
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
export const PolarRecordOverflowAlert = new PolarRecordOverflowAlertClass();
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { ChartOrientation } from "../../../config/config";
|
|
2
|
-
import { Block } from "../../block/block";
|
|
3
|
-
interface TwoDimRecordOverflowAlertOptions {
|
|
4
|
-
hidedRecordsAmount: number;
|
|
5
|
-
chartOrientation: ChartOrientation;
|
|
6
|
-
}
|
|
7
|
-
declare class TwoDimRecordOverflowAlertClass {
|
|
8
|
-
render(block: Block, options: TwoDimRecordOverflowAlertOptions): void;
|
|
9
|
-
update(block: Block, options: TwoDimRecordOverflowAlertOptions): void;
|
|
10
|
-
private buildCoreOptions;
|
|
11
|
-
private getText;
|
|
12
|
-
private getPositionAttrs;
|
|
13
|
-
}
|
|
14
|
-
export declare const TwoDimRecordOverflowAlert: TwoDimRecordOverflowAlertClass;
|
|
15
|
-
export {};
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { RecordOverflowAlertCore } from "../../features/recordOverflowAlert/recordOverflowAlertCore";
|
|
2
|
-
class TwoDimRecordOverflowAlertClass {
|
|
3
|
-
render(block, options) {
|
|
4
|
-
RecordOverflowAlertCore.render(block, this.buildCoreOptions(options));
|
|
5
|
-
}
|
|
6
|
-
update(block, options) {
|
|
7
|
-
RecordOverflowAlertCore.update(block, this.buildCoreOptions(options));
|
|
8
|
-
}
|
|
9
|
-
buildCoreOptions(options) {
|
|
10
|
-
return {
|
|
11
|
-
hidedRecordsAmount: options.hidedRecordsAmount,
|
|
12
|
-
text: this.getText(options.chartOrientation),
|
|
13
|
-
positionAttrs: this.getPositionAttrs()
|
|
14
|
-
};
|
|
15
|
-
}
|
|
16
|
-
getText(chartOrientation) {
|
|
17
|
-
const isHorizontal = chartOrientation === "horizontal";
|
|
18
|
-
return {
|
|
19
|
-
one: isHorizontal ? "строка" : "столбец",
|
|
20
|
-
twoToFour: isHorizontal ? "строки" : "столбца",
|
|
21
|
-
tenToTwenty: isHorizontal ? "строк" : "столбцов",
|
|
22
|
-
other: isHorizontal ? "строк" : "столбцов"
|
|
23
|
-
};
|
|
24
|
-
}
|
|
25
|
-
getPositionAttrs() {
|
|
26
|
-
return {
|
|
27
|
-
right: "0px",
|
|
28
|
-
top: "0px"
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
export const TwoDimRecordOverflowAlert = new TwoDimRecordOverflowAlertClass();
|