@hisptz/dhis2-analytics 1.0.47 → 1.0.49

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.
@@ -27,11 +27,11 @@ class DHIS2Chart {
27
27
  };
28
28
  }
29
29
  getOptions() {
30
- var _this$config$colors, _this$config2, _this$config$highChar, _this$config3;
31
- return {
30
+ var _this$config$colors, _this$config2, _this$config3;
31
+ const options = {
32
32
  yAxis: this.getYAxis(),
33
33
  chart: this.getChartConfig(),
34
- colors: (_this$config$colors = (_this$config2 = this.config) === null || _this$config2 === void 0 ? void 0 : _this$config2.colors) !== null && _this$config$colors !== void 0 ? _this$config$colors : ["#2f7ed8", "#0d233a", "#8bbc21", "#910000", "#1aadce", "#492970", "#f28f43", "#77a1e5", "#c42525", "#a6c96a"],
34
+ colors: (_this$config$colors = (_this$config2 = this.config) === null || _this$config2 === void 0 ? void 0 : _this$config2.colors) !== null && _this$config$colors !== void 0 ? _this$config$colors : ['#a8bf24', '#518cc3', '#d74554', '#ff9e21', '#968f8f', '#ba3ba1', '#ffda54', '#45beae', '#b98037', '#676767', '#6b2dd4', '#47792c', '#fcbdbd', '#830000', '#a5ffc0', '#000078', '#817c00', '#bdf023', '#fffac4'],
35
35
  series: this.getSeries(),
36
36
  plotOptions: this.getPlotOptions(),
37
37
  title: {
@@ -44,8 +44,18 @@ class DHIS2Chart {
44
44
  },
45
45
  credits: {
46
46
  enabled: false
47
- },
48
- ...((_this$config$highChar = (_this$config3 = this.config) === null || _this$config3 === void 0 ? void 0 : _this$config3.highChartOverrides) !== null && _this$config$highChar !== void 0 ? _this$config$highChar : {})
47
+ }
48
+ };
49
+ let overrides = {};
50
+ if ((_this$config3 = this.config) !== null && _this$config3 !== void 0 && _this$config3.highChartOverrides) {
51
+ var _this$config4, _this$config$highChar, _this$config5, _this$config6;
52
+ overrides = {
53
+ ...(typeof ((_this$config4 = this.config) === null || _this$config4 === void 0 ? void 0 : _this$config4.highChartOverrides) === "object" ? (_this$config$highChar = (_this$config5 = this.config) === null || _this$config5 === void 0 ? void 0 : _this$config5.highChartOverrides) !== null && _this$config$highChar !== void 0 ? _this$config$highChar : {} : (_this$config6 = this.config) === null || _this$config6 === void 0 ? void 0 : _this$config6.highChartOverrides(options))
54
+ };
55
+ }
56
+ return {
57
+ ...options,
58
+ ...overrides
49
59
  };
50
60
  }
51
61
  getYAxis() {
@@ -86,8 +96,8 @@ class DHIS2Chart {
86
96
  }];
87
97
  }
88
98
  getExporting() {
89
- var _this$config$name, _this$config4;
90
- const name = (_this$config$name = (_this$config4 = this.config) === null || _this$config4 === void 0 ? void 0 : _this$config4.name) !== null && _this$config$name !== void 0 ? _this$config$name : "chart";
99
+ var _this$config$name, _this$config7;
100
+ const name = (_this$config$name = (_this$config7 = this.config) === null || _this$config7 === void 0 ? void 0 : _this$config7.name) !== null && _this$config$name !== void 0 ? _this$config$name : "chart";
91
101
  return {
92
102
  filename: `${name}`,
93
103
  sourceWidth: 1200,
@@ -21,11 +21,11 @@ export class DHIS2Chart {
21
21
  };
22
22
  }
23
23
  getOptions() {
24
- var _this$config$colors, _this$config2, _this$config$highChar, _this$config3;
25
- return {
24
+ var _this$config$colors, _this$config2, _this$config3;
25
+ const options = {
26
26
  yAxis: this.getYAxis(),
27
27
  chart: this.getChartConfig(),
28
- colors: (_this$config$colors = (_this$config2 = this.config) === null || _this$config2 === void 0 ? void 0 : _this$config2.colors) !== null && _this$config$colors !== void 0 ? _this$config$colors : ["#2f7ed8", "#0d233a", "#8bbc21", "#910000", "#1aadce", "#492970", "#f28f43", "#77a1e5", "#c42525", "#a6c96a"],
28
+ colors: (_this$config$colors = (_this$config2 = this.config) === null || _this$config2 === void 0 ? void 0 : _this$config2.colors) !== null && _this$config$colors !== void 0 ? _this$config$colors : ['#a8bf24', '#518cc3', '#d74554', '#ff9e21', '#968f8f', '#ba3ba1', '#ffda54', '#45beae', '#b98037', '#676767', '#6b2dd4', '#47792c', '#fcbdbd', '#830000', '#a5ffc0', '#000078', '#817c00', '#bdf023', '#fffac4'],
29
29
  series: this.getSeries(),
30
30
  plotOptions: this.getPlotOptions(),
31
31
  title: {
@@ -38,8 +38,18 @@ export class DHIS2Chart {
38
38
  },
39
39
  credits: {
40
40
  enabled: false
41
- },
42
- ...((_this$config$highChar = (_this$config3 = this.config) === null || _this$config3 === void 0 ? void 0 : _this$config3.highChartOverrides) !== null && _this$config$highChar !== void 0 ? _this$config$highChar : {})
41
+ }
42
+ };
43
+ let overrides = {};
44
+ if ((_this$config3 = this.config) !== null && _this$config3 !== void 0 && _this$config3.highChartOverrides) {
45
+ var _this$config4, _this$config$highChar, _this$config5, _this$config6;
46
+ overrides = {
47
+ ...(typeof ((_this$config4 = this.config) === null || _this$config4 === void 0 ? void 0 : _this$config4.highChartOverrides) === "object" ? (_this$config$highChar = (_this$config5 = this.config) === null || _this$config5 === void 0 ? void 0 : _this$config5.highChartOverrides) !== null && _this$config$highChar !== void 0 ? _this$config$highChar : {} : (_this$config6 = this.config) === null || _this$config6 === void 0 ? void 0 : _this$config6.highChartOverrides(options))
48
+ };
49
+ }
50
+ return {
51
+ ...options,
52
+ ...overrides
43
53
  };
44
54
  }
45
55
  getYAxis() {
@@ -80,8 +90,8 @@ export class DHIS2Chart {
80
90
  }];
81
91
  }
82
92
  getExporting() {
83
- var _this$config$name, _this$config4;
84
- const name = (_this$config$name = (_this$config4 = this.config) === null || _this$config4 === void 0 ? void 0 : _this$config4.name) !== null && _this$config$name !== void 0 ? _this$config$name : "chart";
93
+ var _this$config$name, _this$config7;
94
+ const name = (_this$config$name = (_this$config7 = this.config) === null || _this$config7 === void 0 ? void 0 : _this$config7.name) !== null && _this$config$name !== void 0 ? _this$config$name : "chart";
85
95
  return {
86
96
  filename: `${name}`,
87
97
  sourceWidth: 1200,
@@ -1,5 +1,5 @@
1
1
  import type { Analytics } from "@hisptz/dhis2-utils";
2
- import { DashStyleValue, YAxisOptions, YAxisPlotLinesLabelOptions } from "highcharts";
2
+ import HighCharts, { DashStyleValue, YAxisOptions, YAxisPlotLinesLabelOptions } from "highcharts";
3
3
  export type ChartType = "column" | "pie" | "stacked-column" | "line" | "multi-series";
4
4
  export interface MultiSeriesConfig {
5
5
  series?: Array<{
@@ -33,7 +33,7 @@ export type ChartConfig = {
33
33
  colors?: Array<string>;
34
34
  name?: string;
35
35
  allowChartTypeChange?: boolean;
36
- highChartOverrides?: Record<string, any>;
36
+ highChartOverrides?: Partial<HighCharts.Options> | ((config: HighCharts.Options) => Partial<HighCharts.Options>);
37
37
  multiSeries?: MultiSeriesConfig;
38
38
  };
39
39
  export type ChartAnalyticsProps = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hisptz/dhis2-analytics",
3
- "version": "1.0.47",
3
+ "version": "1.0.49",
4
4
  "description": "A collection of reusable react components for visualizing analytics data from DHIS2",
5
5
  "license": "BSD-3-Clause",
6
6
  "scripts": {
@@ -31,7 +31,7 @@
31
31
  },
32
32
  "dependencies": {
33
33
  "@dhis2/app-runtime": "^3.7.0",
34
- "@hisptz/dhis2-ui": "^1.0.47",
34
+ "@hisptz/dhis2-ui": "^1.0.49",
35
35
  "@hisptz/dhis2-utils": "*",
36
36
  "@react-leaflet/core": "^2.1.0",
37
37
  "async-es": "^3.2.4",
@@ -87,5 +87,5 @@
87
87
  "react-hook-form": "^7.43",
88
88
  "recoil": "*"
89
89
  },
90
- "gitHead": "d5879f1190205b3af60b50ed97d2689f9228e1b1"
90
+ "gitHead": "ccddc3de38554d0dbfa00a379cc8bfb6f15af36b"
91
91
  }