mdt-charts 1.38.2 → 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.
@@ -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.2",
3
+ "version": "1.38.3",
4
4
  "description": "",
5
5
  "main": "lib/main.js",
6
6
  "scripts": {