@hisptz/dhis2-analytics 1.0.49 → 1.0.52
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.
- package/build/cjs/components/ChartAnalytics/ChartAnalytics.test.js +1 -1
- package/build/cjs/components/ChartAnalytics/models/bar.js +24 -0
- package/build/cjs/components/ChartAnalytics/utils/chart.js +5 -0
- package/build/es/components/ChartAnalytics/ChartAnalytics.test.js +1 -1
- package/build/es/components/ChartAnalytics/models/bar.js +16 -0
- package/build/es/components/ChartAnalytics/utils/chart.js +5 -0
- package/build/types/components/ChartAnalytics/models/bar.d.ts +8 -0
- package/build/types/components/ChartAnalytics/types/props.d.ts +1 -1
- package/package.json +5 -5
|
@@ -4,7 +4,7 @@ var _react = require("@cypress/react");
|
|
|
4
4
|
var _highcharts = _interopRequireDefault(require("highcharts"));
|
|
5
5
|
var _react2 = _interopRequireWildcard(require("react"));
|
|
6
6
|
var _DownloadMenu = require("./components/DownloadMenu");
|
|
7
|
-
var _columnData = _interopRequireDefault(require("
|
|
7
|
+
var _columnData = _interopRequireDefault(require("../../../../../resources/analytics/column-data.json"));
|
|
8
8
|
var _export = require("./services/export");
|
|
9
9
|
var _ = require(".");
|
|
10
10
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.DHIS2StackedBarChart = exports.DHIS2BarChart = void 0;
|
|
7
|
+
var _column = require("./column");
|
|
8
|
+
class DHIS2BarChart extends _column.DHIS2ColumnChart {
|
|
9
|
+
getHighchartsType() {
|
|
10
|
+
return "bar";
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
exports.DHIS2BarChart = DHIS2BarChart;
|
|
14
|
+
class DHIS2StackedBarChart extends DHIS2BarChart {
|
|
15
|
+
getPlotOptions() {
|
|
16
|
+
return {
|
|
17
|
+
column: {
|
|
18
|
+
stacking: "normal",
|
|
19
|
+
...super.getPlotOptions().column
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
exports.DHIS2StackedBarChart = DHIS2StackedBarChart;
|
|
@@ -14,6 +14,7 @@ var _column = require("../models/column");
|
|
|
14
14
|
var _line = require("../models/line");
|
|
15
15
|
var _multiSeries = require("../models/multi-series");
|
|
16
16
|
var _pie = require("../models/pie");
|
|
17
|
+
var _bar = require("../models/bar");
|
|
17
18
|
function getDimensionHeaderIndex(headers, name) {
|
|
18
19
|
return (0, _lodash.findIndex)(headers, {
|
|
19
20
|
name
|
|
@@ -119,6 +120,10 @@ function getChartInstance(id, analytics, config) {
|
|
|
119
120
|
switch (config.type) {
|
|
120
121
|
case "column":
|
|
121
122
|
return new _column.DHIS2ColumnChart(id, analytics, config);
|
|
123
|
+
case "bar":
|
|
124
|
+
return new _bar.DHIS2BarChart(id, analytics, config);
|
|
125
|
+
case "stacked-bar":
|
|
126
|
+
return new _bar.DHIS2StackedBarChart(id, analytics, config);
|
|
122
127
|
case "stacked-column":
|
|
123
128
|
return new _column.DHIS2StackedColumnChart(id, analytics, config);
|
|
124
129
|
case "pie":
|
|
@@ -3,7 +3,7 @@ import { mount } from "@cypress/react";
|
|
|
3
3
|
import HighCharts from "highcharts";
|
|
4
4
|
import React, { useState } from "react";
|
|
5
5
|
import { ChartDownloadMenu } from "./components/DownloadMenu";
|
|
6
|
-
import columnData from "
|
|
6
|
+
import columnData from "../../../../../resources/analytics/column-data.json";
|
|
7
7
|
import { setupHighchartsModules } from "./services/export";
|
|
8
8
|
import { ChartAnalytics } from ".";
|
|
9
9
|
const props = {
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { DHIS2ColumnChart } from "./column";
|
|
2
|
+
export class DHIS2BarChart extends DHIS2ColumnChart {
|
|
3
|
+
getHighchartsType() {
|
|
4
|
+
return "bar";
|
|
5
|
+
}
|
|
6
|
+
}
|
|
7
|
+
export class DHIS2StackedBarChart extends DHIS2BarChart {
|
|
8
|
+
getPlotOptions() {
|
|
9
|
+
return {
|
|
10
|
+
column: {
|
|
11
|
+
stacking: "normal",
|
|
12
|
+
...super.getPlotOptions().column
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -3,6 +3,7 @@ import { DHIS2ColumnChart, DHIS2StackedColumnChart } from "../models/column";
|
|
|
3
3
|
import { DHIS2LineChart } from "../models/line";
|
|
4
4
|
import { DHIS2MultiSeriesChart } from "../models/multi-series";
|
|
5
5
|
import { DHIS2PieChart } from "../models/pie";
|
|
6
|
+
import { DHIS2BarChart, DHIS2StackedBarChart } from "../models/bar";
|
|
6
7
|
export function getDimensionHeaderIndex(headers, name) {
|
|
7
8
|
return findIndex(headers, {
|
|
8
9
|
name
|
|
@@ -108,6 +109,10 @@ export function getChartInstance(id, analytics, config) {
|
|
|
108
109
|
switch (config.type) {
|
|
109
110
|
case "column":
|
|
110
111
|
return new DHIS2ColumnChart(id, analytics, config);
|
|
112
|
+
case "bar":
|
|
113
|
+
return new DHIS2BarChart(id, analytics, config);
|
|
114
|
+
case "stacked-bar":
|
|
115
|
+
return new DHIS2StackedBarChart(id, analytics, config);
|
|
111
116
|
case "stacked-column":
|
|
112
117
|
return new DHIS2StackedColumnChart(id, analytics, config);
|
|
113
118
|
case "pie":
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { PlotOptions } from "highcharts";
|
|
2
|
+
import { DHIS2ColumnChart } from "./column";
|
|
3
|
+
export declare class DHIS2BarChart extends DHIS2ColumnChart {
|
|
4
|
+
getHighchartsType(): string;
|
|
5
|
+
}
|
|
6
|
+
export declare class DHIS2StackedBarChart extends DHIS2BarChart {
|
|
7
|
+
getPlotOptions(): PlotOptions;
|
|
8
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Analytics } from "@hisptz/dhis2-utils";
|
|
2
2
|
import HighCharts, { DashStyleValue, YAxisOptions, YAxisPlotLinesLabelOptions } from "highcharts";
|
|
3
|
-
export type ChartType = "column" | "pie" | "stacked-column" | "line" | "multi-series";
|
|
3
|
+
export type ChartType = "column" | "pie" | "stacked-column" | "line" | "multi-series" | "bar" | "stacked-bar";
|
|
4
4
|
export interface MultiSeriesConfig {
|
|
5
5
|
series?: Array<{
|
|
6
6
|
id: string;
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hisptz/dhis2-analytics",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.52",
|
|
4
4
|
"description": "A collection of reusable react components for visualizing analytics data from DHIS2",
|
|
5
5
|
"license": "BSD-3-Clause",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"build": "d2-app-scripts build --no-verify --mode production",
|
|
8
|
+
"start": "d2-app-scripts build --no-verify --mode development --watch",
|
|
8
9
|
"build:types": "tsc --project tsconfig.build.json",
|
|
9
10
|
"postbuild": "yarn build:types",
|
|
10
|
-
"start": "d2-app-scripts start",
|
|
11
11
|
"test": "d2-app-scripts test --passWithNoTests",
|
|
12
12
|
"deploy": "d2-app-scripts deploy",
|
|
13
13
|
"publish:analytics": "yarn publish --access public"
|
|
@@ -31,8 +31,8 @@
|
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"@dhis2/app-runtime": "^3.7.0",
|
|
34
|
-
"@hisptz/dhis2-ui": "^1.0.
|
|
35
|
-
"@hisptz/dhis2-utils": "
|
|
34
|
+
"@hisptz/dhis2-ui": "^1.0.52",
|
|
35
|
+
"@hisptz/dhis2-utils": "^1.0.52",
|
|
36
36
|
"@react-leaflet/core": "^2.1.0",
|
|
37
37
|
"async-es": "^3.2.4",
|
|
38
38
|
"d3-color": "^3.1.0",
|
|
@@ -87,5 +87,5 @@
|
|
|
87
87
|
"react-hook-form": "^7.43",
|
|
88
88
|
"recoil": "*"
|
|
89
89
|
},
|
|
90
|
-
"gitHead": "
|
|
90
|
+
"gitHead": "4212ece071c05d22b32b49fecae2a26a431ebb4c"
|
|
91
91
|
}
|