mdt-charts 1.12.14 → 1.12.17

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 (93) hide show
  1. package/lib/config/config.d.ts +42 -8
  2. package/lib/engine/block/block.d.ts +4 -13
  3. package/lib/engine/block/block.js +12 -61
  4. package/lib/engine/block/blockHtml.d.ts +14 -0
  5. package/lib/engine/block/blockHtml.js +18 -0
  6. package/lib/engine/block/blockSvg.d.ts +26 -0
  7. package/lib/engine/block/blockSvg.js +69 -0
  8. package/lib/engine/cardsNotation/card/card.d.ts +30 -0
  9. package/lib/engine/cardsNotation/card/card.js +97 -0
  10. package/lib/engine/cardsNotation/card/cardChange.d.ts +21 -0
  11. package/lib/engine/cardsNotation/card/cardChange.js +72 -0
  12. package/lib/engine/cardsNotation/card/cardElementsStyler.d.ts +6 -0
  13. package/lib/engine/cardsNotation/card/cardElementsStyler.js +11 -0
  14. package/lib/engine/cardsNotation/card/cardService.d.ts +11 -0
  15. package/lib/engine/cardsNotation/card/cardService.js +12 -0
  16. package/lib/engine/cardsNotation/cardsManager.d.ts +11 -0
  17. package/lib/engine/cardsNotation/cardsManager.js +14 -0
  18. package/lib/engine/contentManager/contentManager.d.ts +11 -0
  19. package/lib/engine/contentManager/contentManager.js +15 -0
  20. package/lib/engine/contentManager/contentManagerFactory.d.ts +14 -0
  21. package/lib/engine/contentManager/contentManagerFactory.js +22 -0
  22. package/lib/engine/engine.d.ts +4 -3
  23. package/lib/engine/engine.js +12 -8
  24. package/lib/engine/features/embeddedLabels/embeddedLabels.js +6 -6
  25. package/lib/engine/features/legend/legend.js +1 -1
  26. package/lib/engine/features/markDots/markDot.js +4 -4
  27. package/lib/engine/features/tolltip/newTooltip/newTooltip.js +1 -1
  28. package/lib/engine/features/tolltip/tooltip.d.ts +6 -6
  29. package/lib/engine/features/tolltip/tooltip.js +4 -7
  30. package/lib/engine/features/tolltip/tooltipComponentsManager.js +2 -2
  31. package/lib/engine/helpers/fontResizer/fontResizer.d.ts +16 -0
  32. package/lib/engine/helpers/fontResizer/fontResizer.js +21 -0
  33. package/lib/engine/helpers/fontResizer/fontResizerService.d.ts +6 -0
  34. package/lib/engine/helpers/fontResizer/fontResizerService.js +12 -0
  35. package/lib/engine/helpers/namesHelper.js +1 -1
  36. package/lib/engine/intervalNotation/gantt.js +2 -2
  37. package/lib/engine/intervalNotation/intervalManager.js +2 -4
  38. package/lib/engine/polarNotation/polarManager.d.ts +8 -7
  39. package/lib/engine/polarNotation/polarManager.js +5 -5
  40. package/lib/engine/twoDimensionalNotation/area/area.js +7 -7
  41. package/lib/engine/twoDimensionalNotation/bar/bar.js +11 -11
  42. package/lib/engine/twoDimensionalNotation/line/line.d.ts +1 -1
  43. package/lib/engine/twoDimensionalNotation/line/line.js +9 -9
  44. package/lib/engine/twoDimensionalNotation/twoDimensionalManager.d.ts +9 -8
  45. package/lib/engine/twoDimensionalNotation/twoDimensionalManager.js +9 -9
  46. package/lib/main.js +1 -1
  47. package/lib/model/chartStyleModel/chartStyleModel.d.ts +1 -1
  48. package/lib/model/chartStyleModel/chartStyleModel.js +2 -2
  49. package/lib/model/chartStyleModel/colorRange.d.ts +7 -0
  50. package/lib/model/chartStyleModel/colorRange.js +30 -0
  51. package/lib/model/dataManagerModel/dataManagerModel.js +7 -0
  52. package/lib/model/dataManagerModel/notations/cardsDataManagerModel.d.ts +5 -0
  53. package/lib/model/dataManagerModel/notations/cardsDataManagerModel.js +10 -0
  54. package/lib/model/featuresModel/legendModel/legendModel.d.ts +2 -1
  55. package/lib/model/featuresModel/legendModel/legendModel.js +7 -0
  56. package/lib/model/featuresModel/legendModel/polarMarginCalculator.js +2 -3
  57. package/lib/model/featuresModel/legendModel/twoDimLegendModel.d.ts +2 -1
  58. package/lib/model/featuresModel/legendModel/twoDimLegendModel.js +7 -6
  59. package/lib/model/featuresModel/scaleModel/scaleDomainService.d.ts +6 -0
  60. package/lib/model/featuresModel/scaleModel/scaleDomainService.js +53 -0
  61. package/lib/model/featuresModel/scaleModel/scaleModel.d.ts +5 -12
  62. package/lib/model/featuresModel/scaleModel/scaleModel.js +11 -94
  63. package/lib/model/featuresModel/scaleModel/scaleModelServices.d.ts +5 -0
  64. package/lib/model/featuresModel/scaleModel/scaleModelServices.js +22 -0
  65. package/lib/model/margin/marginModel.d.ts +5 -6
  66. package/lib/model/margin/marginModel.js +10 -16
  67. package/lib/model/margin/twoDim/twoDimMarginModel.js +1 -1
  68. package/lib/model/model.d.ts +25 -8
  69. package/lib/model/modelBuilder.js +7 -2
  70. package/lib/model/modelInstance/canvasModel/canvasModel.d.ts +4 -3
  71. package/lib/model/modelInstance/canvasModel/canvasModel.js +1 -1
  72. package/lib/model/modelInstance/canvasModel/canvasSizesModel/canvasMarginModel.d.ts +11 -0
  73. package/lib/model/modelInstance/canvasModel/canvasSizesModel/canvasMarginModel.js +1 -0
  74. package/lib/model/modelInstance/canvasModel/canvasSizesModel/canvasSizeModel.d.ts +4 -0
  75. package/lib/model/modelInstance/canvasModel/canvasSizesModel/canvasSizeModel.js +1 -0
  76. package/lib/model/modelInstance/canvasModel/canvasSizesModel/marginModelService.d.ts +11 -0
  77. package/lib/model/modelInstance/canvasModel/canvasSizesModel/marginModelService.js +26 -0
  78. package/lib/model/modelInstance/canvasModel/titleCanvas.js +1 -1
  79. package/lib/model/modelInstance/dataModel/dataRepository.d.ts +1 -0
  80. package/lib/model/modelInstance/dataModel/dataRepository.js +3 -0
  81. package/lib/model/notations/cards/cardsChangeService.d.ts +10 -0
  82. package/lib/model/notations/cards/cardsChangeService.js +50 -0
  83. package/lib/model/notations/cards/cardsModel.d.ts +8 -0
  84. package/lib/model/notations/cards/cardsModel.js +19 -0
  85. package/lib/model/notations/cards/cardsModelService.d.ts +6 -0
  86. package/lib/model/notations/cards/cardsModelService.js +10 -0
  87. package/lib/model/notations/intervalModel.js +3 -4
  88. package/lib/model/notations/twoDimensionalModel.js +3 -2
  89. package/lib/optionsServices/publicOptionsService.d.ts +1 -1
  90. package/lib/optionsServices/validators/sizeValidator.d.ts +1 -1
  91. package/lib/style/charts-main.css +84 -14
  92. package/lib/style/charts-main.less +84 -14
  93. package/package.json +1 -1
@@ -1,26 +1,20 @@
1
1
  import { TwoDimMarginModel } from "./twoDim/twoDimMarginModel";
2
2
  export class MarginModel {
3
- static initMargin(designerConfig, config, otherComponents, data, modelInstance) {
3
+ constructor() {
4
+ this.twoDimModel = new TwoDimMarginModel();
5
+ }
6
+ initMargin(designerConfig, config, otherComponents, data, modelInstance) {
4
7
  const canvasModel = modelInstance.canvasModel;
5
8
  canvasModel.initMargin(Object.assign({}, designerConfig.canvas.chartBlockMargin));
6
- this.recalcMarginByTitle(canvasModel, otherComponents.titleBlock);
9
+ this.recalcMarginByTitle(canvasModel);
7
10
  if (config.options.type === '2d') {
8
- const twoDimModel = new TwoDimMarginModel();
9
- twoDimModel.recalcMargin(designerConfig, config.options, otherComponents, data, modelInstance);
11
+ this.twoDimModel.recalcMargin(designerConfig, config.options, otherComponents, data, modelInstance);
10
12
  }
11
13
  }
12
- static recalcMarginByVerticalAxisLabel(modelInstance, options, designerConfig) {
13
- const twoDimModel = new TwoDimMarginModel();
14
- twoDimModel.recalcMarginByVerticalAxisLabel(modelInstance, options, designerConfig);
15
- }
16
- static appendToGlobalMarginValuesLegendMargin(canvasModel, position, legendBlockModel) {
17
- const legendCoordinate = legendBlockModel.coordinate;
18
- if (position === 'left' || position === 'right')
19
- canvasModel.increaseMarginSide(position, legendCoordinate[position].margin.left + legendCoordinate[position].margin.right);
20
- else
21
- canvasModel.increaseMarginSide(position, legendCoordinate[position].margin.top + legendCoordinate[position].margin.bottom);
14
+ recalcMarginByVerticalAxisLabel(modelInstance, options, designerConfig) {
15
+ this.twoDimModel.recalcMarginByVerticalAxisLabel(modelInstance, options, designerConfig);
22
16
  }
23
- static recalcMarginByTitle(canvasModel, titleBlockModel) {
24
- canvasModel.increaseMarginSide("top", titleBlockModel.margin.top + titleBlockModel.size + titleBlockModel.margin.bottom);
17
+ recalcMarginByTitle(canvasModel) {
18
+ canvasModel.increaseMarginSide("top", canvasModel.titleCanvas.getAllNeededSpace());
25
19
  }
26
20
  }
@@ -12,7 +12,7 @@ export class TwoDimMarginModel {
12
12
  }
13
13
  recalcMargin(designerConfig, options, otherComponents, data, modelInstance) {
14
14
  const canvasModel = modelInstance.canvasModel;
15
- this.twoDimLegendModel.recalcMarginWith2DLegend(modelInstance, otherComponents.legendBlock);
15
+ this.twoDimLegendModel.recalcMarginWith2DLegend(modelInstance, otherComponents.legendBlock, options.legend);
16
16
  const labelSize = this.getHorizontalMarginByAxisLabels(designerConfig.canvas.axisLabel.maxSize.main, options.axis, data, options);
17
17
  this.recalcVerticalMarginByAxisLabelHeight(labelSize, canvasModel, options.orientation, options.axis);
18
18
  // Если встроенный лейбл показывает ключи, то лейблы оси ключей не показываются
@@ -1,4 +1,4 @@
1
- import { ChartOrientation, MdtChartsColorField, IntervalChartType, PolarChartType, Size, TooltipOptions, TwoDimensionalChartType, AxisLabelPosition } from "../config/config";
1
+ import { ChartOrientation, MdtChartsColorField, IntervalChartType, PolarChartType, Size, TooltipOptions, TwoDimensionalChartType, AxisLabelPosition, MdtChartsIconElement, MdtChartsCardValue, MdtChartsColorName } from "../config/config";
2
2
  import { DataType, DonutOptionsCanvas, Formatter, TooltipSettings, Transitions } from "../designer/designerConfig";
3
3
  declare type AxisType = "key" | "value";
4
4
  export declare type Orient = "top" | "bottom" | "left" | "right";
@@ -10,7 +10,8 @@ export declare type DataOptions = {
10
10
  [option: string]: any;
11
11
  };
12
12
  export declare type UnitsFromConfig = "%" | "px";
13
- export interface Model<O = TwoDimensionalOptionsModel | PolarOptionsModel | IntervalOptionsModel> {
13
+ export declare type OptionsModel = TwoDimensionalOptionsModel | PolarOptionsModel | IntervalOptionsModel | CardsOptionsModel;
14
+ export interface Model<O = OptionsModel> {
14
15
  blockCanvas: BlockCanvas;
15
16
  chartBlock: ChartBlockModel;
16
17
  options: O;
@@ -31,14 +32,16 @@ export interface BlockMargin {
31
32
  left: number;
32
33
  right: number;
33
34
  }
34
- interface OptionsModel {
35
- legend: ILegendModel;
35
+ interface BasicOptionsModel {
36
36
  data: OptionsModelData;
37
+ tooltip: TooltipOptions;
38
+ }
39
+ interface GraphicNotationOptionsModel extends BasicOptionsModel {
40
+ legend: ILegendModel;
37
41
  title: string;
38
42
  selectable: boolean;
39
- tooltip: TooltipOptions;
40
43
  }
41
- export interface TwoDimensionalOptionsModel extends OptionsModel {
44
+ export interface TwoDimensionalOptionsModel extends GraphicNotationOptionsModel {
42
45
  type: "2d";
43
46
  scale: IScaleModel;
44
47
  axis: IAxisModel;
@@ -47,12 +50,12 @@ export interface TwoDimensionalOptionsModel extends OptionsModel {
47
50
  orient: ChartOrientation;
48
51
  chartSettings: TwoDimChartElementsSettings;
49
52
  }
50
- export interface PolarOptionsModel extends OptionsModel {
53
+ export interface PolarOptionsModel extends GraphicNotationOptionsModel {
51
54
  type: "polar";
52
55
  charts: PolarChartModel[];
53
56
  chartCanvas: DonutChartSettings;
54
57
  }
55
- export interface IntervalOptionsModel extends OptionsModel {
58
+ export interface IntervalOptionsModel extends GraphicNotationOptionsModel {
56
59
  type: "interval";
57
60
  scale: IScaleModel;
58
61
  axis: IAxisModel;
@@ -61,6 +64,14 @@ export interface IntervalOptionsModel extends OptionsModel {
61
64
  orient: ChartOrientation;
62
65
  chartSettings: TwoDimChartElementsSettings;
63
66
  }
67
+ export interface CardsOptionsModel extends BasicOptionsModel {
68
+ type: "card";
69
+ title: string;
70
+ description?: string;
71
+ icon?: MdtChartsIconElement;
72
+ value: MdtChartsCardValue;
73
+ change?: CardsChangeModel;
74
+ }
64
75
  export interface ILegendModel {
65
76
  position: LegendPosition;
66
77
  }
@@ -156,6 +167,12 @@ export interface DonutThicknessOptions {
156
167
  value: number;
157
168
  unit: DonutThicknessUnit;
158
169
  }
170
+ export interface CardsChangeModel {
171
+ value: MdtChartsCardValue;
172
+ description?: string;
173
+ color: MdtChartsColorName;
174
+ icon?: MdtChartsIconElement;
175
+ }
159
176
  interface ChartModel {
160
177
  tooltip: TooltipModel;
161
178
  cssClasses: string[];
@@ -6,6 +6,7 @@ import { IntervalModel } from './notations/intervalModel';
6
6
  import { OtherComponentsModel } from './featuresModel/otherComponents';
7
7
  import { ConfigValidator } from './configsValidator/configValidator';
8
8
  import { ModelInstance } from './modelInstance/modelInstance';
9
+ import { CardsModelInstance } from './notations/cards/cardsModel';
9
10
  export var AxisType;
10
11
  (function (AxisType) {
11
12
  AxisType[AxisType["Key"] = 0] = "Key";
@@ -41,6 +42,9 @@ function getOptions(config, designerConfig, modelInstance) {
41
42
  else if (config.options.type === 'interval') {
42
43
  return IntervalModel.getOptions(config.options, designerConfig, modelInstance);
43
44
  }
45
+ else if (config.options.type === "card") {
46
+ return CardsModelInstance.getOptions(config.options, modelInstance);
47
+ }
44
48
  }
45
49
  function getDataSettings(dataScope, designerConfig) {
46
50
  return {
@@ -68,10 +72,11 @@ export function assembleModel(config, data, designerConfig) {
68
72
  };
69
73
  resetFalsyValues(data, config.options.data.keyField.name);
70
74
  const otherComponents = OtherComponentsModel.getOtherComponentsModel({ elementsOptions: designerConfig.elementsOptions, title: config.options.title }, modelInstance);
71
- MarginModel.initMargin(designerConfig, config, otherComponents, data, modelInstance);
75
+ const marginModel = new MarginModel();
76
+ marginModel.initMargin(designerConfig, config, otherComponents, data, modelInstance);
72
77
  DataManagerModel.initDataScope(config, data, designerConfig, otherComponents.legendBlock, modelInstance);
73
78
  if (config.options.type === '2d' && config.options.axis.key.visibility)
74
- MarginModel.recalcMarginByVerticalAxisLabel(modelInstance, config.options, designerConfig);
79
+ marginModel.recalcMarginByVerticalAxisLabel(modelInstance, config.options, designerConfig);
75
80
  const blockCanvas = getBlockCanvas(config, modelInstance);
76
81
  const chartBlock = getChartBlockModel(modelInstance);
77
82
  const options = getOptions(config, designerConfig, modelInstance);
@@ -1,10 +1,11 @@
1
1
  import { Size } from "../../../config/config";
2
2
  import { BlockMargin } from "../../model";
3
3
  import { LegendCanvasModelInstance } from "./legendCanvasModel";
4
- import { MarginModelService } from "./marginModelService";
4
+ import { CanvasMarginModel, MarginSide } from "./canvasSizesModel/canvasMarginModel";
5
+ import { MarginModelService } from "./canvasSizesModel/marginModelService";
5
6
  import { TitleCanvasModel } from "./titleCanvas";
6
- export declare type MarginSide = keyof BlockMargin;
7
- export declare class CanvasModel {
7
+ import { CanvasSizesModel } from "./canvasSizesModel/canvasSizeModel";
8
+ export declare class CanvasModel implements CanvasMarginModel, CanvasSizesModel {
8
9
  titleCanvas: TitleCanvasModel;
9
10
  legendCanvas: LegendCanvasModelInstance;
10
11
  marginService: MarginModelService;
@@ -1,5 +1,5 @@
1
1
  import { LegendCanvasModelInstance } from "./legendCanvasModel";
2
- import { MarginModelService } from "./marginModelService";
2
+ import { MarginModelService } from "./canvasSizesModel/marginModelService";
3
3
  import { TitleCanvasModel } from "./titleCanvas";
4
4
  export class CanvasModel {
5
5
  constructor() {
@@ -0,0 +1,11 @@
1
+ import { BlockMargin } from "../../../model";
2
+ export declare type MarginSide = keyof BlockMargin;
3
+ export interface CanvasMarginModel {
4
+ initMargin(margin: BlockMargin): void;
5
+ getMargin(): BlockMargin;
6
+ getMarginSide(side: MarginSide): number;
7
+ setMarginSide(side: MarginSide, size: number): void;
8
+ increaseMarginSide(side: MarginSide, byValue: number, key?: string): void;
9
+ decreaseMarginSide(side: MarginSide, byValue: number): void;
10
+ roundMargin(): void;
11
+ }
@@ -0,0 +1,4 @@
1
+ export interface CanvasSizesModel {
2
+ getChartBlockWidth(): number;
3
+ getChartBlockHeight(): number;
4
+ }
@@ -0,0 +1,11 @@
1
+ import { MarginSide } from "./canvasMarginModel";
2
+ export interface MarginLogData {
3
+ side: MarginSide;
4
+ byValue: number;
5
+ }
6
+ export declare class MarginModelService {
7
+ private log;
8
+ appendLog(key: string, side: MarginSide, byValue: number): void;
9
+ getDataByKey(key: string): MarginLogData;
10
+ private findLogByKey;
11
+ }
@@ -0,0 +1,26 @@
1
+ export class MarginModelService {
2
+ constructor() {
3
+ this.log = [];
4
+ }
5
+ appendLog(key, side, byValue) {
6
+ const log = this.findLogByKey(key);
7
+ if (log) {
8
+ log.data = { side, byValue };
9
+ return;
10
+ }
11
+ this.log.push({
12
+ key,
13
+ data: {
14
+ side,
15
+ byValue
16
+ }
17
+ });
18
+ }
19
+ getDataByKey(key) {
20
+ var _a;
21
+ return (_a = this.findLogByKey(key)) === null || _a === void 0 ? void 0 : _a.data;
22
+ }
23
+ findLogByKey(key) {
24
+ return this.log.find(l => l.key === key);
25
+ }
26
+ }
@@ -6,6 +6,6 @@ export class TitleCanvasModel {
6
6
  return this.model;
7
7
  }
8
8
  getAllNeededSpace() {
9
- return this.model.pad + this.model.size + this.model.margin.top;
9
+ return this.model.pad + this.model.size + this.model.margin.top + this.model.margin.bottom;
10
10
  }
11
11
  }
@@ -6,6 +6,7 @@ export declare class DataRepositoryModel {
6
6
  initSourceName(sourceName: string): void;
7
7
  initRawFullSource(rawSource: MdtChartsDataSource): void;
8
8
  getRawRows(): import("../../../config/config").MdtChartsDataRow[];
9
+ getFirstRow(): import("../../../config/config").MdtChartsDataRow;
9
10
  initScopedFullSource(scopedSource: MdtChartsDataSource): void;
10
11
  getScopedFullSource(): MdtChartsDataSource;
11
12
  getScopedRows(): import("../../../config/config").MdtChartsDataRow[];
@@ -8,6 +8,9 @@ export class DataRepositoryModel {
8
8
  getRawRows() {
9
9
  return this.rawFullSource[this.sourceName];
10
10
  }
11
+ getFirstRow() {
12
+ return this.rawFullSource[this.sourceName][0];
13
+ }
11
14
  initScopedFullSource(scopedSource) {
12
15
  this.scopedFullSource = scopedSource;
13
16
  }
@@ -0,0 +1,10 @@
1
+ import { MdtChartsCardOptionByValue, MdtChartsCardsChange, MdtChartsColorName, MdtChartsColorRangeItem, MdtChartsDataRow } from "../../../config/config";
2
+ import { CardsChangeModel } from "../../model";
3
+ export declare const DEFAULT_CARD_CHANGE_COLOR: MdtChartsCardOptionByValue<MdtChartsColorName>;
4
+ export declare const DEFAULT_CARD_CHANGE_RANGE: MdtChartsColorRangeItem[];
5
+ export declare class CardsChangeService {
6
+ getChangeModel(dataRow: MdtChartsDataRow, changeOptions: MdtChartsCardsChange): CardsChangeModel;
7
+ private getColor;
8
+ private getIcon;
9
+ private getOptionsByValue;
10
+ }
@@ -0,0 +1,50 @@
1
+ import { ColorRangeManager } from "../../chartStyleModel/colorRange";
2
+ export const DEFAULT_CARD_CHANGE_COLOR = {
3
+ aboveZero: "#20b078",
4
+ equalZero: "#000",
5
+ belowZero: "#ff3131"
6
+ };
7
+ export const DEFAULT_CARD_CHANGE_RANGE = [
8
+ {
9
+ color: DEFAULT_CARD_CHANGE_COLOR.belowZero
10
+ },
11
+ {
12
+ color: DEFAULT_CARD_CHANGE_COLOR.equalZero,
13
+ value: 0
14
+ },
15
+ {
16
+ color: DEFAULT_CARD_CHANGE_COLOR.aboveZero,
17
+ value: 0
18
+ }
19
+ ];
20
+ export class CardsChangeService {
21
+ getChangeModel(dataRow, changeOptions) {
22
+ var _a;
23
+ if (!changeOptions || !((_a = changeOptions.value) === null || _a === void 0 ? void 0 : _a.field))
24
+ return void 0;
25
+ const value = dataRow[changeOptions.value.field];
26
+ return {
27
+ description: changeOptions.description,
28
+ value: Object.assign({}, changeOptions.value),
29
+ color: this.getColor(value, changeOptions.color),
30
+ icon: this.getIcon(value, changeOptions.icon)
31
+ };
32
+ }
33
+ getColor(changeValue, colorOptions) {
34
+ const range = (colorOptions === null || colorOptions === void 0 ? void 0 : colorOptions.length) ? colorOptions : DEFAULT_CARD_CHANGE_RANGE;
35
+ const rangeManager = new ColorRangeManager(range);
36
+ return rangeManager.getColorByValue(changeValue);
37
+ }
38
+ getIcon(changeValue, iconOptions) {
39
+ if (!iconOptions)
40
+ return void 0;
41
+ return this.getOptionsByValue(changeValue, iconOptions);
42
+ }
43
+ getOptionsByValue(value, optionsByValues) {
44
+ if (value < 0)
45
+ return optionsByValues.belowZero;
46
+ if (value > 0)
47
+ return optionsByValues.aboveZero;
48
+ return optionsByValues.equalZero;
49
+ }
50
+ }
@@ -0,0 +1,8 @@
1
+ import { MdtChartsCardsOptions } from "../../../config/config";
2
+ import { CardsOptionsModel } from "../../model";
3
+ import { ModelInstance } from "../../modelInstance/modelInstance";
4
+ export declare class CardsModel {
5
+ private service;
6
+ getOptions(options: MdtChartsCardsOptions, modelInstance: ModelInstance): CardsOptionsModel;
7
+ }
8
+ export declare const CardsModelInstance: CardsModel;
@@ -0,0 +1,19 @@
1
+ import { CardsModelService } from "./cardsModelService";
2
+ export class CardsModel {
3
+ constructor() {
4
+ this.service = new CardsModelService();
5
+ }
6
+ getOptions(options, modelInstance) {
7
+ return {
8
+ type: "card",
9
+ title: options.title,
10
+ description: options.description,
11
+ data: options.data,
12
+ tooltip: options.tooltip,
13
+ icon: options.icon,
14
+ value: Object.assign({}, options.value),
15
+ change: this.service.getCardsChangeModel(options, modelInstance)
16
+ };
17
+ }
18
+ }
19
+ export const CardsModelInstance = new CardsModel();
@@ -0,0 +1,6 @@
1
+ import { MdtChartsCardsOptions } from "../../../config/config";
2
+ import { ModelInstance } from "../../modelInstance/modelInstance";
3
+ export declare class CardsModelService {
4
+ private changeService;
5
+ getCardsChangeModel(options: MdtChartsCardsOptions, modelInstance: ModelInstance): import("../../model").CardsChangeModel;
6
+ }
@@ -0,0 +1,10 @@
1
+ import { CardsChangeService } from "./cardsChangeService";
2
+ export class CardsModelService {
3
+ constructor() {
4
+ this.changeService = new CardsChangeService();
5
+ }
6
+ getCardsChangeModel(options, modelInstance) {
7
+ const data = modelInstance.dataModel.repository.getFirstRow();
8
+ return this.changeService.getChangeModel(data, options.change);
9
+ }
10
+ }
@@ -2,7 +2,6 @@ import { AxisModel } from "../featuresModel/axisModel";
2
2
  import { ChartStyleModelService } from "../chartStyleModel/chartStyleModel";
3
3
  import { DataManagerModel } from "../dataManagerModel/dataManagerModel";
4
4
  import { AxisType } from "../modelBuilder";
5
- import { ScaleModel, ScaleType } from "../featuresModel/scaleModel/scaleModel";
6
5
  import { TwoDimensionalModel } from "./twoDimensionalModel";
7
6
  export class IntervalModel {
8
7
  static getOptions(options, designerConfig, modelInstance) {
@@ -18,16 +17,16 @@ export class IntervalModel {
18
17
  domain: modelInstance.dataModel.getAllowableKeys(),
19
18
  range: {
20
19
  start: 0,
21
- end: ScaleModel.getRangePeek(ScaleType.Key, options.orientation, canvasModel)
20
+ end: 0
22
21
  },
23
22
  type: 'band',
24
23
  elementsAmount: 1
25
24
  },
26
25
  value: {
27
- domain: ScaleModel.getDateValueDomain(dataModelRep.getScopedFullSource(), options.chart, options.axis.key.position, options.data.dataSource),
26
+ domain: [],
28
27
  range: {
29
28
  start: 0,
30
- end: ScaleModel.getRangePeek(ScaleType.Value, options.orientation, canvasModel)
29
+ end: 0
31
30
  },
32
31
  type: 'datetime'
33
32
  }
@@ -7,7 +7,8 @@ export class TwoDimensionalModel {
7
7
  static getOptions(options, designerConfig, modelInstance) {
8
8
  const canvasModel = modelInstance.canvasModel;
9
9
  const dataModelRep = modelInstance.dataModel.repository;
10
- const scaleMarginRecalcer = new ScaleAxisRecalcer(() => ScaleModel.getScaleLinear(options, dataModelRep.getScopedRows(), canvasModel));
10
+ const scaleModel = new ScaleModel();
11
+ const scaleMarginRecalcer = new ScaleAxisRecalcer(() => scaleModel.getScaleLinear(options, dataModelRep.getScopedRows(), canvasModel));
11
12
  scaleMarginRecalcer.recalculateMargin(canvasModel, options.orientation, options.axis.key);
12
13
  const scaleValueInfo = scaleMarginRecalcer.getScaleValue();
13
14
  return {
@@ -16,7 +17,7 @@ export class TwoDimensionalModel {
16
17
  selectable: !!options.selectable,
17
18
  orient: options.orientation,
18
19
  scale: {
19
- key: ScaleModel.getScaleKey(modelInstance.dataModel.getAllowableKeys(), options.orientation, canvasModel, options.charts, this.getChartsByType(options.charts, 'bar')),
20
+ key: scaleModel.getScaleKey(modelInstance.dataModel.getAllowableKeys(), options.orientation, canvasModel, options.charts, this.getChartsByType(options.charts, 'bar')),
20
21
  value: scaleValueInfo.scale
21
22
  },
22
23
  axis: {
@@ -1,4 +1,4 @@
1
- import { Size } from "../main";
1
+ import { Size } from "../config/config";
2
2
  declare class PublicOptionsServiceClass {
3
3
  validateSize(size: Partial<Size>): boolean;
4
4
  }
@@ -1,4 +1,4 @@
1
- import { Size } from "../../main";
1
+ import { Size } from "../../config/config";
2
2
  export declare class SizeValidator {
3
3
  validate(size: Partial<Size>): boolean;
4
4
  private validateSide;
@@ -30,12 +30,12 @@
30
30
 
31
31
 
32
32
  /*========================================================================== Common classes */
33
- .charts-opacity-inactive {
33
+ .mdt-charts-opacity-inactive {
34
34
  opacity: 0.6;
35
35
  }
36
36
 
37
37
  /* EXTENDED FOR SPECIFIC STYLES */
38
- .legend-item.charts-opacity-inactive {
38
+ .legend-item.mdt-charts-opacity-inactive {
39
39
  opacity: 0.45;
40
40
  }
41
41
 
@@ -109,14 +109,14 @@
109
109
 
110
110
 
111
111
  /*========================================================================= Tooltip */
112
- .tooltip-block {
112
+ .mdt-charts-tooltip-block {
113
113
  pointer-events: none;
114
114
  z-index: 100;
115
115
  filter: drop-shadow(0px 4px 10px rgba(0, 0, 0, 0.1));
116
116
  width: max-content;
117
117
  max-width: 500px;
118
118
  }
119
- .tooltip-content {
119
+ .mdt-charts-tooltip-content {
120
120
  position: relative;
121
121
  pointer-events: none;
122
122
  font-family: "Roboto", sans-serif;
@@ -128,7 +128,7 @@
128
128
  background: rgba(0, 0, 0, 0.82);
129
129
  font-size: 11px;
130
130
  }
131
- .tooltip-arrow {
131
+ .mdt-charts-tooltip-arrow {
132
132
  width: 0;
133
133
  height: 0;
134
134
  border-style: solid;
@@ -159,26 +159,26 @@
159
159
  font-weight: 400;
160
160
  }
161
161
 
162
- .tooltip-line {
162
+ .mdt-charts-tooltip-line {
163
163
  stroke: #AAA;
164
164
  stroke-width: 1px;
165
165
  stroke-linecap: round;
166
166
  }
167
- .tooltip-content .tooltip-head {
167
+ .mdt-charts-tooltip-content .tooltip-head {
168
168
  font-size: 12px;
169
169
  margin-bottom: 10px;
170
170
  }
171
- .tooltip-content .tooltip-texts {
171
+ .mdt-charts-tooltip-content .tooltip-texts {
172
172
  width: 100%;
173
173
  }
174
174
 
175
- .tooltip-content .tooltip-text-item > span {
175
+ .mdt-charts-tooltip-content .tooltip-text-item > span {
176
176
  display: block;
177
177
  }
178
- .tooltip-content .tooltip-text-item > span:first-of-type {
178
+ .mdt-charts-tooltip-content .tooltip-text-item > span:first-of-type {
179
179
  flex: 1;
180
180
  }
181
- .tooltip-content .tooltip-text-item > span:last-of-type {
181
+ .mdt-charts-tooltip-content .tooltip-text-item > span:last-of-type {
182
182
  flex: 0;
183
183
  }
184
184
  .tooltip-field-value {
@@ -188,10 +188,10 @@
188
188
 
189
189
 
190
190
  /*========================================================================= Additional */
191
- .charts-axis .domain {
191
+ .mdt-charts-axis .domain {
192
192
  stroke: #D2D2D2;
193
193
  }
194
- .charts-axis .tick line:first-of-type {
194
+ .mdt-charts-axis .tick line:first-of-type {
195
195
  stroke: #D2D2D2;
196
196
  }
197
197
 
@@ -261,6 +261,76 @@
261
261
  }
262
262
 
263
263
  /* Mark dots */
264
- .charts-dot-hidden {
264
+ .mdt-charts-dot-hidden {
265
265
  display: none;
266
+ }
267
+
268
+ /* Card */
269
+ .mdt-charts-html-chart {
270
+ width: 100%;
271
+ height: 100%;
272
+ }
273
+
274
+ .mdt-charts-card-wrapper {
275
+ width: 100%;
276
+ height: 100%;
277
+ }
278
+
279
+ .mdt-charts-card-wrapper * {
280
+ box-sizing: border-box;
281
+ }
282
+
283
+ .mdt-charts-card-content {
284
+ width: 100%;
285
+ height: 100%;
286
+ display: flex;
287
+ flex-direction: column;
288
+ justify-content: space-between;
289
+ }
290
+
291
+ .mdt-charts-card-header {
292
+ display: flex;
293
+ justify-content: space-between;
294
+ flex: 1;
295
+ font-size: 1.3em;
296
+ }
297
+
298
+ .mdt-charts-card-title {
299
+ margin: 0;
300
+ white-space: nowrap;
301
+ overflow: hidden;
302
+ text-overflow: ellipsis;
303
+ }
304
+
305
+ .mdt-charts-card-description-wrapper {
306
+ overflow: hidden;
307
+ text-overflow: ellipsis;
308
+ }
309
+
310
+ .mdt-charts-card-description {
311
+ margin: 0;
312
+ overflow: hidden;
313
+ text-overflow: ellipsis;
314
+ opacity: 0.6;
315
+ }
316
+
317
+ .mdt-charts-card-value-wrapper {
318
+ flex: 2;
319
+ display: flex;
320
+ align-items: center;
321
+ }
322
+
323
+ .mdt-charts-card-change-content {
324
+ display: flex;
325
+ font-size: 0.9em;
326
+ }
327
+
328
+ .mdt-charts-card-change-content-item:not(:last-of-type) {
329
+ margin-right: 0.5em;
330
+ }
331
+
332
+ .mdt-charts-card-change-description-wrapper {
333
+ white-space: nowrap;
334
+ overflow: hidden;
335
+ text-overflow: ellipsis;
266
336
  }