mdt-charts 1.9.7 → 1.9.11

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.
Files changed (150) hide show
  1. package/README.md +190 -190
  2. package/dist/index.html +363 -48
  3. package/dist/listeners.89e1e272264c0e680de8.js +278 -0
  4. package/dist/main.f8b6bc6fee33cef1116c.js +228 -0
  5. package/dist/src_engine_engine_ts.ccee2a280374e0083541.js +759 -0
  6. package/dist/vendors-node_modules_chroma-js_chroma_js-node_modules_d3-array_src_max_js-node_modules_d3-arr-c3fc24.b32acc465b8557229277.js +1869 -0
  7. package/package.json +57 -57
  8. package/dist/bundle.js +0 -2
  9. package/dist/bundle.js.LICENSE.txt +0 -56
  10. package/lib/config/config.d.ts +0 -146
  11. package/lib/config/config.js +0 -1
  12. package/lib/designer/designerConfig.d.ts +0 -71
  13. package/lib/designer/designerConfig.js +0 -1
  14. package/lib/engine/block/block.d.ts +0 -35
  15. package/lib/engine/block/block.js +0 -110
  16. package/lib/engine/block/blockHelper.d.ts +0 -12
  17. package/lib/engine/block/blockHelper.js +0 -19
  18. package/lib/engine/contentManager.d.ts +0 -9
  19. package/lib/engine/contentManager.js +0 -29
  20. package/lib/engine/elementHighlighter/elementHighlighter.d.ts +0 -30
  21. package/lib/engine/elementHighlighter/elementHighlighter.js +0 -197
  22. package/lib/engine/elementHighlighter/selectHighlighter.d.ts +0 -11
  23. package/lib/engine/elementHighlighter/selectHighlighter.js +0 -95
  24. package/lib/engine/engine.d.ts +0 -20
  25. package/lib/engine/engine.js +0 -64
  26. package/lib/engine/features/aggregator/aggregator.d.ts +0 -22
  27. package/lib/engine/features/aggregator/aggregator.js +0 -95
  28. package/lib/engine/features/axis/axis.d.ts +0 -12
  29. package/lib/engine/features/axis/axis.js +0 -118
  30. package/lib/engine/features/axis/axisDomHelper.d.ts +0 -7
  31. package/lib/engine/features/axis/axisDomHelper.js +0 -24
  32. package/lib/engine/features/axis/axisHelper.d.ts +0 -9
  33. package/lib/engine/features/axis/axisHelper.js +0 -53
  34. package/lib/engine/features/axis/axisLabelDomHelper.d.ts +0 -17
  35. package/lib/engine/features/axis/axisLabelDomHelper.js +0 -143
  36. package/lib/engine/features/axis/axisLabelsEventManager.d.ts +0 -6
  37. package/lib/engine/features/axis/axisLabelsEventManager.js +0 -36
  38. package/lib/engine/features/embeddedLabels/embeddedLabels.d.ts +0 -23
  39. package/lib/engine/features/embeddedLabels/embeddedLabels.js +0 -147
  40. package/lib/engine/features/embeddedLabels/embeddedLabelsDomHelper.d.ts +0 -8
  41. package/lib/engine/features/embeddedLabels/embeddedLabelsDomHelper.js +0 -30
  42. package/lib/engine/features/embeddedLabels/embeddedLabelsHelper.d.ts +0 -27
  43. package/lib/engine/features/embeddedLabels/embeddedLabelsHelper.js +0 -65
  44. package/lib/engine/features/gridLine/gidLineHelper.d.ts +0 -13
  45. package/lib/engine/features/gridLine/gidLineHelper.js +0 -30
  46. package/lib/engine/features/gridLine/gridLine.d.ts +0 -11
  47. package/lib/engine/features/gridLine/gridLine.js +0 -67
  48. package/lib/engine/features/legend/legend.d.ts +0 -22
  49. package/lib/engine/features/legend/legend.js +0 -109
  50. package/lib/engine/features/legend/legendDomHelper.d.ts +0 -8
  51. package/lib/engine/features/legend/legendDomHelper.js +0 -48
  52. package/lib/engine/features/legend/legendEventsManager.d.ts +0 -12
  53. package/lib/engine/features/legend/legendEventsManager.js +0 -47
  54. package/lib/engine/features/legend/legendHelper.d.ts +0 -21
  55. package/lib/engine/features/legend/legendHelper.js +0 -97
  56. package/lib/engine/features/markDots/markDot.d.ts +0 -20
  57. package/lib/engine/features/markDots/markDot.js +0 -68
  58. package/lib/engine/features/markDots/markDotsHelper.d.ts +0 -6
  59. package/lib/engine/features/markDots/markDotsHelper.js +0 -16
  60. package/lib/engine/features/recordOverflowAlert/recordOverflowAlert.d.ts +0 -14
  61. package/lib/engine/features/recordOverflowAlert/recordOverflowAlert.js +0 -97
  62. package/lib/engine/features/scale/scale.d.ts +0 -16
  63. package/lib/engine/features/scale/scale.js +0 -74
  64. package/lib/engine/features/tipBox/tipBox.d.ts +0 -11
  65. package/lib/engine/features/tipBox/tipBox.js +0 -32
  66. package/lib/engine/features/tipBox/tipBoxHelper.d.ts +0 -16
  67. package/lib/engine/features/tipBox/tipBoxHelper.js +0 -48
  68. package/lib/engine/features/title/title.d.ts +0 -9
  69. package/lib/engine/features/title/title.js +0 -35
  70. package/lib/engine/features/tolltip/tooltip.d.ts +0 -19
  71. package/lib/engine/features/tolltip/tooltip.js +0 -180
  72. package/lib/engine/features/tolltip/tooltipComponentsManager.d.ts +0 -17
  73. package/lib/engine/features/tolltip/tooltipComponentsManager.js +0 -127
  74. package/lib/engine/features/tolltip/tooltipDomHelper.d.ts +0 -36
  75. package/lib/engine/features/tolltip/tooltipDomHelper.js +0 -114
  76. package/lib/engine/features/tolltip/tooltipHelper.d.ts +0 -16
  77. package/lib/engine/features/tolltip/tooltipHelper.js +0 -99
  78. package/lib/engine/filterManager/filterEventManager.d.ts +0 -33
  79. package/lib/engine/filterManager/filterEventManager.js +0 -127
  80. package/lib/engine/helpers/domHelper.d.ts +0 -30
  81. package/lib/engine/helpers/domHelper.js +0 -68
  82. package/lib/engine/helpers/helper.d.ts +0 -30
  83. package/lib/engine/helpers/helper.js +0 -89
  84. package/lib/engine/helpers/namesHelper.d.ts +0 -5
  85. package/lib/engine/helpers/namesHelper.js +0 -9
  86. package/lib/engine/intervalNotation/gantt.d.ts +0 -10
  87. package/lib/engine/intervalNotation/gantt.js +0 -62
  88. package/lib/engine/intervalNotation/intervalManager.d.ts +0 -7
  89. package/lib/engine/intervalNotation/intervalManager.js +0 -30
  90. package/lib/engine/polarNotation/donut/DonutHelper.d.ts +0 -15
  91. package/lib/engine/polarNotation/donut/DonutHelper.js +0 -58
  92. package/lib/engine/polarNotation/donut/donut.d.ts +0 -32
  93. package/lib/engine/polarNotation/donut/donut.js +0 -124
  94. package/lib/engine/polarNotation/polarManager.d.ts +0 -10
  95. package/lib/engine/polarNotation/polarManager.js +0 -55
  96. package/lib/engine/transitionManager.d.ts +0 -19
  97. package/lib/engine/transitionManager.js +0 -64
  98. package/lib/engine/twoDimensionalNotation/area/area.d.ts +0 -17
  99. package/lib/engine/twoDimensionalNotation/area/area.js +0 -131
  100. package/lib/engine/twoDimensionalNotation/area/areaHelper.d.ts +0 -9
  101. package/lib/engine/twoDimensionalNotation/area/areaHelper.js +0 -40
  102. package/lib/engine/twoDimensionalNotation/bar/bar.d.ts +0 -34
  103. package/lib/engine/twoDimensionalNotation/bar/bar.js +0 -216
  104. package/lib/engine/twoDimensionalNotation/bar/barHelper.d.ts +0 -24
  105. package/lib/engine/twoDimensionalNotation/bar/barHelper.js +0 -103
  106. package/lib/engine/twoDimensionalNotation/line/line.d.ts +0 -17
  107. package/lib/engine/twoDimensionalNotation/line/line.js +0 -132
  108. package/lib/engine/twoDimensionalNotation/line/lineHelper.d.ts +0 -8
  109. package/lib/engine/twoDimensionalNotation/line/lineHelper.js +0 -28
  110. package/lib/engine/twoDimensionalNotation/twoDimensionalManager.d.ts +0 -11
  111. package/lib/engine/twoDimensionalNotation/twoDimensionalManager.js +0 -101
  112. package/lib/engine/valueFormatter.d.ts +0 -6
  113. package/lib/engine/valueFormatter.js +0 -8
  114. package/lib/main.d.ts +0 -79
  115. package/lib/main.js +0 -85
  116. package/lib/model/chartStyleModel.d.ts +0 -16
  117. package/lib/model/chartStyleModel.js +0 -67
  118. package/lib/model/dataManagerModel.d.ts +0 -22
  119. package/lib/model/dataManagerModel.js +0 -137
  120. package/lib/model/featuresModel/axisModel.d.ts +0 -18
  121. package/lib/model/featuresModel/axisModel.js +0 -111
  122. package/lib/model/featuresModel/legendModel/legendCanvasModel.d.ts +0 -7
  123. package/lib/model/featuresModel/legendModel/legendCanvasModel.js +0 -86
  124. package/lib/model/featuresModel/legendModel/legendModel.d.ts +0 -13
  125. package/lib/model/featuresModel/legendModel/legendModel.js +0 -78
  126. package/lib/model/featuresModel/otherComponents.d.ts +0 -6
  127. package/lib/model/featuresModel/otherComponents.js +0 -12
  128. package/lib/model/featuresModel/scaleModel.d.ts +0 -17
  129. package/lib/model/featuresModel/scaleModel.js +0 -100
  130. package/lib/model/featuresModel/titleModel.d.ts +0 -4
  131. package/lib/model/featuresModel/titleModel.js +0 -14
  132. package/lib/model/featuresModel/tooltipModel.d.ts +0 -4
  133. package/lib/model/featuresModel/tooltipModel.js +0 -7
  134. package/lib/model/marginModel.d.ts +0 -19
  135. package/lib/model/marginModel.js +0 -126
  136. package/lib/model/model.d.ts +0 -220
  137. package/lib/model/model.js +0 -1
  138. package/lib/model/modelBuilder.d.ts +0 -16
  139. package/lib/model/modelBuilder.js +0 -128
  140. package/lib/model/modelHelper.d.ts +0 -7
  141. package/lib/model/modelHelper.js +0 -41
  142. package/lib/model/notations/intervalModel.d.ts +0 -8
  143. package/lib/model/notations/intervalModel.js +0 -93
  144. package/lib/model/notations/polarModel.d.ts +0 -7
  145. package/lib/model/notations/polarModel.js +0 -27
  146. package/lib/model/notations/twoDimensionalModel.d.ts +0 -19
  147. package/lib/model/notations/twoDimensionalModel.js +0 -85
  148. package/lib/style/charts-main.css +0 -240
  149. package/lib/style/charts-main.less +0 -240
  150. package/test.html +0 -196
@@ -1,11 +0,0 @@
1
- import { Size } from "../../../config/config";
2
- import { BlockMargin, GridLineFlag, IAxisModel, ScaleKeyModel } from "../../../model/model";
3
- import { Block } from "../../block/block";
4
- export declare class GridLine {
5
- private static readonly gridLineClass;
6
- static render(block: Block, gridLineFlag: GridLineFlag, axes: IAxisModel, blockSize: Size, margin: BlockMargin, scaleKey: ScaleKeyModel): void;
7
- static update(block: Block, gridLineFlag: GridLineFlag, axes: IAxisModel, blockSize: Size, margin: BlockMargin, scaleKey: ScaleKeyModel): void;
8
- private static renderLine;
9
- private static clear;
10
- private static removeGridLinesOnAxes;
11
- }
@@ -1,67 +0,0 @@
1
- import { GridLineHelper } from "./gidLineHelper";
2
- export class GridLine {
3
- static render(block, gridLineFlag, axes, blockSize, margin, scaleKey) {
4
- if (gridLineFlag.value) {
5
- const lineLength = GridLineHelper.getGridLineLength('value', axes.key, axes.value, blockSize, margin);
6
- const lineAttributes = GridLineHelper.getLineAttributes(axes.value, lineLength);
7
- this.renderLine(block, axes.value, lineAttributes);
8
- }
9
- if (gridLineFlag.key) {
10
- const lineLength = GridLineHelper.getGridLineLength('key', axes.key, axes.value, blockSize, margin);
11
- const lineAttributes = GridLineHelper.getLineAttributes(axes.key, lineLength);
12
- this.renderLine(block, axes.key, lineAttributes);
13
- }
14
- if (scaleKey.type === 'point' && (gridLineFlag.key || gridLineFlag.value))
15
- this.removeGridLinesOnAxes(block, axes.key, axes.value, false);
16
- else if (gridLineFlag.key || gridLineFlag.value)
17
- this.removeGridLinesOnAxes(block, axes.key, axes.value, true);
18
- }
19
- static update(block, gridLineFlag, axes, blockSize, margin, scaleKey) {
20
- this.clear(block, axes.key.cssClass, axes.value.cssClass);
21
- this.render(block, gridLineFlag, axes, blockSize, margin, scaleKey);
22
- }
23
- static renderLine(block, axis, lineAttributes) {
24
- block
25
- .getSvg()
26
- .selectAll(`.${axis.cssClass}`)
27
- .selectAll('g.tick')
28
- .append('line')
29
- .attr('class', this.gridLineClass)
30
- .attr('x1', lineAttributes.x1)
31
- .attr('y1', lineAttributes.y1)
32
- .attr('x2', lineAttributes.x2)
33
- .attr('y2', lineAttributes.y2);
34
- }
35
- static clear(block, keyAxisClass, valueAxisClass) {
36
- block.getSvg()
37
- .selectAll(`.${keyAxisClass} `)
38
- .selectAll('g.tick')
39
- .selectAll(`.${this.gridLineClass}`)
40
- .remove();
41
- block.getSvg()
42
- .selectAll(`.${valueAxisClass}`)
43
- .selectAll('g.tick')
44
- .selectAll(`.${this.gridLineClass}`)
45
- .remove();
46
- }
47
- static removeGridLinesOnAxes(block, keyAxis, valueAxis, excludeKey) {
48
- let tickOnKeyAxisSelector = '';
49
- let tickOnValueAxisSelector = '';
50
- if (valueAxis.orient === 'right' || valueAxis.orient === 'bottom')
51
- tickOnValueAxisSelector = ':last-of-type';
52
- if (keyAxis.orient === 'bottom' || keyAxis.orient === 'right')
53
- tickOnKeyAxisSelector = ':last-of-type';
54
- block.getSvg()
55
- .select(`.${valueAxis.cssClass}`)
56
- .select(`g.tick${tickOnKeyAxisSelector}`)
57
- .select(`.${this.gridLineClass}`)
58
- .remove();
59
- if (!excludeKey)
60
- block.getSvg()
61
- .select(`.${keyAxis.cssClass}`)
62
- .select(`g.tick${tickOnValueAxisSelector}`)
63
- .select(`.${this.gridLineClass}`)
64
- .remove();
65
- }
66
- }
67
- GridLine.gridLineClass = 'grid-line';
@@ -1,22 +0,0 @@
1
- import { BaseType, Selection } from "d3-selection";
2
- import { MdtChartsDataSource } from "../../../config/config";
3
- import { IntervalOptionsModel, Model, PolarOptionsModel, TwoDimensionalOptionsModel } from "../../../model/model";
4
- import { Block } from "../../block/block";
5
- import { SelectionCondition } from "../../helpers/domHelper";
6
- export declare class Legend {
7
- static readonly objectClass = "legend-object";
8
- static readonly labelClass = "legend-label";
9
- static readonly itemClass = "legend-item";
10
- static readonly markerClass = "legend-circle";
11
- private static readonly legendBlockClass;
12
- static render(block: Block, data: MdtChartsDataSource, options: TwoDimensionalOptionsModel | PolarOptionsModel | IntervalOptionsModel, model: Model): void;
13
- static update(block: Block, data: MdtChartsDataSource, model: Model): void;
14
- static updateColors(block: Block, options: TwoDimensionalOptionsModel | PolarOptionsModel | IntervalOptionsModel): void;
15
- static getItemsByKeys(block: Block, keys: string[], condition?: SelectionCondition): Selection<HTMLDivElement, string, BaseType, unknown>;
16
- private static setContent;
17
- private static renderObject;
18
- private static renderContent;
19
- private static getObject;
20
- private static removeContent;
21
- private static fillCoordinate;
22
- }
@@ -1,109 +0,0 @@
1
- import { select } from "d3-selection";
2
- import { SelectionCondition } from "../../helpers/domHelper";
3
- import { LegendDomHelper } from "./legendDomHelper";
4
- import { LegendEventsManager } from "./legendEventsManager";
5
- import { LegendHelper } from "./legendHelper";
6
- export class Legend {
7
- static render(block, data, options, model) {
8
- if (options.legend.position !== 'off') {
9
- const legendObject = this.renderObject(block, options.legend.position, model.otherComponents.legendBlock, model.blockCanvas.size);
10
- this.setContent(block, data, options, legendObject);
11
- }
12
- }
13
- static update(block, data, model) {
14
- if (model.options.legend.position !== 'off') {
15
- const legendObject = this.getObject(block);
16
- const legendCoordinate = LegendHelper.getLegendCoordinateByPosition(model.options.legend.position, model.otherComponents.legendBlock, model.blockCanvas.size);
17
- this.fillCoordinate(legendObject, legendCoordinate);
18
- this.removeContent(legendObject);
19
- this.setContent(block, data, model.options, legendObject);
20
- }
21
- }
22
- static updateColors(block, options) {
23
- const legendObject = this.getObject(block);
24
- const colors = LegendHelper.getMarksColor(options);
25
- const itemWrappers = legendObject
26
- .selectAll(`.${this.itemClass}`);
27
- LegendDomHelper.setItemsColors(itemWrappers, colors);
28
- }
29
- static getItemsByKeys(block, keys, condition = SelectionCondition.Include) {
30
- return block
31
- .getSvg()
32
- .selectAll(`.${this.itemClass}`)
33
- .filter(d => {
34
- const index = keys.findIndex(k => k === d);
35
- return condition === SelectionCondition.Include ? index !== -1 : index === -1;
36
- });
37
- }
38
- static setContent(block, data, options, legendObject) {
39
- const items = LegendHelper.getLegendItemsContent(options, data);
40
- const colors = LegendHelper.getMarksColor(options);
41
- const itemsDirection = LegendHelper.getLegendItemsDirection(options.type, options.legend.position);
42
- const itemBlocks = this.renderContent(legendObject, items, colors, itemsDirection, options.legend.position);
43
- if (options.type === 'polar') {
44
- LegendEventsManager.setListeners(block, options.data.keyField.name, itemBlocks, options.selectable);
45
- }
46
- else {
47
- LegendDomHelper.setItemsTitles(itemBlocks);
48
- }
49
- }
50
- static renderObject(block, legendPosition, legendBlockModel, blockSize) {
51
- const legendObject = block.getSvg()
52
- .append('foreignObject')
53
- .attr('class', Legend.objectClass);
54
- const legendCoordinate = LegendHelper.getLegendCoordinateByPosition(legendPosition, legendBlockModel, blockSize);
55
- this.fillCoordinate(legendObject, legendCoordinate);
56
- return legendObject;
57
- }
58
- static renderContent(legendObject, items, colorPalette, itemsDirection, position) {
59
- const wrapper = legendObject.append('xhtml:div')
60
- .attr('class', Legend.legendBlockClass);
61
- wrapper
62
- .style('height', '100%')
63
- .style('display', 'flex');
64
- if (itemsDirection === 'column') {
65
- wrapper.style('flex-direction', 'column');
66
- if (position === 'right')
67
- wrapper.style('justify-content', 'center');
68
- }
69
- const itemWrappers = wrapper
70
- .selectAll(`.${this.itemClass}`)
71
- .data(items)
72
- .enter()
73
- .append('div');
74
- const thisClass = this;
75
- itemWrappers.each(function (d, i) {
76
- select(this).attr('class', `${thisClass.itemClass} ${LegendHelper.getItemClasses(itemsDirection, position, i)}`);
77
- });
78
- itemWrappers
79
- .append('span')
80
- .attr('class', this.markerClass);
81
- LegendDomHelper.setItemsColors(itemWrappers, colorPalette);
82
- itemWrappers
83
- .append('span')
84
- .attr('class', LegendHelper.getLegendLabelClassByPosition(position))
85
- .text(d => d);
86
- if (itemsDirection === 'row')
87
- LegendDomHelper.cropRowLabels(legendObject, itemWrappers);
88
- return itemWrappers;
89
- }
90
- static getObject(block) {
91
- return block.getSvg()
92
- .select(`foreignObject.${Legend.objectClass}`);
93
- }
94
- static removeContent(legendObject) {
95
- legendObject.select(`.${Legend.legendBlockClass}`).remove();
96
- }
97
- static fillCoordinate(legendBlock, coordinate) {
98
- legendBlock
99
- .attr('x', coordinate.x)
100
- .attr('y', coordinate.y)
101
- .attr('width', coordinate.width)
102
- .attr('height', coordinate.height);
103
- }
104
- }
105
- Legend.objectClass = 'legend-object';
106
- Legend.labelClass = 'legend-label';
107
- Legend.itemClass = 'legend-item';
108
- Legend.markerClass = 'legend-circle';
109
- Legend.legendBlockClass = 'legend-block';
@@ -1,8 +0,0 @@
1
- import { BaseType, Selection } from "d3-selection";
2
- export declare class LegendDomHelper {
3
- static setItemsTitles(items: Selection<HTMLDivElement, string, BaseType, unknown>): void;
4
- static setItemsColors(items: Selection<HTMLDivElement, string, BaseType, unknown>, colorPalette: string[]): void;
5
- static cropRowLabels(legendBlock: Selection<SVGForeignObjectElement, unknown, HTMLElement, any>, items: Selection<HTMLDivElement, string, BaseType, unknown>): void;
6
- private static getItemsLeftMargins;
7
- private static getItemsWidth;
8
- }
@@ -1,48 +0,0 @@
1
- import { DomHelper } from "../../helpers/domHelper";
2
- import { Helper } from "../../helpers/helper";
3
- import { Legend } from "./legend";
4
- import { LegendHelper } from "./legendHelper";
5
- export class LegendDomHelper {
6
- static setItemsTitles(items) {
7
- items.attr('title', d => d);
8
- }
9
- static setItemsColors(items, colorPalette) {
10
- items.select(`.${Legend.markerClass}`)
11
- .style('background-color', (d, i) => colorPalette[i % colorPalette.length]);
12
- }
13
- static cropRowLabels(legendBlock, items) {
14
- const maxWidth = legendBlock.node().getBoundingClientRect().width;
15
- let itemsLeftMargins = this.getItemsLeftMargins(items);
16
- let itemsWidth = this.getItemsWidth(items);
17
- let sumOfItemsWidth = LegendHelper.getSumOfItemsWidths(itemsWidth, itemsLeftMargins);
18
- const maxItemWidth = LegendHelper.getMaxItemWidth(legendBlock.attr('width'), itemsLeftMargins, 'row');
19
- let index = 0;
20
- let loopFlag = true; // if at least one label has no text, loop ends
21
- while (sumOfItemsWidth > maxWidth && loopFlag) {
22
- items.nodes().forEach(node => {
23
- const textBlock = node.querySelector(`.${Legend.labelClass}`);
24
- if (node.getBoundingClientRect().width > maxItemWidth && textBlock.textContent) {
25
- let labelText = index > 0
26
- ? textBlock.textContent.substr(0, textBlock.textContent.length - 3)
27
- : textBlock.textContent;
28
- labelText = labelText.substr(0, labelText.length - 1);
29
- textBlock.textContent = labelText + '...';
30
- itemsLeftMargins = this.getItemsLeftMargins(items);
31
- itemsWidth = this.getItemsWidth(items);
32
- sumOfItemsWidth = LegendHelper.getSumOfItemsWidths(itemsWidth, itemsLeftMargins);
33
- if (labelText.length === 0) {
34
- textBlock.textContent = '';
35
- loopFlag = false;
36
- }
37
- }
38
- });
39
- index++;
40
- }
41
- }
42
- static getItemsLeftMargins(items) {
43
- return items.nodes().map(node => Helper.getPXValueFromString(DomHelper.getCssPropertyValue(node, 'margin-left')));
44
- }
45
- static getItemsWidth(items) {
46
- return items.nodes().map(node => node.getBoundingClientRect().width);
47
- }
48
- }
@@ -1,12 +0,0 @@
1
- import { BaseType, Selection } from "d3-selection";
2
- import { Block } from "../../block/block";
3
- export declare class LegendEventsManager {
4
- /**
5
- * @param block
6
- * @param keyFieldName
7
- * @param legendItems айтемы легенды полара, которые привязаны к ключам
8
- */
9
- static setListeners(block: Block, keyFieldName: string, legendItems: Selection<HTMLDivElement, string, BaseType, unknown>, selectable: boolean): void;
10
- private static setHoverListeners;
11
- private static setClickListeners;
12
- }
@@ -1,47 +0,0 @@
1
- import { pointer, select } from "d3-selection";
2
- import { ElementHighlighter } from "../../elementHighlighter/elementHighlighter";
3
- import { Donut } from "../../polarNotation/donut/donut";
4
- export class LegendEventsManager {
5
- /**
6
- * @param block
7
- * @param keyFieldName
8
- * @param legendItems айтемы легенды полара, которые привязаны к ключам
9
- */
10
- static setListeners(block, keyFieldName, legendItems, selectable) {
11
- this.setHoverListeners(block, keyFieldName, legendItems);
12
- if (selectable)
13
- this.setClickListeners(block, keyFieldName, legendItems);
14
- }
15
- static setHoverListeners(block, keyFieldName, legendItems) {
16
- const arcItems = Donut.getAllArcGroups(block);
17
- legendItems.on('mousemove', function (e, keyValue) {
18
- arcItems.filter((row) => row.data[keyFieldName] === keyValue)
19
- .dispatch('mousemove', {
20
- bubbles: false,
21
- cancelable: true,
22
- detail: {
23
- pointer: pointer(e, block.getWrapper().node()),
24
- ignoreTranslate: true
25
- }
26
- });
27
- });
28
- legendItems.on('mouseover', function (e, keyValue) {
29
- arcItems.filter((row) => row.data[keyFieldName] === keyValue)
30
- .dispatch('mouseover');
31
- ElementHighlighter.toggleActivityStyle(select(this), true);
32
- });
33
- legendItems.on('mouseleave', function (e, keyValue) {
34
- arcItems.filter((row) => row.data[keyFieldName] === keyValue)
35
- .dispatch('mouseleave');
36
- if (!block.filterEventManager.isSelected(keyValue) && block.filterEventManager.getSelectedKeys().length > 0)
37
- ElementHighlighter.toggleActivityStyle(select(this), false);
38
- });
39
- }
40
- static setClickListeners(block, keyFieldName, legendItems) {
41
- const arcItems = Donut.getAllArcGroups(block);
42
- legendItems.on('click', (e, keyValue) => {
43
- arcItems.filter((row) => row.data[keyFieldName] === keyValue)
44
- .dispatch('click', { bubbles: false, cancelable: true, detail: { multySelect: e.ctrlKey || e.metaKey } });
45
- });
46
- }
47
- }
@@ -1,21 +0,0 @@
1
- import { ChartNotation, MdtChartsDataSource, Size } from "../../../config/config";
2
- import { LegendItemsDirection } from "../../../model/featuresModel/legendModel/legendCanvasModel";
3
- import { IntervalOptionsModel, LegendBlockModel, LegendPosition, Orient, PolarOptionsModel, TwoDimensionalOptionsModel } from "../../../model/model";
4
- export interface LegendCoordinate {
5
- x: number;
6
- y: number;
7
- height: number;
8
- width: number;
9
- }
10
- export declare class LegendHelper {
11
- static getLegendItemsContent(options: TwoDimensionalOptionsModel | PolarOptionsModel | IntervalOptionsModel, data: MdtChartsDataSource): string[];
12
- static getMarksColor(options: TwoDimensionalOptionsModel | PolarOptionsModel | IntervalOptionsModel): string[];
13
- static getMaxItemWidth(legendBlockWidth: string, marginsLeft: number[], itemsDirection: LegendItemsDirection): number;
14
- static getItemClasses(itemsDirection: LegendItemsDirection, position: LegendPosition, index: number): string;
15
- static getLegendItemClassByDirection(itemsDirection: LegendItemsDirection): string;
16
- static getLegendItemsMarginClass(legendPosition: LegendPosition): string;
17
- static getLegendLabelClassByPosition(position: LegendPosition): string;
18
- static getLegendItemsDirection(chartNotation: ChartNotation, legendPosition: LegendPosition): LegendItemsDirection;
19
- static getSumOfItemsWidths(itemsWidth: number[], marginsLeft: number[]): number;
20
- static getLegendCoordinateByPosition(legendPosition: Orient, legendBlockModel: LegendBlockModel, blockSize: Size): LegendCoordinate;
21
- }
@@ -1,97 +0,0 @@
1
- import { Helper } from '../../helpers/helper';
2
- import { Legend } from "./legend";
3
- export class LegendHelper {
4
- static getLegendItemsContent(options, data) {
5
- if (options.type === '2d') {
6
- let texts = [];
7
- options.charts.forEach(chart => {
8
- texts = texts.concat(chart.data.valueFields.map(field => field.title));
9
- });
10
- return texts;
11
- }
12
- else if (options.type === 'polar') {
13
- return data[options.data.dataSource].map((record) => record[options.data.keyField.name]);
14
- }
15
- else if (options.type === 'interval') {
16
- return options.charts.map(chart => chart.data.valueField1.name);
17
- }
18
- }
19
- static getMarksColor(options) {
20
- if (options.type === '2d') {
21
- let colors = [];
22
- options.charts.forEach(chart => {
23
- colors = colors.concat(chart.style.elementColors);
24
- });
25
- return colors;
26
- }
27
- else if (options.type === 'polar') {
28
- return options.charts.map(chart => chart.style.elementColors)[0];
29
- }
30
- else if (options.type === 'interval') {
31
- return options.charts.map(chart => chart.style.elementColors[0]);
32
- }
33
- }
34
- static getMaxItemWidth(legendBlockWidth, marginsLeft, itemsDirection) {
35
- if (itemsDirection === 'row') {
36
- const sumOfMargins = Helper.getSumOfNumeric(marginsLeft);
37
- return (parseFloat(legendBlockWidth) - sumOfMargins) / marginsLeft.length;
38
- }
39
- return parseFloat(legendBlockWidth);
40
- }
41
- static getItemClasses(itemsDirection, position, index) {
42
- let cssClasses = this.getLegendItemClassByDirection(itemsDirection);
43
- if (itemsDirection === 'column' && index !== 0)
44
- cssClasses += ` ${this.getLegendItemsMarginClass(position)}`;
45
- return cssClasses;
46
- }
47
- static getLegendItemClassByDirection(itemsDirection) {
48
- return itemsDirection === 'column' ? 'legend-item-row' : 'legend-item-inline';
49
- }
50
- static getLegendItemsMarginClass(legendPosition) {
51
- return legendPosition === 'right' ? 'mt-15' : 'mt-10';
52
- }
53
- static getLegendLabelClassByPosition(position) {
54
- if (position === 'top' || position === 'bottom')
55
- return `${Legend.labelClass} ${Legend.labelClass + '-nowrap'}`;
56
- return Legend.labelClass;
57
- }
58
- static getLegendItemsDirection(chartNotation, legendPosition) {
59
- if (legendPosition === 'right' || legendPosition === 'left')
60
- return 'column';
61
- else
62
- return chartNotation === 'polar' ? 'column' : 'row';
63
- }
64
- static getSumOfItemsWidths(itemsWidth, marginsLeft) {
65
- let sumOfItemsWidth = Helper.getSumOfNumeric(itemsWidth);
66
- sumOfItemsWidth += Helper.getSumOfNumeric(marginsLeft);
67
- return sumOfItemsWidth;
68
- }
69
- static getLegendCoordinateByPosition(legendPosition, legendBlockModel, blockSize) {
70
- const legendModel = legendBlockModel.coordinate[legendPosition];
71
- const coordinate = {
72
- x: 0,
73
- y: 0,
74
- width: 0,
75
- height: 0
76
- };
77
- if (legendPosition === 'left' || legendPosition === 'right') {
78
- coordinate.y = legendModel.margin.top + legendModel.pad;
79
- coordinate.width = legendModel.size;
80
- coordinate.height = blockSize.height - legendModel.margin.top - legendModel.margin.bottom;
81
- }
82
- else if (legendPosition === 'bottom' || legendPosition === 'top') {
83
- coordinate.x = legendModel.margin.left;
84
- coordinate.width = blockSize.width - legendModel.margin.left - legendModel.margin.right;
85
- coordinate.height = legendModel.size;
86
- }
87
- if (legendPosition === 'left')
88
- coordinate.x = legendModel.margin.left;
89
- else if (legendPosition === 'right')
90
- coordinate.x = blockSize.width - legendModel.size - legendModel.margin.right;
91
- else if (legendPosition === 'top')
92
- coordinate.y = legendModel.margin.top + legendModel.pad;
93
- else if (legendPosition === 'bottom')
94
- coordinate.y = blockSize.height - legendModel.size - legendModel.margin.bottom;
95
- return coordinate;
96
- }
97
- }
@@ -1,20 +0,0 @@
1
- import { Selection, BaseType } from 'd3-selection';
2
- import { MdtChartsDataRow } from '../../../config/config';
3
- import { BlockMargin, Orient, TwoDimensionalChartModel } from "../../../model/model";
4
- import { Block } from "../../block/block";
5
- import { Scales } from "../scale/scale";
6
- export interface DotAttrs {
7
- cx: (data: MdtChartsDataRow) => number;
8
- cy: (data: MdtChartsDataRow) => number;
9
- }
10
- export declare class MarkDot {
11
- static readonly markerDotClass: string;
12
- static readonly hiddenDotClass: string;
13
- private static dotRadius;
14
- static render(block: Block, data: MdtChartsDataRow[], keyAxisOrient: Orient, scales: Scales, margin: BlockMargin, keyFieldName: string, vfIndex: number, valueFieldName: string, chart: TwoDimensionalChartModel): void;
15
- static update(block: Block, newData: MdtChartsDataRow[], keyAxisOrient: Orient, scales: Scales, margin: BlockMargin, keyField: string, vfIndex: number, valueFieldName: string, chart: TwoDimensionalChartModel): void;
16
- static updateColors(block: Block, chart: TwoDimensionalChartModel, valueFieldIndex: number): void;
17
- static getMarkDotForChart(block: Block, chartCssClasses: string[]): Selection<BaseType, MdtChartsDataRow, BaseType, unknown>;
18
- private static setClassesAndStyle;
19
- private static setAttrs;
20
- }
@@ -1,68 +0,0 @@
1
- import { select } from 'd3-selection';
2
- import { transition } from 'd3-transition';
3
- import { DomHelper } from '../../helpers/domHelper';
4
- import { Helper } from '../../helpers/helper';
5
- import { NamesHelper } from '../../helpers/namesHelper';
6
- import { MarkDotHelper } from "./markDotsHelper";
7
- select.prototype.transition = transition;
8
- export class MarkDot {
9
- static render(block, data, keyAxisOrient, scales, margin, keyFieldName, vfIndex, valueFieldName, chart) {
10
- const dotsWrapper = block.getChartGroup(chart.index)
11
- .selectAll(`.${this.markerDotClass}${Helper.getCssClassesLine(chart.cssClasses)}.chart-index-${vfIndex}`)
12
- .data(data)
13
- .enter();
14
- const attrs = MarkDotHelper.getDotAttrs(keyAxisOrient, scales, margin, keyFieldName, valueFieldName, chart.isSegmented);
15
- const dots = dotsWrapper.append('circle');
16
- this.setAttrs(block, dots, attrs);
17
- this.setClassesAndStyle(dots, chart.cssClasses, vfIndex, chart.style.elementColors);
18
- if (!chart.markersOptions.show)
19
- dots.classed(this.hiddenDotClass, true);
20
- }
21
- static update(block, newData, keyAxisOrient, scales, margin, keyField, vfIndex, valueFieldName, chart) {
22
- const dots = block.getChartGroup(chart.index)
23
- .selectAll(`.${this.markerDotClass}${Helper.getCssClassesLine(chart.cssClasses)}.chart-element-${vfIndex}`)
24
- .data(newData);
25
- dots.exit().remove();
26
- const attrs = MarkDotHelper.getDotAttrs(keyAxisOrient, scales, margin, keyField, valueFieldName, chart.isSegmented);
27
- const newDots = dots
28
- .enter()
29
- .append('circle');
30
- this.setAttrs(block, newDots, attrs);
31
- this.setClassesAndStyle(newDots, chart.cssClasses, vfIndex, chart.style.elementColors);
32
- if (!chart.markersOptions.show)
33
- newDots.classed(this.hiddenDotClass, true);
34
- const animationName = 'data-updating';
35
- dots
36
- .interrupt(animationName)
37
- .transition(animationName)
38
- .duration(block.transitionManager.durations.chartUpdate)
39
- .attr('cx', d => attrs.cx(d))
40
- .attr('cy', d => attrs.cy(d));
41
- }
42
- static updateColors(block, chart, valueFieldIndex) {
43
- const dots = block.getChartGroup(chart.index)
44
- .selectAll(`.${this.markerDotClass}${Helper.getCssClassesLine(chart.cssClasses)}.chart-element-${valueFieldIndex}`);
45
- DomHelper.setChartElementColor(dots, chart.style.elementColors, valueFieldIndex, 'stroke');
46
- }
47
- static getMarkDotForChart(block, chartCssClasses) {
48
- return block.getSvg()
49
- .selectAll(`.${MarkDot.markerDotClass}${Helper.getCssClassesLine(chartCssClasses)}`);
50
- }
51
- static setClassesAndStyle(dots, cssClasses, vfIndex, elementColors) {
52
- DomHelper.setCssClasses(dots, Helper.getCssClassesWithElementIndex(cssClasses, vfIndex));
53
- DomHelper.setChartElementColor(dots, elementColors, vfIndex, 'stroke');
54
- }
55
- static setAttrs(block, dots, attrs) {
56
- dots
57
- .attr('class', this.markerDotClass)
58
- .attr('cx', d => attrs.cx(d))
59
- .attr('cy', d => attrs.cy(d))
60
- .attr('r', this.dotRadius)
61
- .style('stroke-width', '3px')
62
- .style('fill', 'white')
63
- .style('clip-path', `url(#${block.getClipPathId()})`);
64
- }
65
- }
66
- MarkDot.markerDotClass = NamesHelper.getClassName('dot');
67
- MarkDot.hiddenDotClass = NamesHelper.getClassName('dot-hidden');
68
- MarkDot.dotRadius = 4;
@@ -1,6 +0,0 @@
1
- import { BlockMargin, Orient } from "../../../model/model";
2
- import { Scales } from "../scale/scale";
3
- import { DotAttrs } from "./markDot";
4
- export declare class MarkDotHelper {
5
- static getDotAttrs(keyAxisOrient: Orient, scales: Scales, margin: BlockMargin, keyField: string, valueField: string, isSegmented: boolean): DotAttrs;
6
- }
@@ -1,16 +0,0 @@
1
- import { Helper } from "../../helpers/helper";
2
- import { Scale } from "../scale/scale";
3
- export class MarkDotHelper {
4
- static getDotAttrs(keyAxisOrient, scales, margin, keyField, valueField, isSegmented) {
5
- const attrs = { cx: null, cy: null };
6
- if (keyAxisOrient === 'left' || keyAxisOrient === 'right') {
7
- attrs.cx = d => scales.value(d[valueField]) + margin.left;
8
- attrs.cy = d => Scale.getScaledValue(scales.key, Helper.getKeyFieldValue(d, keyField, isSegmented)) + margin.top;
9
- }
10
- else if (keyAxisOrient === 'bottom' || keyAxisOrient === 'top') {
11
- attrs.cx = d => Scale.getScaledValue(scales.key, Helper.getKeyFieldValue(d, keyField, isSegmented)) + margin.left;
12
- attrs.cy = d => scales.value(d[valueField]) + margin.top;
13
- }
14
- return attrs;
15
- }
16
- }
@@ -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 {};