mdt-charts 1.38.1 → 1.38.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5,7 +5,7 @@ import { DomSelectionHelper, SelectionCondition } from "../helpers/domSelectionH
5
5
  import { Donut } from "../polarNotation/donut/donut";
6
6
  import { MarkDot } from "../features/markDots/markDot";
7
7
  import { Helper } from "../helpers/helper";
8
- import * as chroma from "chroma-js";
8
+ import chroma from "chroma-js";
9
9
  import { NamesHelper } from "../helpers/namesHelper";
10
10
  import { DonutHelper } from "../polarNotation/donut/donutHelper";
11
11
  export class ElementHighlighter {
@@ -1,4 +1,4 @@
1
- import * as chroma from "chroma-js";
1
+ import chroma from "chroma-js";
2
2
  export class ChartStyleModelService {
3
3
  static getCssClasses(chartIndex) {
4
4
  const cssClasses = [`chart-${chartIndex}`];
@@ -1,4 +1,4 @@
1
- import * as chroma from "chroma-js";
1
+ import chroma from "chroma-js";
2
2
  import { ModelHelper } from "../helpers/modelHelper";
3
3
  import { ChartStyleModelService } from "./chartStyleModel";
4
4
  export class TwoDimensionalChartStyleModel {
@@ -3,6 +3,7 @@ import { ValueField } from "../../../model";
3
3
  import { TooltipContentInitialRow, TooltipContentInitialRowsProvider, TooltipContentInitialRowsProviderContext } from "./tooltipContentInitialRowsProvider";
4
4
  export interface PolarInitialRowsProviderOptions {
5
5
  valueField: ValueField;
6
+ colorField?: string;
6
7
  datasource: MdtChartsDataRow[];
7
8
  chartColors: string[];
8
9
  keyFieldName: string;
@@ -5,7 +5,13 @@ export class PolarInitialRowsProvider {
5
5
  }
6
6
  getInitialRows(context) {
7
7
  const indexOfCurrentDataRow = this.options.datasource.findIndex((row) => row[this.options.keyFieldName] === context.keyFieldValue);
8
- const markerColor = this.options.chartColors[indexOfCurrentDataRow];
8
+ let markerColor;
9
+ if (this.options.colorField) {
10
+ const currentDataRow = this.options.datasource[indexOfCurrentDataRow];
11
+ markerColor = currentDataRow[this.options.colorField];
12
+ }
13
+ else
14
+ markerColor = this.options.chartColors[indexOfCurrentDataRow];
9
15
  return [
10
16
  {
11
17
  marker: Object.assign(Object.assign({}, POLAR_LEGEND_MARKER), { color: markerColor }),
@@ -30,7 +30,8 @@ export class PolarModel {
30
30
  datasource: modelInstance.dataModel.repository.getRawRows(),
31
31
  valueField: options.chart.data.valueField,
32
32
  keyFieldName: options.data.keyField.name,
33
- chartColors: chart.style.elementColors
33
+ chartColors: chart.style.elementColors,
34
+ colorField: options.chart.data.colorField
34
35
  }),
35
36
  valueGlobalFormatter: designerConfig.dataFormat.formatters
36
37
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mdt-charts",
3
- "version": "1.38.1",
3
+ "version": "1.38.3",
4
4
  "description": "",
5
5
  "main": "lib/main.js",
6
6
  "scripts": {
@@ -46,7 +46,7 @@
46
46
  "webpack-cli": "^6.0.1"
47
47
  },
48
48
  "dependencies": {
49
- "chroma-js": "^2.1.1",
49
+ "chroma-js": "^2.6.0",
50
50
  "d3-array": "^3.2.4",
51
51
  "d3-axis": "^3.0.0",
52
52
  "d3-ease": "^3.0.1",
@@ -8,7 +8,8 @@
8
8
  "allowJs": true,
9
9
  "types": ["jest"],
10
10
  "declaration": true,
11
- "moduleResolution": "Node"
11
+ "moduleResolution": "Node",
12
+ "allowSyntheticDefaultImports": true
12
13
  },
13
14
  "include": ["src"],
14
15
  "exclude": ["node_modules", "**/__tests__/*", "src/playground/*", "**/*Example.ts", "**/*.test.ts"]