@hisptz/dhis2-analytics 1.0.5 → 1.0.6
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.stories.js +253 -0
- package/build/cjs/components/ChartAnalytics/ChartAnalytics.test.js +51 -0
- package/build/cjs/components/ChartAnalytics/components/DownloadMenu/components/Menu.js +48 -0
- package/build/cjs/components/ChartAnalytics/components/DownloadMenu/constants/menu.js +34 -0
- package/build/cjs/components/ChartAnalytics/components/DownloadMenu/index.js +67 -0
- package/build/cjs/components/ChartAnalytics/components/DownloadMenu/interfaces/menu.js +1 -0
- package/{src → build/cjs}/components/ChartAnalytics/data/column-data.json +0 -0
- package/{src → build/cjs}/components/ChartAnalytics/data/complex-multi-series-data.json +0 -0
- package/{src → build/cjs}/components/ChartAnalytics/data/multi-series-data.json +0 -0
- package/{src → build/cjs}/components/ChartAnalytics/data/pie-data.json +0 -0
- package/{src → build/cjs}/components/ChartAnalytics/data/stacked-chart-data.json +0 -0
- package/build/cjs/components/ChartAnalytics/hooks/useChart.js +38 -0
- package/build/cjs/components/ChartAnalytics/index.js +69 -0
- package/build/cjs/components/ChartAnalytics/models/column.js +53 -0
- package/build/cjs/components/ChartAnalytics/models/index.js +102 -0
- package/build/cjs/components/ChartAnalytics/models/line.js +35 -0
- package/build/cjs/components/ChartAnalytics/models/multi-series.js +111 -0
- package/build/cjs/components/ChartAnalytics/models/pie.js +53 -0
- package/build/cjs/components/ChartAnalytics/services/export.js +50 -0
- package/{src → build/cjs}/components/ChartAnalytics/styles/custom-highchart.css +0 -0
- package/build/cjs/components/ChartAnalytics/types/props.js +1 -0
- package/build/cjs/components/ChartAnalytics/utils/chart.js +133 -0
- package/build/cjs/components/CircularProgressDashboard/CircularProgressIndicator.stories.js +45 -0
- package/build/cjs/components/CircularProgressDashboard/CircularProgressIndicator.test.js +13 -0
- package/build/cjs/components/CircularProgressDashboard/index.js +49 -0
- package/build/cjs/components/CircularProgressDashboard/types/props.js +1 -0
- package/build/cjs/components/Map/Map.stories.js +352 -0
- package/build/cjs/components/Map/components/EarthEngineLayerConfiguration/EarthEngineLayerConfigModal.stories.js +32 -0
- package/build/cjs/components/Map/components/EarthEngineLayerConfiguration/EarthEngineLayerConfiguration.stories.js +40 -0
- package/build/cjs/components/Map/components/EarthEngineLayerConfiguration/index.js +458 -0
- package/build/cjs/components/Map/components/MapArea/index.js +101 -0
- package/build/cjs/components/Map/components/MapArea/interfaces/index.js +1 -0
- package/build/cjs/components/Map/components/MapControls/components/CustomControl/index.js +32 -0
- package/build/cjs/components/Map/components/MapControls/components/DownloadControl/index.js +25 -0
- package/build/cjs/components/Map/components/MapControls/components/FullscreenControl/index.js +13 -0
- package/build/cjs/components/Map/components/MapControls/index.js +42 -0
- package/build/cjs/components/Map/components/MapLayer/components/BoundaryLayer/hooks/useBoundaryData.js +13 -0
- package/build/cjs/components/Map/components/MapLayer/components/BoundaryLayer/index.js +51 -0
- package/build/cjs/components/Map/components/MapLayer/components/GoogleEngineLayer/components/EarthEngineLegend.js +106 -0
- package/build/cjs/components/Map/components/MapLayer/components/GoogleEngineLayer/constants/index.js +379 -0
- package/build/cjs/components/Map/components/MapLayer/components/GoogleEngineLayer/hooks/index.js +36 -0
- package/build/cjs/components/Map/components/MapLayer/components/GoogleEngineLayer/index.js +200 -0
- package/build/cjs/components/Map/components/MapLayer/components/GoogleEngineLayer/interfaces/index.js +1 -0
- package/build/cjs/components/Map/components/MapLayer/components/GoogleEngineLayer/services/api.js +10 -0
- package/build/cjs/components/Map/components/MapLayer/components/GoogleEngineLayer/services/engine.js +412 -0
- package/build/cjs/components/Map/components/MapLayer/components/GoogleEngineLayer/utils/index.js +124 -0
- package/{src → build/cjs}/components/Map/components/MapLayer/components/LegendArea/LegendArea.module.css +0 -0
- package/build/cjs/components/Map/components/MapLayer/components/LegendArea/components/LegendCardHeader/index.js +26 -0
- package/build/cjs/components/Map/components/MapLayer/components/LegendArea/index.js +181 -0
- package/build/cjs/components/Map/components/MapLayer/components/PointLayer/components/PointLegend/index.js +86 -0
- package/build/cjs/components/Map/components/MapLayer/components/PointLayer/hooks/index.js +14 -0
- package/build/cjs/components/Map/components/MapLayer/components/PointLayer/index.js +46 -0
- package/build/cjs/components/Map/components/MapLayer/components/ThematicLayer/components/Bubble/components/BubbleLegend/components/Bubble.js +57 -0
- package/build/cjs/components/Map/components/MapLayer/components/ThematicLayer/components/Bubble/components/BubbleLegend/components/Bubbles.js +145 -0
- package/build/cjs/components/Map/components/MapLayer/components/ThematicLayer/components/Bubble/components/BubbleLegend/index.js +43 -0
- package/build/cjs/components/Map/components/MapLayer/components/ThematicLayer/components/Bubble/index.js +56 -0
- package/build/cjs/components/Map/components/MapLayer/components/ThematicLayer/components/Choropleth/components/ChoroplethLegend.js +61 -0
- package/build/cjs/components/Map/components/MapLayer/components/ThematicLayer/components/Choropleth/index.js +43 -0
- package/build/cjs/components/Map/components/MapLayer/components/ThematicLayer/components/CustomTooltip/index.js +35 -0
- package/build/cjs/components/Map/components/MapLayer/components/ThematicLayer/hooks/config.js +15 -0
- package/build/cjs/components/Map/components/MapLayer/components/ThematicLayer/index.js +57 -0
- package/{src → build/cjs}/components/Map/components/MapLayer/components/ThematicLayer/styles/legends.css +0 -0
- package/build/cjs/components/Map/components/MapLayer/index.js +40 -0
- package/build/cjs/components/Map/components/MapLayer/interfaces/index.js +8 -0
- package/build/cjs/components/Map/components/MapProvider/components/MapLayerProvider/hooks/index.js +389 -0
- package/build/cjs/components/Map/components/MapProvider/components/MapLayerProvider/index.js +116 -0
- package/build/cjs/components/Map/components/MapProvider/hooks/index.js +19 -0
- package/build/cjs/components/Map/components/MapProvider/index.js +121 -0
- package/build/cjs/components/Map/components/MapUpdater/index.js +24 -0
- package/build/cjs/components/Map/components/ThematicLayerConfiguration/ThematicLayerConfigModal.stories.js +32 -0
- package/build/cjs/components/Map/components/ThematicLayerConfiguration/ThematicLayerConfiguration.stories.js +40 -0
- package/build/cjs/components/Map/components/ThematicLayerConfiguration/components/ColorScaleSelect/components/ColorScale/index.js +40 -0
- package/build/cjs/components/Map/components/ThematicLayerConfiguration/components/ColorScaleSelect/constants/colors.js +428 -0
- package/build/cjs/components/Map/components/ThematicLayerConfiguration/components/ColorScaleSelect/index.js +63 -0
- package/{src → build/cjs}/components/Map/components/ThematicLayerConfiguration/components/ColorScaleSelect/styles/ColorScale.module.css +0 -0
- package/{src → build/cjs}/components/Map/components/ThematicLayerConfiguration/components/ColorScaleSelect/styles/ColorScaleSelect.module.css +0 -0
- package/build/cjs/components/Map/components/ThematicLayerConfiguration/components/ColorScaleSelect/utils/colors.js +72 -0
- package/build/cjs/components/Map/components/ThematicLayerConfiguration/components/CustomLegend/index.js +71 -0
- package/build/cjs/components/Map/components/ThematicLayerConfiguration/components/IndicatorSelectorModal/index.js +47 -0
- package/build/cjs/components/Map/components/ThematicLayerConfiguration/components/LegendSetSelector/index.js +79 -0
- package/build/cjs/components/Map/components/ThematicLayerConfiguration/index.js +265 -0
- package/build/cjs/components/Map/constants/colors.js +428 -0
- package/build/cjs/components/Map/constants/legendSet.js +22 -0
- package/build/cjs/components/Map/hooks/map.js +52 -0
- package/build/cjs/components/Map/index.js +108 -0
- package/build/cjs/components/Map/interfaces/index.js +1 -0
- package/build/cjs/components/Map/state/index.js +23 -0
- package/build/cjs/components/Map/utils/colors.js +78 -0
- package/build/cjs/components/Map/utils/helpers.js +25 -0
- package/build/cjs/components/Map/utils/map.js +161 -0
- package/build/cjs/components/SingleValueContainer/SingleValueContainer.stories.js +127 -0
- package/build/cjs/components/SingleValueContainer/SingleValueContainer.test.js +23 -0
- package/build/cjs/components/SingleValueContainer/components/SingleValueItem/SingleValueItem.js +54 -0
- package/build/cjs/components/SingleValueContainer/components/SingleValueItem/SingleValuePercentage.js +24 -0
- package/build/cjs/components/SingleValueContainer/index.js +43 -0
- package/{src → build/cjs}/components/SingleValueContainer/styles/SingleValueContainer.module.css +0 -0
- package/build/cjs/components/SingleValueContainer/types/props.js +1 -0
- package/{src → build/cjs}/data/map.json +0 -0
- package/build/cjs/dataProviders/map.js +31 -0
- package/build/cjs/index.js +49 -0
- package/build/cjs/index.test.js +7 -0
- package/build/cjs/locales/en/translations.json +128 -0
- package/build/cjs/locales/index.js +22 -0
- package/build/es/components/ChartAnalytics/ChartAnalytics.stories.js +235 -0
- package/build/es/components/ChartAnalytics/ChartAnalytics.test.js +46 -0
- package/build/es/components/ChartAnalytics/components/DownloadMenu/components/Menu.js +41 -0
- package/build/es/components/ChartAnalytics/components/DownloadMenu/constants/menu.js +26 -0
- package/build/es/components/ChartAnalytics/components/DownloadMenu/index.js +58 -0
- package/build/es/components/ChartAnalytics/components/DownloadMenu/interfaces/menu.js +1 -0
- package/build/es/components/ChartAnalytics/data/column-data.json +210 -0
- package/build/es/components/ChartAnalytics/data/complex-multi-series-data.json +124 -0
- package/build/es/components/ChartAnalytics/data/multi-series-data.json +536 -0
- package/build/es/components/ChartAnalytics/data/pie-data.json +115 -0
- package/build/es/components/ChartAnalytics/data/stacked-chart-data.json +415 -0
- package/build/es/components/ChartAnalytics/hooks/useChart.js +32 -0
- package/build/es/components/ChartAnalytics/index.js +40 -0
- package/build/es/components/ChartAnalytics/models/column.js +45 -0
- package/build/es/components/ChartAnalytics/models/index.js +95 -0
- package/build/es/components/ChartAnalytics/models/line.js +28 -0
- package/build/es/components/ChartAnalytics/models/multi-series.js +104 -0
- package/build/es/components/ChartAnalytics/models/pie.js +46 -0
- package/build/es/components/ChartAnalytics/services/export.js +36 -0
- package/build/es/components/ChartAnalytics/styles/custom-highchart.css +48 -0
- package/build/es/components/ChartAnalytics/types/props.js +1 -0
- package/build/es/components/ChartAnalytics/utils/chart.js +122 -0
- package/{src/components/CircularProgressDashboard/CircularProgressIndicator.stories.tsx → build/es/components/CircularProgressDashboard/CircularProgressIndicator.stories.js} +9 -16
- package/build/es/components/CircularProgressDashboard/CircularProgressIndicator.test.js +10 -0
- package/build/es/components/CircularProgressDashboard/index.js +41 -0
- package/build/es/components/CircularProgressDashboard/types/props.js +1 -0
- package/build/es/components/Map/Map.stories.js +334 -0
- package/build/es/components/Map/components/EarthEngineLayerConfiguration/EarthEngineLayerConfigModal.stories.js +23 -0
- package/build/es/components/Map/components/EarthEngineLayerConfiguration/EarthEngineLayerConfiguration.stories.js +31 -0
- package/build/es/components/Map/components/EarthEngineLayerConfiguration/index.js +448 -0
- package/build/es/components/Map/components/MapArea/index.js +91 -0
- package/build/es/components/Map/components/MapArea/interfaces/index.js +1 -0
- package/build/es/components/Map/components/MapControls/components/CustomControl/index.js +25 -0
- package/build/es/components/Map/components/MapControls/components/DownloadControl/index.js +18 -0
- package/build/es/components/Map/components/MapControls/components/FullscreenControl/index.js +6 -0
- package/build/es/components/Map/components/MapControls/index.js +35 -0
- package/build/es/components/Map/components/MapLayer/components/BoundaryLayer/hooks/useBoundaryData.js +7 -0
- package/build/es/components/Map/components/MapLayer/components/BoundaryLayer/index.js +41 -0
- package/build/es/components/Map/components/MapLayer/components/GoogleEngineLayer/components/EarthEngineLegend.js +95 -0
- package/build/es/components/Map/components/MapLayer/components/GoogleEngineLayer/constants/index.js +369 -0
- package/build/es/components/Map/components/MapLayer/components/GoogleEngineLayer/hooks/index.js +29 -0
- package/build/es/components/Map/components/MapLayer/components/GoogleEngineLayer/index.js +191 -0
- package/build/es/components/Map/components/MapLayer/components/GoogleEngineLayer/interfaces/index.js +1 -0
- package/build/es/components/Map/components/MapLayer/components/GoogleEngineLayer/services/api.js +10 -0
- package/build/es/components/Map/components/MapLayer/components/GoogleEngineLayer/services/engine.js +403 -0
- package/build/es/components/Map/components/MapLayer/components/GoogleEngineLayer/utils/index.js +111 -0
- package/build/es/components/Map/components/MapLayer/components/LegendArea/LegendArea.module.css +12 -0
- package/build/es/components/Map/components/MapLayer/components/LegendArea/components/LegendCardHeader/index.js +19 -0
- package/build/es/components/Map/components/MapLayer/components/LegendArea/index.js +172 -0
- package/build/es/components/Map/components/MapLayer/components/PointLayer/components/PointLegend/index.js +76 -0
- package/build/es/components/Map/components/MapLayer/components/PointLayer/hooks/index.js +8 -0
- package/build/es/components/Map/components/MapLayer/components/PointLayer/index.js +39 -0
- package/build/es/components/Map/components/MapLayer/components/ThematicLayer/components/Bubble/components/BubbleLegend/components/Bubble.js +49 -0
- package/{src/components/Map/components/MapLayer/components/ThematicLayer/components/Bubble/components/BubbleLegend/components/Bubbles.tsx → build/es/components/Map/components/MapLayer/components/ThematicLayer/components/Bubble/components/BubbleLegend/components/Bubbles.js} +57 -74
- package/build/es/components/Map/components/MapLayer/components/ThematicLayer/components/Bubble/components/BubbleLegend/index.js +33 -0
- package/build/es/components/Map/components/MapLayer/components/ThematicLayer/components/Bubble/index.js +47 -0
- package/build/es/components/Map/components/MapLayer/components/ThematicLayer/components/Choropleth/components/ChoroplethLegend.js +50 -0
- package/build/es/components/Map/components/MapLayer/components/ThematicLayer/components/Choropleth/index.js +36 -0
- package/build/es/components/Map/components/MapLayer/components/ThematicLayer/components/CustomTooltip/index.js +28 -0
- package/build/es/components/Map/components/MapLayer/components/ThematicLayer/hooks/config.js +9 -0
- package/build/es/components/Map/components/MapLayer/components/ThematicLayer/index.js +50 -0
- package/build/es/components/Map/components/MapLayer/components/ThematicLayer/styles/legends.css +62 -0
- package/build/es/components/Map/components/MapLayer/index.js +33 -0
- package/build/es/components/Map/components/MapLayer/interfaces/index.js +1 -0
- package/build/es/components/Map/components/MapProvider/components/MapLayerProvider/hooks/index.js +381 -0
- package/build/es/components/Map/components/MapProvider/components/MapLayerProvider/index.js +107 -0
- package/{src/components/Map/components/MapProvider/hooks/index.ts → build/es/components/Map/components/MapProvider/hooks/index.js} +3 -6
- package/build/es/components/Map/components/MapProvider/index.js +112 -0
- package/build/es/components/Map/components/MapUpdater/index.js +17 -0
- package/build/es/components/Map/components/ThematicLayerConfiguration/ThematicLayerConfigModal.stories.js +23 -0
- package/build/es/components/Map/components/ThematicLayerConfiguration/ThematicLayerConfiguration.stories.js +31 -0
- package/build/es/components/Map/components/ThematicLayerConfiguration/components/ColorScaleSelect/components/ColorScale/index.js +33 -0
- package/{src/components/Map/components/ThematicLayerConfiguration/components/ColorScaleSelect/constants/colors.ts → build/es/components/Map/components/ThematicLayerConfiguration/components/ColorScaleSelect/constants/colors.js} +46 -59
- package/build/es/components/Map/components/ThematicLayerConfiguration/components/ColorScaleSelect/index.js +53 -0
- package/build/es/components/Map/components/ThematicLayerConfiguration/components/ColorScaleSelect/styles/ColorScale.module.css +15 -0
- package/build/es/components/Map/components/ThematicLayerConfiguration/components/ColorScaleSelect/styles/ColorScaleSelect.module.css +12 -0
- package/build/es/components/Map/components/ThematicLayerConfiguration/components/ColorScaleSelect/utils/colors.js +56 -0
- package/build/es/components/Map/components/ThematicLayerConfiguration/components/CustomLegend/index.js +64 -0
- package/build/es/components/Map/components/ThematicLayerConfiguration/components/IndicatorSelectorModal/index.js +38 -0
- package/build/es/components/Map/components/ThematicLayerConfiguration/components/LegendSetSelector/index.js +70 -0
- package/build/es/components/Map/components/ThematicLayerConfiguration/index.js +254 -0
- package/{src/components/Map/constants/colors.ts → build/es/components/Map/constants/colors.js} +46 -59
- package/build/es/components/Map/constants/legendSet.js +15 -0
- package/build/es/components/Map/hooks/map.js +44 -0
- package/build/es/components/Map/index.js +51 -0
- package/build/es/components/Map/interfaces/index.js +1 -0
- package/build/es/components/Map/state/index.js +14 -0
- package/build/es/components/Map/utils/colors.js +61 -0
- package/build/es/components/Map/utils/helpers.js +14 -0
- package/build/es/components/Map/utils/map.js +147 -0
- package/build/es/components/SingleValueContainer/SingleValueContainer.stories.js +115 -0
- package/build/es/components/SingleValueContainer/SingleValueContainer.test.js +20 -0
- package/build/es/components/SingleValueContainer/components/SingleValueItem/SingleValueItem.js +47 -0
- package/build/es/components/SingleValueContainer/components/SingleValueItem/SingleValuePercentage.js +17 -0
- package/build/es/components/SingleValueContainer/index.js +29 -0
- package/build/es/components/SingleValueContainer/styles/SingleValueContainer.module.css +39 -0
- package/build/es/components/SingleValueContainer/types/props.js +1 -0
- package/build/es/data/map.json +5984 -0
- package/build/es/dataProviders/map.js +24 -0
- package/{src/index.ts → build/es/index.js} +1 -0
- package/build/es/index.test.js +6 -0
- package/build/es/locales/en/translations.json +128 -0
- package/build/es/locales/index.js +13 -0
- package/package.json +21 -4
- package/d2.config.js +0 -8
- package/i18n/en.pot +0 -409
- package/src/components/ChartAnalytics/ChartAnalytics.stories.tsx +0 -250
- package/src/components/ChartAnalytics/ChartAnalytics.test.tsx +0 -51
- package/src/components/ChartAnalytics/components/DownloadMenu/components/Menu.tsx +0 -48
- package/src/components/ChartAnalytics/components/DownloadMenu/constants/menu.ts +0 -38
- package/src/components/ChartAnalytics/components/DownloadMenu/index.tsx +0 -67
- package/src/components/ChartAnalytics/components/DownloadMenu/interfaces/menu.ts +0 -1
- package/src/components/ChartAnalytics/hooks/useChart.ts +0 -35
- package/src/components/ChartAnalytics/index.tsx +0 -23
- package/src/components/ChartAnalytics/models/column.ts +0 -50
- package/src/components/ChartAnalytics/models/index.ts +0 -78
- package/src/components/ChartAnalytics/models/line.ts +0 -31
- package/src/components/ChartAnalytics/models/multi-series.ts +0 -115
- package/src/components/ChartAnalytics/models/pie.ts +0 -54
- package/src/components/ChartAnalytics/services/export.ts +0 -38
- package/src/components/ChartAnalytics/types/props.tsx +0 -48
- package/src/components/ChartAnalytics/utils/chart.ts +0 -123
- package/src/components/CircularProgressDashboard/CircularProgressIndicator.test.tsx +0 -9
- package/src/components/CircularProgressDashboard/index.tsx +0 -35
- package/src/components/CircularProgressDashboard/types/props.tsx +0 -17
- package/src/components/Map/Map.stories.tsx +0 -339
- package/src/components/Map/components/EarthEngineLayerConfiguration/EarthEngineLayerConfigModal.stories.tsx +0 -28
- package/src/components/Map/components/EarthEngineLayerConfiguration/EarthEngineLayerConfiguration.stories.tsx +0 -34
- package/src/components/Map/components/EarthEngineLayerConfiguration/index.tsx +0 -412
- package/src/components/Map/components/MapArea/index.tsx +0 -83
- package/src/components/Map/components/MapArea/interfaces/index.ts +0 -39
- package/src/components/Map/components/MapControls/components/CustomControl/index.tsx +0 -24
- package/src/components/Map/components/MapControls/components/DownloadControl/index.tsx +0 -10
- package/src/components/Map/components/MapControls/components/FullscreenControl/index.tsx +0 -7
- package/src/components/Map/components/MapControls/index.tsx +0 -24
- package/src/components/Map/components/MapLayer/components/BoundaryLayer/hooks/useBoundaryData.ts +0 -7
- package/src/components/Map/components/MapLayer/components/BoundaryLayer/index.tsx +0 -55
- package/src/components/Map/components/MapLayer/components/GoogleEngineLayer/components/EarthEngineLegend.tsx +0 -76
- package/src/components/Map/components/MapLayer/components/GoogleEngineLayer/constants/index.ts +0 -430
- package/src/components/Map/components/MapLayer/components/GoogleEngineLayer/hooks/index.ts +0 -34
- package/src/components/Map/components/MapLayer/components/GoogleEngineLayer/index.tsx +0 -185
- package/src/components/Map/components/MapLayer/components/GoogleEngineLayer/interfaces/index.ts +0 -56
- package/src/components/Map/components/MapLayer/components/GoogleEngineLayer/services/api.js +0 -34233
- package/src/components/Map/components/MapLayer/components/GoogleEngineLayer/services/engine.ts +0 -431
- package/src/components/Map/components/MapLayer/components/GoogleEngineLayer/utils/index.ts +0 -105
- package/src/components/Map/components/MapLayer/components/LegendArea/components/LegendCardHeader/index.tsx +0 -17
- package/src/components/Map/components/MapLayer/components/LegendArea/index.tsx +0 -168
- package/src/components/Map/components/MapLayer/components/PointLayer/components/PointLegend/index.tsx +0 -44
- package/src/components/Map/components/MapLayer/components/PointLayer/hooks/index.ts +0 -8
- package/src/components/Map/components/MapLayer/components/PointLayer/index.tsx +0 -36
- package/src/components/Map/components/MapLayer/components/ThematicLayer/components/Bubble/components/BubbleLegend/components/Bubble.tsx +0 -48
- package/src/components/Map/components/MapLayer/components/ThematicLayer/components/Bubble/components/BubbleLegend/index.tsx +0 -39
- package/src/components/Map/components/MapLayer/components/ThematicLayer/components/Bubble/index.tsx +0 -57
- package/src/components/Map/components/MapLayer/components/ThematicLayer/components/Choropleth/components/ChoroplethLegend.tsx +0 -43
- package/src/components/Map/components/MapLayer/components/ThematicLayer/components/Choropleth/index.tsx +0 -38
- package/src/components/Map/components/MapLayer/components/ThematicLayer/components/CustomTooltip/index.tsx +0 -26
- package/src/components/Map/components/MapLayer/components/ThematicLayer/hooks/config.ts +0 -10
- package/src/components/Map/components/MapLayer/components/ThematicLayer/index.tsx +0 -46
- package/src/components/Map/components/MapLayer/index.tsx +0 -32
- package/src/components/Map/components/MapLayer/interfaces/index.ts +0 -139
- package/src/components/Map/components/MapProvider/components/MapLayerProvider/hooks/index.tsx +0 -359
- package/src/components/Map/components/MapProvider/components/MapLayerProvider/index.tsx +0 -105
- package/src/components/Map/components/MapProvider/index.tsx +0 -93
- package/src/components/Map/components/MapUpdater/index.tsx +0 -8
- package/src/components/Map/components/ThematicLayerConfiguration/ThematicLayerConfigModal.stories.tsx +0 -28
- package/src/components/Map/components/ThematicLayerConfiguration/ThematicLayerConfiguration.stories.tsx +0 -34
- package/src/components/Map/components/ThematicLayerConfiguration/components/ColorScaleSelect/components/ColorScale/index.tsx +0 -24
- package/src/components/Map/components/ThematicLayerConfiguration/components/ColorScaleSelect/index.tsx +0 -50
- package/src/components/Map/components/ThematicLayerConfiguration/components/ColorScaleSelect/utils/colors.ts +0 -91
- package/src/components/Map/components/ThematicLayerConfiguration/components/CustomLegend/index.tsx +0 -45
- package/src/components/Map/components/ThematicLayerConfiguration/components/IndicatorSelectorModal/index.tsx +0 -47
- package/src/components/Map/components/ThematicLayerConfiguration/components/LegendSetSelector/index.tsx +0 -57
- package/src/components/Map/components/ThematicLayerConfiguration/index.tsx +0 -248
- package/src/components/Map/constants/legendSet.ts +0 -19
- package/src/components/Map/hooks/map.ts +0 -47
- package/src/components/Map/index.tsx +0 -65
- package/src/components/Map/interfaces/index.ts +0 -57
- package/src/components/Map/state/index.tsx +0 -31
- package/src/components/Map/utils/colors.ts +0 -95
- package/src/components/Map/utils/helpers.ts +0 -15
- package/src/components/Map/utils/map.ts +0 -150
- package/src/components/SingleValueContainer/SingleValueContainer.stories.tsx +0 -146
- package/src/components/SingleValueContainer/SingleValueContainer.test.tsx +0 -24
- package/src/components/SingleValueContainer/components/SingleValueItem/SingleValueItem.tsx +0 -46
- package/src/components/SingleValueContainer/components/SingleValueItem/SingleValuePercentage.tsx +0 -12
- package/src/components/SingleValueContainer/index.tsx +0 -30
- package/src/components/SingleValueContainer/types/props.tsx +0 -16
- package/src/dataProviders/map.tsx +0 -24
- package/src/index.test.ts +0 -7
- package/tsconfig.json +0 -45
|
@@ -1,250 +0,0 @@
|
|
|
1
|
-
import {CssReset} from "@dhis2/ui";
|
|
2
|
-
import type {Story} from "@storybook/react";
|
|
3
|
-
import HighCharts from "highcharts";
|
|
4
|
-
import HighchartsReact from "highcharts-react-official";
|
|
5
|
-
import React, {useState} from "react";
|
|
6
|
-
import ChartDownloadMenu from "./components/DownloadMenu";
|
|
7
|
-
import columnData from "./data/column-data.json";
|
|
8
|
-
import complexMultiSeriesData from "./data/complex-multi-series-data.json";
|
|
9
|
-
import multiSeriesData from "./data/multi-series-data.json";
|
|
10
|
-
import pieData from "./data/pie-data.json";
|
|
11
|
-
import stackedChartData from "./data/stacked-chart-data.json";
|
|
12
|
-
import {setupHighchartsModules} from "./services/export";
|
|
13
|
-
import {ChartAnalyticsProps} from "./types/props";
|
|
14
|
-
import ChartAnalytics from ".";
|
|
15
|
-
|
|
16
|
-
const Template: Story<ChartAnalyticsProps> = (args) => <ChartAnalytics {...args} />;
|
|
17
|
-
setupHighchartsModules(HighCharts);
|
|
18
|
-
|
|
19
|
-
export const Column = Template.bind({});
|
|
20
|
-
Column.args = {
|
|
21
|
-
analytics: columnData as any,
|
|
22
|
-
config: {
|
|
23
|
-
layout: {
|
|
24
|
-
series: ["dx"],
|
|
25
|
-
category: ["ou"],
|
|
26
|
-
filter: ["pe"],
|
|
27
|
-
},
|
|
28
|
-
type: "column",
|
|
29
|
-
height: 500,
|
|
30
|
-
colors: ["#2f7ed8", "#0d233a", "#8bbc21", "#910000", "#1aadce", "#492970", "#f28f43", "#77a1e5", "#c42525", "#a6c96a"],
|
|
31
|
-
},
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
export const MultipleColumns = Template.bind({});
|
|
35
|
-
MultipleColumns.args = {
|
|
36
|
-
analytics: multiSeriesData as any,
|
|
37
|
-
config: {
|
|
38
|
-
layout: {
|
|
39
|
-
series: ["ou"],
|
|
40
|
-
category: ["pe"],
|
|
41
|
-
filter: ["dx"],
|
|
42
|
-
},
|
|
43
|
-
type: "column",
|
|
44
|
-
height: 1000,
|
|
45
|
-
colors: ["#2f7ed8", "#0d233a", "#8bbc21", "#910000", "#1aadce", "#492970", "#f28f43", "#77a1e5", "#c42525", "#a6c96a"],
|
|
46
|
-
},
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
export const StackedColumn = Template.bind({});
|
|
50
|
-
StackedColumn.args = {
|
|
51
|
-
analytics: stackedChartData as any,
|
|
52
|
-
config: {
|
|
53
|
-
layout: {
|
|
54
|
-
series: ["ou"],
|
|
55
|
-
category: ["pe"],
|
|
56
|
-
filter: ["dx"],
|
|
57
|
-
},
|
|
58
|
-
type: "stacked-column",
|
|
59
|
-
height: 1000,
|
|
60
|
-
colors: ["#2f7ed8", "#0d233a", "#8bbc21", "#910000", "#1aadce", "#492970", "#f28f43", "#77a1e5", "#c42525", "#a6c96a"],
|
|
61
|
-
},
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
export const Line = Template.bind({});
|
|
65
|
-
Line.args = {
|
|
66
|
-
analytics: columnData as any,
|
|
67
|
-
config: {
|
|
68
|
-
layout: {
|
|
69
|
-
series: ["dx"],
|
|
70
|
-
category: ["ou"],
|
|
71
|
-
filter: ["pe"],
|
|
72
|
-
},
|
|
73
|
-
type: "line",
|
|
74
|
-
height: 1000,
|
|
75
|
-
colors: ["#2f7ed8", "#0d233a", "#8bbc21", "#910000", "#1aadce", "#492970", "#f28f43", "#77a1e5", "#c42525", "#a6c96a"],
|
|
76
|
-
},
|
|
77
|
-
};
|
|
78
|
-
|
|
79
|
-
export const MultipleLines = Template.bind({});
|
|
80
|
-
MultipleLines.args = {
|
|
81
|
-
analytics: multiSeriesData as any,
|
|
82
|
-
config: {
|
|
83
|
-
layout: {
|
|
84
|
-
series: ["ou"],
|
|
85
|
-
category: ["pe"],
|
|
86
|
-
filter: ["dx"],
|
|
87
|
-
},
|
|
88
|
-
type: "line",
|
|
89
|
-
height: 500,
|
|
90
|
-
colors: ["#2f7ed8", "#0d233a", "#8bbc21", "#910000", "#1aadce", "#492970", "#f28f43", "#77a1e5", "#c42525", "#a6c96a"],
|
|
91
|
-
},
|
|
92
|
-
};
|
|
93
|
-
|
|
94
|
-
export const PieChart = Template.bind({});
|
|
95
|
-
PieChart.args = {
|
|
96
|
-
analytics: pieData as any,
|
|
97
|
-
config: {
|
|
98
|
-
layout: {
|
|
99
|
-
series: ["dx"],
|
|
100
|
-
category: [],
|
|
101
|
-
filter: ["dx", "pe"],
|
|
102
|
-
},
|
|
103
|
-
type: "pie",
|
|
104
|
-
height: 500,
|
|
105
|
-
colors: ["#2f7ed8", "#0d233a", "#8bbc21", "#910000", "#1aadce", "#492970", "#f28f43", "#77a1e5", "#c4255", "#a6c96a"],
|
|
106
|
-
},
|
|
107
|
-
};
|
|
108
|
-
|
|
109
|
-
export const MultiSeries = Template.bind({});
|
|
110
|
-
MultiSeries.args = {
|
|
111
|
-
analytics: multiSeriesData as any,
|
|
112
|
-
config: {
|
|
113
|
-
layout: {
|
|
114
|
-
series: ["ou"],
|
|
115
|
-
category: ["pe"],
|
|
116
|
-
filter: ["dx"],
|
|
117
|
-
},
|
|
118
|
-
type: "multi-series",
|
|
119
|
-
height: 500,
|
|
120
|
-
colors: ["#2f7ed8", "#0d233a", "#8bbc21", "#910000", "#1aadce", "#492970", "#f28f43", "#77a1e5", "#c42525", "#a6c96a"],
|
|
121
|
-
multiSeries: {
|
|
122
|
-
series: [
|
|
123
|
-
{
|
|
124
|
-
id: "qhqAxPSTUXp",
|
|
125
|
-
as: "column",
|
|
126
|
-
yAxis: 0,
|
|
127
|
-
},
|
|
128
|
-
{
|
|
129
|
-
id: "Vth0fbpFcsO",
|
|
130
|
-
as: "line",
|
|
131
|
-
cumulative: true,
|
|
132
|
-
yAxis: 1,
|
|
133
|
-
},
|
|
134
|
-
],
|
|
135
|
-
yAxes: [
|
|
136
|
-
{
|
|
137
|
-
id: "yAxis1",
|
|
138
|
-
title: {
|
|
139
|
-
text: "Koinandugu",
|
|
140
|
-
},
|
|
141
|
-
labels: {
|
|
142
|
-
format: "{value}",
|
|
143
|
-
},
|
|
144
|
-
},
|
|
145
|
-
{
|
|
146
|
-
id: "yAxis2",
|
|
147
|
-
title: {
|
|
148
|
-
text: "Kono",
|
|
149
|
-
},
|
|
150
|
-
labels: {
|
|
151
|
-
format: "{value}",
|
|
152
|
-
},
|
|
153
|
-
opposite: true,
|
|
154
|
-
},
|
|
155
|
-
],
|
|
156
|
-
target: {
|
|
157
|
-
id: "",
|
|
158
|
-
styles: {
|
|
159
|
-
color: "blue",
|
|
160
|
-
},
|
|
161
|
-
value: 45,
|
|
162
|
-
label: {
|
|
163
|
-
text: "Target",
|
|
164
|
-
textAlign: "center",
|
|
165
|
-
verticalAlign: "middle",
|
|
166
|
-
},
|
|
167
|
-
},
|
|
168
|
-
},
|
|
169
|
-
},
|
|
170
|
-
};
|
|
171
|
-
|
|
172
|
-
export const ComplexMultiSeries = Template.bind({});
|
|
173
|
-
ComplexMultiSeries.args = {
|
|
174
|
-
analytics: complexMultiSeriesData as any,
|
|
175
|
-
config: {
|
|
176
|
-
layout: {
|
|
177
|
-
series: ["dx"],
|
|
178
|
-
category: ["pe"],
|
|
179
|
-
filter: ["ou"],
|
|
180
|
-
},
|
|
181
|
-
type: "multi-series",
|
|
182
|
-
height: 500,
|
|
183
|
-
colors: ["#2f7ed8", "#0d233a", "#8bbc21", "#910000", "#1aadce", "#492970", "#f28f43", "#77a1e5", "#c42525", "#a6c96a"],
|
|
184
|
-
multiSeries: {
|
|
185
|
-
series: [
|
|
186
|
-
{
|
|
187
|
-
id: "QQkOAJFukyY",
|
|
188
|
-
as: "column",
|
|
189
|
-
yAxis: 0,
|
|
190
|
-
},
|
|
191
|
-
{
|
|
192
|
-
id: "QQkOAJFukyY",
|
|
193
|
-
as: "line",
|
|
194
|
-
cumulative: true,
|
|
195
|
-
yAxis: 1,
|
|
196
|
-
},
|
|
197
|
-
],
|
|
198
|
-
yAxes: [
|
|
199
|
-
{
|
|
200
|
-
id: "yAxis1",
|
|
201
|
-
title: {
|
|
202
|
-
text: "Koinandugu",
|
|
203
|
-
},
|
|
204
|
-
labels: {
|
|
205
|
-
format: "{value}",
|
|
206
|
-
},
|
|
207
|
-
},
|
|
208
|
-
{
|
|
209
|
-
id: "yAxis2",
|
|
210
|
-
title: {
|
|
211
|
-
text: "Kono",
|
|
212
|
-
},
|
|
213
|
-
labels: {
|
|
214
|
-
format: "{value}",
|
|
215
|
-
},
|
|
216
|
-
opposite: true,
|
|
217
|
-
},
|
|
218
|
-
],
|
|
219
|
-
target: {
|
|
220
|
-
id: "",
|
|
221
|
-
styles: {
|
|
222
|
-
color: "blue",
|
|
223
|
-
},
|
|
224
|
-
value: 45,
|
|
225
|
-
label: {
|
|
226
|
-
text: "Target",
|
|
227
|
-
textAlign: "center",
|
|
228
|
-
verticalAlign: "middle",
|
|
229
|
-
},
|
|
230
|
-
},
|
|
231
|
-
},
|
|
232
|
-
},
|
|
233
|
-
};
|
|
234
|
-
|
|
235
|
-
export default {
|
|
236
|
-
title: "Components/Chart Analytics",
|
|
237
|
-
component: ChartAnalytics,
|
|
238
|
-
decorators: [
|
|
239
|
-
(ChartStory: any) => {
|
|
240
|
-
const [chartRef, setChartRef] = useState<HighchartsReact.RefObject | null>(null);
|
|
241
|
-
return (
|
|
242
|
-
<div style={{ width: 1000, height: "100%", display: "flex", gap: 8, flexDirection: "column" }}>
|
|
243
|
-
<CssReset />
|
|
244
|
-
<div style={{ width: "100%", display: "flex", justifyContent: "end" }}>{<ChartDownloadMenu chartRef={chartRef} />}</div>
|
|
245
|
-
<ChartStory ref={setChartRef} />
|
|
246
|
-
</div>
|
|
247
|
-
);
|
|
248
|
-
},
|
|
249
|
-
],
|
|
250
|
-
};
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import {mount} from "@cypress/react";
|
|
2
|
-
import HighCharts from "highcharts";
|
|
3
|
-
import HighchartsReact from "highcharts-react-official";
|
|
4
|
-
import React, {useState} from "react";
|
|
5
|
-
import ChartDownloadMenu from "./components/DownloadMenu";
|
|
6
|
-
import columnData from "./data/column-data.json";
|
|
7
|
-
import {setupHighchartsModules} from "./services/export";
|
|
8
|
-
import ChartAnalytics from ".";
|
|
9
|
-
|
|
10
|
-
const props: any = {
|
|
11
|
-
analytics: columnData as any,
|
|
12
|
-
config: {
|
|
13
|
-
layout: {
|
|
14
|
-
series: ["dx"],
|
|
15
|
-
category: ["ou"],
|
|
16
|
-
filter: ["pe"],
|
|
17
|
-
},
|
|
18
|
-
type: "column",
|
|
19
|
-
height: 500,
|
|
20
|
-
colors: ["#2f7ed8", "#0d233a", "#8bbc21", "#910000", "#1aadce", "#492970", "#f28f43", "#77a1e5", "#c42525", "#a6c96a"],
|
|
21
|
-
},
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
function TestComponent() {
|
|
25
|
-
return <ChartAnalytics {...props} />;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
function ExportTestComponent() {
|
|
29
|
-
const [chartRef, setChartRef] = useState<HighchartsReact.RefObject | null>(null);
|
|
30
|
-
|
|
31
|
-
return (
|
|
32
|
-
<div style={{ display: "flex", flexDirection: "column" }}>
|
|
33
|
-
<div>
|
|
34
|
-
<ChartDownloadMenu chartRef={chartRef} />
|
|
35
|
-
</div>
|
|
36
|
-
<ChartAnalytics {...props} ref={setChartRef} />
|
|
37
|
-
</div>
|
|
38
|
-
);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
describe("Chart Component Tests", () => {
|
|
42
|
-
setupHighchartsModules(HighCharts);
|
|
43
|
-
|
|
44
|
-
it("Mounts without errors", () => {
|
|
45
|
-
mount(<TestComponent />);
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
it("Can be exported as PDF", () => {
|
|
49
|
-
mount(<ExportTestComponent />);
|
|
50
|
-
});
|
|
51
|
-
});
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import {FlyoutMenu, Menu, MenuDivider, MenuItem, Popover} from "@dhis2/ui";
|
|
2
|
-
import {isEmpty, map} from "lodash";
|
|
3
|
-
import React from "react";
|
|
4
|
-
import {chartMenuSections} from "../constants/menu";
|
|
5
|
-
import {ChartExportMenuItem} from "../interfaces/menu";
|
|
6
|
-
|
|
7
|
-
export function ChartMenu({
|
|
8
|
-
menuRef,
|
|
9
|
-
onClick,
|
|
10
|
-
onClose,
|
|
11
|
-
exclude = [],
|
|
12
|
-
}: {
|
|
13
|
-
menuRef: HTMLButtonElement;
|
|
14
|
-
onClick: (action: string) => void;
|
|
15
|
-
onClose: () => void;
|
|
16
|
-
exclude?: ChartExportMenuItem[];
|
|
17
|
-
}) {
|
|
18
|
-
const onMenuClick = (action: string) => () => {
|
|
19
|
-
onClick(action);
|
|
20
|
-
onClose();
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
const menuSections = map(chartMenuSections, (section) => {
|
|
24
|
-
return {
|
|
25
|
-
...section,
|
|
26
|
-
menuItems: section.menuItems.filter((item: any) => !exclude.includes(item.name)),
|
|
27
|
-
};
|
|
28
|
-
}).filter((section) => !isEmpty(section.menuItems));
|
|
29
|
-
|
|
30
|
-
return (
|
|
31
|
-
<Popover onClickOutside={onClose} onClose={onClose} reference={menuRef}>
|
|
32
|
-
<FlyoutMenu>
|
|
33
|
-
<Menu>
|
|
34
|
-
{menuSections?.map((section, index) => {
|
|
35
|
-
return (
|
|
36
|
-
<>
|
|
37
|
-
{section.menuItems?.map(({ name, label }) => {
|
|
38
|
-
return <MenuItem key={`${name}-menu-item`} dataTest={`download-${name}`} label={label} onClick={onMenuClick(name)} />;
|
|
39
|
-
})}
|
|
40
|
-
{index !== menuSections.length - 1 && <MenuDivider />}
|
|
41
|
-
</>
|
|
42
|
-
);
|
|
43
|
-
})}
|
|
44
|
-
</Menu>
|
|
45
|
-
</FlyoutMenu>
|
|
46
|
-
</Popover>
|
|
47
|
-
);
|
|
48
|
-
}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import i18n from "@dhis2/d2-i18n";
|
|
2
|
-
|
|
3
|
-
export const chartMenuSections = [
|
|
4
|
-
{
|
|
5
|
-
name: "download",
|
|
6
|
-
menuItems: [
|
|
7
|
-
{
|
|
8
|
-
name: "png",
|
|
9
|
-
label: i18n.t("Download PNG"),
|
|
10
|
-
},
|
|
11
|
-
{
|
|
12
|
-
name: "jpeg",
|
|
13
|
-
label: i18n.t("Download JPEG"),
|
|
14
|
-
},
|
|
15
|
-
{
|
|
16
|
-
name: "svg",
|
|
17
|
-
label: i18n.t("Download SVG"),
|
|
18
|
-
},
|
|
19
|
-
{
|
|
20
|
-
name: "pdf",
|
|
21
|
-
label: i18n.t("Download PDF"),
|
|
22
|
-
},
|
|
23
|
-
],
|
|
24
|
-
},
|
|
25
|
-
{
|
|
26
|
-
name: "view",
|
|
27
|
-
menuItems: [
|
|
28
|
-
{
|
|
29
|
-
name: "table",
|
|
30
|
-
label: i18n.t("View as table"),
|
|
31
|
-
},
|
|
32
|
-
{
|
|
33
|
-
name: "full-screen",
|
|
34
|
-
label: i18n.t("View full screen"),
|
|
35
|
-
},
|
|
36
|
-
],
|
|
37
|
-
},
|
|
38
|
-
];
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import {IconMore24} from "@dhis2/ui";
|
|
2
|
-
import HighchartsReact from "highcharts-react-official";
|
|
3
|
-
import React, {useRef, useState} from "react";
|
|
4
|
-
import {onCSVDownload, onFullScreenView, onImageDownload, onPDFDownload, onViewAsTable} from "../../services/export";
|
|
5
|
-
import {ChartMenu} from "./components/Menu";
|
|
6
|
-
import {ChartExportMenuItem} from "./interfaces/menu";
|
|
7
|
-
|
|
8
|
-
function ChartDownloadMenu({
|
|
9
|
-
chartRef,
|
|
10
|
-
exclude,
|
|
11
|
-
icon,
|
|
12
|
-
}: {
|
|
13
|
-
chartRef: HighchartsReact.RefObject | null;
|
|
14
|
-
exclude?: ChartExportMenuItem[];
|
|
15
|
-
icon?: React.ReactNode;
|
|
16
|
-
}) {
|
|
17
|
-
const menuButtonRef = useRef<HTMLButtonElement | null>(null);
|
|
18
|
-
const [menuRef, setMenuRef] = useState<HTMLButtonElement | null>(null);
|
|
19
|
-
const toggleMenu = () => {
|
|
20
|
-
if (menuRef === null) {
|
|
21
|
-
setMenuRef(menuButtonRef.current);
|
|
22
|
-
} else {
|
|
23
|
-
setMenuRef(null);
|
|
24
|
-
}
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
const chart = chartRef;
|
|
28
|
-
|
|
29
|
-
const onMenuClick = (action: string) => {
|
|
30
|
-
if (chart) {
|
|
31
|
-
switch (action) {
|
|
32
|
-
case "png":
|
|
33
|
-
onImageDownload(chart, "png");
|
|
34
|
-
break;
|
|
35
|
-
case "jpeg":
|
|
36
|
-
onImageDownload(chart, "jpeg");
|
|
37
|
-
break;
|
|
38
|
-
case "svg":
|
|
39
|
-
onImageDownload(chart, "svg+xml");
|
|
40
|
-
break;
|
|
41
|
-
case "csv":
|
|
42
|
-
onCSVDownload(chart);
|
|
43
|
-
break;
|
|
44
|
-
case "pdf":
|
|
45
|
-
onPDFDownload(chart);
|
|
46
|
-
break;
|
|
47
|
-
case "table":
|
|
48
|
-
onViewAsTable(chart, true);
|
|
49
|
-
break;
|
|
50
|
-
case "full-screen":
|
|
51
|
-
onFullScreenView(chart);
|
|
52
|
-
break;
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
return (
|
|
58
|
-
<>
|
|
59
|
-
<div onClick={toggleMenu} ref={menuButtonRef}>
|
|
60
|
-
{icon ?? <IconMore24 />}
|
|
61
|
-
</div>
|
|
62
|
-
{menuRef && <ChartMenu exclude={exclude} onClick={onMenuClick} onClose={toggleMenu} menuRef={menuRef} />}
|
|
63
|
-
</>
|
|
64
|
-
);
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
export default ChartDownloadMenu;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export type ChartExportMenuItem = "png" | "jpeg" | "svg" | "csv" | "pdf" | "table" | "full-screen";
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import type {Analytics} from "@hisptz/dhis2-utils";
|
|
2
|
-
import HighCharts from "highcharts";
|
|
3
|
-
import {useCallback, useEffect, useState} from "react";
|
|
4
|
-
import {DHIS2Chart} from "../models";
|
|
5
|
-
import {ChartConfig, ChartType} from "../types/props";
|
|
6
|
-
import {getChartInstance, updateLayout} from "../utils/chart";
|
|
7
|
-
|
|
8
|
-
export function useChart({ id, analytics, config }: { id: string; analytics: Analytics; config: ChartConfig }): {
|
|
9
|
-
chart?: HighCharts.Options;
|
|
10
|
-
changeChartType: (type: ChartType) => void;
|
|
11
|
-
} {
|
|
12
|
-
const [chart, setChart] = useState<HighCharts.Options | undefined>(getChartInstance(id, analytics, config).getOptions());
|
|
13
|
-
|
|
14
|
-
const changeChartType = useCallback(
|
|
15
|
-
(type: ChartType) => {
|
|
16
|
-
const updatedLayout = updateLayout(config, { type });
|
|
17
|
-
const updatedConfig = { ...config, layout: updatedLayout, type };
|
|
18
|
-
const chartInstance: DHIS2Chart = getChartInstance(id, analytics, updatedConfig);
|
|
19
|
-
setChart(chartInstance.getOptions());
|
|
20
|
-
},
|
|
21
|
-
[config, id, analytics]
|
|
22
|
-
);
|
|
23
|
-
|
|
24
|
-
useEffect(() => {
|
|
25
|
-
if (analytics && config) {
|
|
26
|
-
const chartInstance: DHIS2Chart = getChartInstance(id, analytics, config);
|
|
27
|
-
setChart(chartInstance.getOptions());
|
|
28
|
-
}
|
|
29
|
-
}, [analytics, config, id]);
|
|
30
|
-
|
|
31
|
-
return {
|
|
32
|
-
chart,
|
|
33
|
-
changeChartType,
|
|
34
|
-
};
|
|
35
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import {uid} from "@hisptz/dhis2-utils";
|
|
2
|
-
import HighCharts from "highcharts";
|
|
3
|
-
import HighchartsReact from "highcharts-react-official";
|
|
4
|
-
import React, {forwardRef, useRef} from "react";
|
|
5
|
-
import ChartDownloadMenu from "./components/DownloadMenu";
|
|
6
|
-
import {useChart} from "./hooks/useChart";
|
|
7
|
-
import {ChartAnalyticsProps} from "./types/props";
|
|
8
|
-
import "./styles/custom-highchart.css";
|
|
9
|
-
|
|
10
|
-
export * from "./services/export";
|
|
11
|
-
export { ChartDownloadMenu };
|
|
12
|
-
|
|
13
|
-
function ChartAnalytics({ analytics, config, containerProps }: ChartAnalyticsProps, ref: React.ForwardedRef<HighchartsReact.RefObject>) {
|
|
14
|
-
const id = useRef(`${uid()}-chart-item`);
|
|
15
|
-
const { chart } = useChart({ id: id.current, analytics, config });
|
|
16
|
-
|
|
17
|
-
if (!chart) {
|
|
18
|
-
return null;
|
|
19
|
-
}
|
|
20
|
-
return <HighchartsReact immutable ref={ref} containerProps={{ id: id.current, ...(containerProps ?? {}) }} highcharts={HighCharts} options={{ ...chart }} />;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export default forwardRef(ChartAnalytics);
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import {PlotOptions, SeriesOptionsType, XAxisOptions} from "highcharts";
|
|
2
|
-
import {getAllCategories, getPointSeries} from "../utils/chart";
|
|
3
|
-
import {DHIS2Chart} from "./index";
|
|
4
|
-
|
|
5
|
-
export class DHIS2ColumnChart extends DHIS2Chart {
|
|
6
|
-
getCategories(): any[] | undefined {
|
|
7
|
-
return undefined;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
getHighchartsType(): string {
|
|
11
|
-
return "column";
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
getPlotOptions(): PlotOptions {
|
|
15
|
-
return {
|
|
16
|
-
column: {
|
|
17
|
-
dataLabels: {
|
|
18
|
-
enabled: true,
|
|
19
|
-
},
|
|
20
|
-
},
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
getSeries(): SeriesOptionsType[] {
|
|
25
|
-
return getPointSeries(this.analytics, this.config, "column");
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
getXAxis(): XAxisOptions | undefined {
|
|
29
|
-
return {
|
|
30
|
-
type: "category",
|
|
31
|
-
categories: getAllCategories(this.analytics, this.config),
|
|
32
|
-
crosshair: true,
|
|
33
|
-
labels: {
|
|
34
|
-
enabled: true,
|
|
35
|
-
},
|
|
36
|
-
title: { text: "" },
|
|
37
|
-
};
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
export class DHIS2StackedColumnChart extends DHIS2ColumnChart {
|
|
42
|
-
getPlotOptions(): PlotOptions {
|
|
43
|
-
return {
|
|
44
|
-
column: {
|
|
45
|
-
stacking: "normal",
|
|
46
|
-
...super.getPlotOptions().column,
|
|
47
|
-
},
|
|
48
|
-
};
|
|
49
|
-
}
|
|
50
|
-
}
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
import type {Analytics} from "@hisptz/dhis2-utils";
|
|
2
|
-
import HighCharts from "highcharts";
|
|
3
|
-
import {ChartConfig} from "../types/props";
|
|
4
|
-
|
|
5
|
-
export abstract class DHIS2Chart {
|
|
6
|
-
id: string;
|
|
7
|
-
analytics: Analytics;
|
|
8
|
-
config: ChartConfig;
|
|
9
|
-
|
|
10
|
-
constructor(id: string, analytics: Analytics, config: ChartConfig) {
|
|
11
|
-
this.id = id;
|
|
12
|
-
this.analytics = analytics;
|
|
13
|
-
this.config = config;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
abstract getHighchartsType(): string;
|
|
17
|
-
|
|
18
|
-
getChartConfig(): HighCharts.ChartOptions {
|
|
19
|
-
return {
|
|
20
|
-
renderTo: this.id,
|
|
21
|
-
zoomType: "xy",
|
|
22
|
-
type: this.getHighchartsType(),
|
|
23
|
-
height: this.config?.height,
|
|
24
|
-
styledMode: false,
|
|
25
|
-
};
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
getOptions(): HighCharts.Options {
|
|
29
|
-
return {
|
|
30
|
-
yAxis: this.getYAxis(),
|
|
31
|
-
chart: this.getChartConfig(),
|
|
32
|
-
colors: this.config?.colors ?? ["#2f7ed8", "#0d233a", "#8bbc21", "#910000", "#1aadce", "#492970", "#f28f43", "#77a1e5", "#c42525", "#a6c96a"],
|
|
33
|
-
series: this.getSeries(),
|
|
34
|
-
plotOptions: this.getPlotOptions(),
|
|
35
|
-
title: { text: "" },
|
|
36
|
-
xAxis: this.getXAxis(),
|
|
37
|
-
exporting: this.getExporting(),
|
|
38
|
-
legend: { enabled: true },
|
|
39
|
-
credits: { enabled: false },
|
|
40
|
-
...(this.config?.highChartOverrides ?? {}),
|
|
41
|
-
};
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
abstract getSeries(): HighCharts.SeriesOptionsType[];
|
|
45
|
-
|
|
46
|
-
abstract getPlotOptions(): HighCharts.PlotOptions;
|
|
47
|
-
|
|
48
|
-
abstract getXAxis(): HighCharts.XAxisOptions | undefined;
|
|
49
|
-
|
|
50
|
-
getYAxis(): HighCharts.YAxisOptions[] {
|
|
51
|
-
return [
|
|
52
|
-
{
|
|
53
|
-
title: {
|
|
54
|
-
text: "",
|
|
55
|
-
style: { color: "#000000", fontWeight: "normal", fontSize: "14px" },
|
|
56
|
-
},
|
|
57
|
-
labels: { enabled: true, style: { color: "#000000", fontWeight: "normal", fontSize: "14px" } },
|
|
58
|
-
plotLines: [
|
|
59
|
-
{ color: "#000000", dashStyle: "Solid", width: 2, zIndex: 1000, label: { text: "" } },
|
|
60
|
-
{ color: "#bbbbbb", dashStyle: "Solid", zIndex: 1000, width: 2, label: { text: "" } },
|
|
61
|
-
],
|
|
62
|
-
},
|
|
63
|
-
];
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
getExporting(): HighCharts.ExportingOptions {
|
|
67
|
-
const name = this.config?.name ?? "chart";
|
|
68
|
-
return {
|
|
69
|
-
filename: `${name}`,
|
|
70
|
-
sourceWidth: 1200,
|
|
71
|
-
buttons: {
|
|
72
|
-
contextButton: {
|
|
73
|
-
enabled: false,
|
|
74
|
-
},
|
|
75
|
-
},
|
|
76
|
-
};
|
|
77
|
-
}
|
|
78
|
-
}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import {PlotOptions, SeriesOptionsType, XAxisOptions} from "highcharts";
|
|
2
|
-
import {getAllCategories, getPointSeries} from "../utils/chart";
|
|
3
|
-
import {DHIS2Chart} from "./index";
|
|
4
|
-
|
|
5
|
-
export class DHIS2LineChart extends DHIS2Chart {
|
|
6
|
-
getHighchartsType(): string {
|
|
7
|
-
return "line";
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
getPlotOptions(): PlotOptions {
|
|
11
|
-
return {
|
|
12
|
-
line: {},
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
getSeries(): SeriesOptionsType[] {
|
|
17
|
-
return getPointSeries(this.analytics, this.config, "line");
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
getXAxis(): XAxisOptions | undefined {
|
|
21
|
-
return {
|
|
22
|
-
type: "category",
|
|
23
|
-
categories: getAllCategories(this.analytics, this.config),
|
|
24
|
-
crosshair: true,
|
|
25
|
-
labels: {
|
|
26
|
-
enabled: true,
|
|
27
|
-
},
|
|
28
|
-
title: { text: "" },
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
}
|