@hisptz/dhis2-analytics 1.0.5 → 1.0.7

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.
Files changed (367) hide show
  1. package/build/cjs/components/ChartAnalytics/ChartAnalytics.stories.js +253 -0
  2. package/build/cjs/components/ChartAnalytics/ChartAnalytics.test.js +51 -0
  3. package/build/cjs/components/ChartAnalytics/components/DownloadMenu/components/Menu.js +48 -0
  4. package/build/cjs/components/ChartAnalytics/components/DownloadMenu/constants/menu.js +34 -0
  5. package/build/cjs/components/ChartAnalytics/components/DownloadMenu/index.js +67 -0
  6. package/build/cjs/components/ChartAnalytics/components/DownloadMenu/interfaces/menu.js +1 -0
  7. package/{src → build/cjs}/components/ChartAnalytics/data/column-data.json +0 -0
  8. package/{src → build/cjs}/components/ChartAnalytics/data/complex-multi-series-data.json +0 -0
  9. package/{src → build/cjs}/components/ChartAnalytics/data/multi-series-data.json +0 -0
  10. package/{src → build/cjs}/components/ChartAnalytics/data/pie-data.json +0 -0
  11. package/{src → build/cjs}/components/ChartAnalytics/data/stacked-chart-data.json +0 -0
  12. package/build/cjs/components/ChartAnalytics/hooks/useChart.js +38 -0
  13. package/build/cjs/components/ChartAnalytics/index.js +69 -0
  14. package/build/cjs/components/ChartAnalytics/models/column.js +53 -0
  15. package/build/cjs/components/ChartAnalytics/models/index.js +102 -0
  16. package/build/cjs/components/ChartAnalytics/models/line.js +35 -0
  17. package/build/cjs/components/ChartAnalytics/models/multi-series.js +111 -0
  18. package/build/cjs/components/ChartAnalytics/models/pie.js +53 -0
  19. package/build/cjs/components/ChartAnalytics/services/export.js +50 -0
  20. package/{src → build/cjs}/components/ChartAnalytics/styles/custom-highchart.css +0 -0
  21. package/build/cjs/components/ChartAnalytics/types/props.js +1 -0
  22. package/build/cjs/components/ChartAnalytics/utils/chart.js +133 -0
  23. package/build/cjs/components/CircularProgressDashboard/CircularProgressIndicator.stories.js +45 -0
  24. package/build/cjs/components/CircularProgressDashboard/CircularProgressIndicator.test.js +13 -0
  25. package/build/cjs/components/CircularProgressDashboard/index.js +49 -0
  26. package/build/cjs/components/CircularProgressDashboard/types/props.js +1 -0
  27. package/build/cjs/components/Map/Map.stories.js +352 -0
  28. package/build/cjs/components/Map/components/EarthEngineLayerConfiguration/EarthEngineLayerConfigModal.stories.js +32 -0
  29. package/build/cjs/components/Map/components/EarthEngineLayerConfiguration/EarthEngineLayerConfiguration.stories.js +40 -0
  30. package/build/cjs/components/Map/components/EarthEngineLayerConfiguration/index.js +458 -0
  31. package/build/cjs/components/Map/components/MapArea/index.js +101 -0
  32. package/build/cjs/components/Map/components/MapArea/interfaces/index.js +1 -0
  33. package/build/cjs/components/Map/components/MapControls/components/CustomControl/index.js +32 -0
  34. package/build/cjs/components/Map/components/MapControls/components/DownloadControl/index.js +25 -0
  35. package/build/cjs/components/Map/components/MapControls/components/FullscreenControl/index.js +13 -0
  36. package/build/cjs/components/Map/components/MapControls/index.js +42 -0
  37. package/build/cjs/components/Map/components/MapLayer/components/BoundaryLayer/hooks/useBoundaryData.js +13 -0
  38. package/build/cjs/components/Map/components/MapLayer/components/BoundaryLayer/index.js +51 -0
  39. package/build/cjs/components/Map/components/MapLayer/components/GoogleEngineLayer/components/EarthEngineLegend.js +106 -0
  40. package/build/cjs/components/Map/components/MapLayer/components/GoogleEngineLayer/constants/index.js +379 -0
  41. package/build/cjs/components/Map/components/MapLayer/components/GoogleEngineLayer/hooks/index.js +36 -0
  42. package/build/cjs/components/Map/components/MapLayer/components/GoogleEngineLayer/index.js +200 -0
  43. package/build/cjs/components/Map/components/MapLayer/components/GoogleEngineLayer/interfaces/index.js +1 -0
  44. package/build/cjs/components/Map/components/MapLayer/components/GoogleEngineLayer/services/api.js +14 -0
  45. package/build/cjs/components/Map/components/MapLayer/components/GoogleEngineLayer/services/engine.js +412 -0
  46. package/build/cjs/components/Map/components/MapLayer/components/GoogleEngineLayer/utils/index.js +124 -0
  47. package/{src → build/cjs}/components/Map/components/MapLayer/components/LegendArea/LegendArea.module.css +0 -0
  48. package/build/cjs/components/Map/components/MapLayer/components/LegendArea/components/LegendCardHeader/index.js +26 -0
  49. package/build/cjs/components/Map/components/MapLayer/components/LegendArea/index.js +181 -0
  50. package/build/cjs/components/Map/components/MapLayer/components/PointLayer/components/PointLegend/index.js +86 -0
  51. package/build/cjs/components/Map/components/MapLayer/components/PointLayer/hooks/index.js +14 -0
  52. package/build/cjs/components/Map/components/MapLayer/components/PointLayer/index.js +46 -0
  53. package/build/cjs/components/Map/components/MapLayer/components/ThematicLayer/components/Bubble/components/BubbleLegend/components/Bubble.js +57 -0
  54. package/build/cjs/components/Map/components/MapLayer/components/ThematicLayer/components/Bubble/components/BubbleLegend/components/Bubbles.js +145 -0
  55. package/build/cjs/components/Map/components/MapLayer/components/ThematicLayer/components/Bubble/components/BubbleLegend/index.js +43 -0
  56. package/build/cjs/components/Map/components/MapLayer/components/ThematicLayer/components/Bubble/index.js +56 -0
  57. package/build/cjs/components/Map/components/MapLayer/components/ThematicLayer/components/Choropleth/components/ChoroplethLegend.js +61 -0
  58. package/build/cjs/components/Map/components/MapLayer/components/ThematicLayer/components/Choropleth/index.js +43 -0
  59. package/build/cjs/components/Map/components/MapLayer/components/ThematicLayer/components/CustomTooltip/index.js +35 -0
  60. package/build/cjs/components/Map/components/MapLayer/components/ThematicLayer/hooks/config.js +15 -0
  61. package/build/cjs/components/Map/components/MapLayer/components/ThematicLayer/index.js +57 -0
  62. package/{src → build/cjs}/components/Map/components/MapLayer/components/ThematicLayer/styles/legends.css +0 -0
  63. package/build/cjs/components/Map/components/MapLayer/index.js +40 -0
  64. package/build/cjs/components/Map/components/MapLayer/interfaces/index.js +8 -0
  65. package/build/cjs/components/Map/components/MapProvider/components/MapLayerProvider/hooks/index.js +389 -0
  66. package/build/cjs/components/Map/components/MapProvider/components/MapLayerProvider/index.js +116 -0
  67. package/build/cjs/components/Map/components/MapProvider/hooks/index.js +19 -0
  68. package/build/cjs/components/Map/components/MapProvider/index.js +121 -0
  69. package/build/cjs/components/Map/components/MapUpdater/index.js +24 -0
  70. package/build/cjs/components/Map/components/ThematicLayerConfiguration/ThematicLayerConfigModal.stories.js +32 -0
  71. package/build/cjs/components/Map/components/ThematicLayerConfiguration/ThematicLayerConfiguration.stories.js +40 -0
  72. package/build/cjs/components/Map/components/ThematicLayerConfiguration/components/ColorScaleSelect/components/ColorScale/index.js +40 -0
  73. package/build/cjs/components/Map/components/ThematicLayerConfiguration/components/ColorScaleSelect/constants/colors.js +428 -0
  74. package/build/cjs/components/Map/components/ThematicLayerConfiguration/components/ColorScaleSelect/index.js +63 -0
  75. package/{src → build/cjs}/components/Map/components/ThematicLayerConfiguration/components/ColorScaleSelect/styles/ColorScale.module.css +0 -0
  76. package/{src → build/cjs}/components/Map/components/ThematicLayerConfiguration/components/ColorScaleSelect/styles/ColorScaleSelect.module.css +0 -0
  77. package/build/cjs/components/Map/components/ThematicLayerConfiguration/components/ColorScaleSelect/utils/colors.js +72 -0
  78. package/build/cjs/components/Map/components/ThematicLayerConfiguration/components/CustomLegend/index.js +71 -0
  79. package/build/cjs/components/Map/components/ThematicLayerConfiguration/components/IndicatorSelectorModal/index.js +47 -0
  80. package/build/cjs/components/Map/components/ThematicLayerConfiguration/components/LegendSetSelector/index.js +79 -0
  81. package/build/cjs/components/Map/components/ThematicLayerConfiguration/index.js +265 -0
  82. package/build/cjs/components/Map/constants/colors.js +428 -0
  83. package/build/cjs/components/Map/constants/legendSet.js +22 -0
  84. package/build/cjs/components/Map/hooks/map.js +52 -0
  85. package/build/cjs/components/Map/index.js +108 -0
  86. package/build/cjs/components/Map/interfaces/index.js +1 -0
  87. package/build/cjs/components/Map/state/index.js +23 -0
  88. package/build/cjs/components/Map/utils/colors.js +78 -0
  89. package/build/cjs/components/Map/utils/helpers.js +25 -0
  90. package/build/cjs/components/Map/utils/map.js +161 -0
  91. package/build/cjs/components/SingleValueContainer/SingleValueContainer.stories.js +127 -0
  92. package/build/cjs/components/SingleValueContainer/SingleValueContainer.test.js +23 -0
  93. package/build/cjs/components/SingleValueContainer/components/SingleValueItem/SingleValueItem.js +54 -0
  94. package/build/cjs/components/SingleValueContainer/components/SingleValueItem/SingleValuePercentage.js +24 -0
  95. package/build/cjs/components/SingleValueContainer/index.js +43 -0
  96. package/{src → build/cjs}/components/SingleValueContainer/styles/SingleValueContainer.module.css +0 -0
  97. package/build/cjs/components/SingleValueContainer/types/props.js +1 -0
  98. package/{src → build/cjs}/data/map.json +0 -0
  99. package/build/cjs/dataProviders/map.js +31 -0
  100. package/build/cjs/index.js +49 -0
  101. package/build/cjs/locales/en/translations.json +128 -0
  102. package/build/cjs/locales/index.js +22 -0
  103. package/build/es/components/ChartAnalytics/ChartAnalytics.stories.js +235 -0
  104. package/build/es/components/ChartAnalytics/ChartAnalytics.test.js +46 -0
  105. package/build/es/components/ChartAnalytics/components/DownloadMenu/components/Menu.js +41 -0
  106. package/build/es/components/ChartAnalytics/components/DownloadMenu/constants/menu.js +26 -0
  107. package/build/es/components/ChartAnalytics/components/DownloadMenu/index.js +58 -0
  108. package/build/es/components/ChartAnalytics/components/DownloadMenu/interfaces/menu.js +1 -0
  109. package/build/es/components/ChartAnalytics/data/column-data.json +210 -0
  110. package/build/es/components/ChartAnalytics/data/complex-multi-series-data.json +124 -0
  111. package/build/es/components/ChartAnalytics/data/multi-series-data.json +536 -0
  112. package/build/es/components/ChartAnalytics/data/pie-data.json +115 -0
  113. package/build/es/components/ChartAnalytics/data/stacked-chart-data.json +415 -0
  114. package/build/es/components/ChartAnalytics/hooks/useChart.js +32 -0
  115. package/build/es/components/ChartAnalytics/index.js +40 -0
  116. package/build/es/components/ChartAnalytics/models/column.js +45 -0
  117. package/build/es/components/ChartAnalytics/models/index.js +95 -0
  118. package/build/es/components/ChartAnalytics/models/line.js +28 -0
  119. package/build/es/components/ChartAnalytics/models/multi-series.js +104 -0
  120. package/build/es/components/ChartAnalytics/models/pie.js +46 -0
  121. package/build/es/components/ChartAnalytics/services/export.js +36 -0
  122. package/build/es/components/ChartAnalytics/styles/custom-highchart.css +48 -0
  123. package/build/es/components/ChartAnalytics/types/props.js +1 -0
  124. package/build/es/components/ChartAnalytics/utils/chart.js +122 -0
  125. package/{src/components/CircularProgressDashboard/CircularProgressIndicator.stories.tsx → build/es/components/CircularProgressDashboard/CircularProgressIndicator.stories.js} +9 -16
  126. package/build/es/components/CircularProgressDashboard/CircularProgressIndicator.test.js +10 -0
  127. package/build/es/components/CircularProgressDashboard/index.js +41 -0
  128. package/build/es/components/CircularProgressDashboard/types/props.js +1 -0
  129. package/build/es/components/Map/Map.stories.js +334 -0
  130. package/build/es/components/Map/components/EarthEngineLayerConfiguration/EarthEngineLayerConfigModal.stories.js +23 -0
  131. package/build/es/components/Map/components/EarthEngineLayerConfiguration/EarthEngineLayerConfiguration.stories.js +31 -0
  132. package/build/es/components/Map/components/EarthEngineLayerConfiguration/index.js +448 -0
  133. package/build/es/components/Map/components/MapArea/index.js +91 -0
  134. package/build/es/components/Map/components/MapArea/interfaces/index.js +1 -0
  135. package/build/es/components/Map/components/MapControls/components/CustomControl/index.js +25 -0
  136. package/build/es/components/Map/components/MapControls/components/DownloadControl/index.js +18 -0
  137. package/build/es/components/Map/components/MapControls/components/FullscreenControl/index.js +6 -0
  138. package/build/es/components/Map/components/MapControls/index.js +35 -0
  139. package/build/es/components/Map/components/MapLayer/components/BoundaryLayer/hooks/useBoundaryData.js +7 -0
  140. package/build/es/components/Map/components/MapLayer/components/BoundaryLayer/index.js +41 -0
  141. package/build/es/components/Map/components/MapLayer/components/GoogleEngineLayer/components/EarthEngineLegend.js +95 -0
  142. package/build/es/components/Map/components/MapLayer/components/GoogleEngineLayer/constants/index.js +369 -0
  143. package/build/es/components/Map/components/MapLayer/components/GoogleEngineLayer/hooks/index.js +29 -0
  144. package/build/es/components/Map/components/MapLayer/components/GoogleEngineLayer/index.js +191 -0
  145. package/build/es/components/Map/components/MapLayer/components/GoogleEngineLayer/interfaces/index.js +1 -0
  146. package/build/es/components/Map/components/MapLayer/components/GoogleEngineLayer/services/api.js +14 -0
  147. package/build/es/components/Map/components/MapLayer/components/GoogleEngineLayer/services/engine.js +403 -0
  148. package/build/es/components/Map/components/MapLayer/components/GoogleEngineLayer/utils/index.js +111 -0
  149. package/build/es/components/Map/components/MapLayer/components/LegendArea/LegendArea.module.css +12 -0
  150. package/build/es/components/Map/components/MapLayer/components/LegendArea/components/LegendCardHeader/index.js +19 -0
  151. package/build/es/components/Map/components/MapLayer/components/LegendArea/index.js +172 -0
  152. package/build/es/components/Map/components/MapLayer/components/PointLayer/components/PointLegend/index.js +76 -0
  153. package/build/es/components/Map/components/MapLayer/components/PointLayer/hooks/index.js +8 -0
  154. package/build/es/components/Map/components/MapLayer/components/PointLayer/index.js +39 -0
  155. package/build/es/components/Map/components/MapLayer/components/ThematicLayer/components/Bubble/components/BubbleLegend/components/Bubble.js +49 -0
  156. 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
  157. package/build/es/components/Map/components/MapLayer/components/ThematicLayer/components/Bubble/components/BubbleLegend/index.js +33 -0
  158. package/build/es/components/Map/components/MapLayer/components/ThematicLayer/components/Bubble/index.js +47 -0
  159. package/build/es/components/Map/components/MapLayer/components/ThematicLayer/components/Choropleth/components/ChoroplethLegend.js +50 -0
  160. package/build/es/components/Map/components/MapLayer/components/ThematicLayer/components/Choropleth/index.js +36 -0
  161. package/build/es/components/Map/components/MapLayer/components/ThematicLayer/components/CustomTooltip/index.js +28 -0
  162. package/build/es/components/Map/components/MapLayer/components/ThematicLayer/hooks/config.js +9 -0
  163. package/build/es/components/Map/components/MapLayer/components/ThematicLayer/index.js +50 -0
  164. package/build/es/components/Map/components/MapLayer/components/ThematicLayer/styles/legends.css +62 -0
  165. package/build/es/components/Map/components/MapLayer/index.js +33 -0
  166. package/build/es/components/Map/components/MapLayer/interfaces/index.js +1 -0
  167. package/build/es/components/Map/components/MapProvider/components/MapLayerProvider/hooks/index.js +381 -0
  168. package/build/es/components/Map/components/MapProvider/components/MapLayerProvider/index.js +107 -0
  169. package/{src/components/Map/components/MapProvider/hooks/index.ts → build/es/components/Map/components/MapProvider/hooks/index.js} +3 -6
  170. package/build/es/components/Map/components/MapProvider/index.js +112 -0
  171. package/build/es/components/Map/components/MapUpdater/index.js +17 -0
  172. package/build/es/components/Map/components/ThematicLayerConfiguration/ThematicLayerConfigModal.stories.js +23 -0
  173. package/build/es/components/Map/components/ThematicLayerConfiguration/ThematicLayerConfiguration.stories.js +31 -0
  174. package/build/es/components/Map/components/ThematicLayerConfiguration/components/ColorScaleSelect/components/ColorScale/index.js +33 -0
  175. package/{src/components/Map/components/ThematicLayerConfiguration/components/ColorScaleSelect/constants/colors.ts → build/es/components/Map/components/ThematicLayerConfiguration/components/ColorScaleSelect/constants/colors.js} +46 -59
  176. package/build/es/components/Map/components/ThematicLayerConfiguration/components/ColorScaleSelect/index.js +53 -0
  177. package/build/es/components/Map/components/ThematicLayerConfiguration/components/ColorScaleSelect/styles/ColorScale.module.css +15 -0
  178. package/build/es/components/Map/components/ThematicLayerConfiguration/components/ColorScaleSelect/styles/ColorScaleSelect.module.css +12 -0
  179. package/build/es/components/Map/components/ThematicLayerConfiguration/components/ColorScaleSelect/utils/colors.js +56 -0
  180. package/build/es/components/Map/components/ThematicLayerConfiguration/components/CustomLegend/index.js +64 -0
  181. package/build/es/components/Map/components/ThematicLayerConfiguration/components/IndicatorSelectorModal/index.js +38 -0
  182. package/build/es/components/Map/components/ThematicLayerConfiguration/components/LegendSetSelector/index.js +70 -0
  183. package/build/es/components/Map/components/ThematicLayerConfiguration/index.js +254 -0
  184. package/{src/components/Map/constants/colors.ts → build/es/components/Map/constants/colors.js} +46 -59
  185. package/build/es/components/Map/constants/legendSet.js +15 -0
  186. package/build/es/components/Map/hooks/map.js +44 -0
  187. package/build/es/components/Map/index.js +51 -0
  188. package/build/es/components/Map/interfaces/index.js +1 -0
  189. package/build/es/components/Map/state/index.js +14 -0
  190. package/build/es/components/Map/utils/colors.js +61 -0
  191. package/build/es/components/Map/utils/helpers.js +14 -0
  192. package/build/es/components/Map/utils/map.js +147 -0
  193. package/build/es/components/SingleValueContainer/SingleValueContainer.stories.js +115 -0
  194. package/build/es/components/SingleValueContainer/SingleValueContainer.test.js +20 -0
  195. package/build/es/components/SingleValueContainer/components/SingleValueItem/SingleValueItem.js +47 -0
  196. package/build/es/components/SingleValueContainer/components/SingleValueItem/SingleValuePercentage.js +17 -0
  197. package/build/es/components/SingleValueContainer/index.js +29 -0
  198. package/build/es/components/SingleValueContainer/styles/SingleValueContainer.module.css +39 -0
  199. package/build/es/components/SingleValueContainer/types/props.js +1 -0
  200. package/build/es/data/map.json +5984 -0
  201. package/build/es/dataProviders/map.js +24 -0
  202. package/build/es/index.js +5 -0
  203. package/build/es/locales/en/translations.json +128 -0
  204. package/build/es/locales/index.js +13 -0
  205. package/build/types/components/ChartAnalytics/components/DownloadMenu/components/Menu.d.ts +8 -0
  206. package/build/types/components/ChartAnalytics/components/DownloadMenu/constants/menu.d.ts +7 -0
  207. package/build/types/components/ChartAnalytics/components/DownloadMenu/index.d.ts +9 -0
  208. package/{src/components/ChartAnalytics/components/DownloadMenu/interfaces/menu.ts → build/types/components/ChartAnalytics/components/DownloadMenu/interfaces/menu.d.ts} +0 -0
  209. package/build/types/components/ChartAnalytics/hooks/useChart.d.ts +11 -0
  210. package/build/types/components/ChartAnalytics/index.d.ts +9 -0
  211. package/build/types/components/ChartAnalytics/models/column.d.ts +12 -0
  212. package/build/types/components/ChartAnalytics/models/index.d.ts +17 -0
  213. package/build/types/components/ChartAnalytics/models/line.d.ts +8 -0
  214. package/build/types/components/ChartAnalytics/models/multi-series.d.ts +9 -0
  215. package/build/types/components/ChartAnalytics/models/pie.d.ts +8 -0
  216. package/build/types/components/ChartAnalytics/services/export.d.ts +8 -0
  217. package/build/types/components/ChartAnalytics/types/props.d.ts +43 -0
  218. package/build/types/components/ChartAnalytics/utils/chart.d.ts +15 -0
  219. package/build/types/components/CircularProgressDashboard/index.d.ts +3 -0
  220. package/build/types/components/CircularProgressDashboard/types/props.d.ts +17 -0
  221. package/build/types/components/Map/components/EarthEngineLayerConfiguration/index.d.ts +17 -0
  222. package/build/types/components/Map/components/MapArea/index.d.ts +5 -0
  223. package/build/types/components/Map/components/MapArea/interfaces/index.d.ts +30 -0
  224. package/build/types/components/Map/components/MapControls/components/CustomControl/index.d.ts +7 -0
  225. package/build/types/components/Map/components/MapControls/components/DownloadControl/index.d.ts +8 -0
  226. package/build/types/components/Map/components/MapControls/components/FullscreenControl/index.d.ts +5 -0
  227. package/build/types/components/Map/components/MapControls/index.d.ts +6 -0
  228. package/build/types/components/Map/components/MapLayer/components/BoundaryLayer/hooks/useBoundaryData.d.ts +1 -0
  229. package/build/types/components/Map/components/MapLayer/components/BoundaryLayer/index.d.ts +15 -0
  230. package/build/types/components/Map/components/MapLayer/components/GoogleEngineLayer/components/EarthEngineLegend.d.ts +17 -0
  231. package/build/types/components/Map/components/MapLayer/components/GoogleEngineLayer/constants/index.d.ts +4 -0
  232. package/build/types/components/Map/components/MapLayer/components/GoogleEngineLayer/hooks/index.d.ts +9 -0
  233. package/build/types/components/Map/components/MapLayer/components/GoogleEngineLayer/index.d.ts +4 -0
  234. package/build/types/components/Map/components/MapLayer/components/GoogleEngineLayer/interfaces/index.d.ts +58 -0
  235. package/build/types/components/Map/components/MapLayer/components/GoogleEngineLayer/services/api.d.ts +1 -0
  236. package/build/types/components/Map/components/MapLayer/components/GoogleEngineLayer/services/engine.d.ts +55 -0
  237. package/build/types/components/Map/components/MapLayer/components/GoogleEngineLayer/utils/index.d.ts +20 -0
  238. package/build/types/components/Map/components/MapLayer/components/LegendArea/components/LegendCardHeader/index.d.ts +6 -0
  239. package/build/types/components/Map/components/MapLayer/components/LegendArea/index.d.ts +9 -0
  240. package/build/types/components/Map/components/MapLayer/components/PointLayer/components/PointLegend/index.d.ts +3 -0
  241. package/build/types/components/Map/components/MapLayer/components/PointLayer/hooks/index.d.ts +2 -0
  242. package/build/types/components/Map/components/MapLayer/components/PointLayer/index.d.ts +2 -0
  243. package/build/types/components/Map/components/MapLayer/components/ThematicLayer/components/Bubble/components/BubbleLegend/components/Bubble.d.ts +13 -0
  244. package/build/types/components/Map/components/MapLayer/components/ThematicLayer/components/Bubble/components/BubbleLegend/components/Bubbles.d.ts +10 -0
  245. package/build/types/components/Map/components/MapLayer/components/ThematicLayer/components/Bubble/components/BubbleLegend/index.d.ts +16 -0
  246. package/build/types/components/Map/components/MapLayer/components/ThematicLayer/components/Bubble/index.d.ts +12 -0
  247. package/build/types/components/Map/components/MapLayer/components/ThematicLayer/components/Choropleth/components/ChoroplethLegend.d.ts +21 -0
  248. package/build/types/components/Map/components/MapLayer/components/ThematicLayer/components/Choropleth/index.d.ts +12 -0
  249. package/build/types/components/Map/components/MapLayer/components/ThematicLayer/components/CustomTooltip/index.d.ts +5 -0
  250. package/build/types/components/Map/components/MapLayer/components/ThematicLayer/hooks/config.d.ts +2 -0
  251. package/build/types/components/Map/components/MapLayer/components/ThematicLayer/index.d.ts +5 -0
  252. package/build/types/components/Map/components/MapLayer/index.d.ts +6 -0
  253. package/build/types/components/Map/components/MapLayer/interfaces/index.d.ts +123 -0
  254. package/build/types/components/Map/components/MapProvider/components/MapLayerProvider/hooks/index.d.ts +9 -0
  255. package/build/types/components/Map/components/MapProvider/components/MapLayerProvider/index.d.ts +6 -0
  256. package/build/types/components/Map/components/MapProvider/hooks/index.d.ts +15 -0
  257. package/build/types/components/Map/components/MapProvider/index.d.ts +3 -0
  258. package/build/types/components/Map/components/MapUpdater/index.d.ts +5 -0
  259. package/build/types/components/Map/components/ThematicLayerConfiguration/components/ColorScaleSelect/components/ColorScale/index.d.ts +8 -0
  260. package/build/types/components/Map/components/ThematicLayerConfiguration/components/ColorScaleSelect/constants/colors.d.ts +419 -0
  261. package/build/types/components/Map/components/ThematicLayerConfiguration/components/ColorScaleSelect/index.d.ts +9 -0
  262. package/build/types/components/Map/components/ThematicLayerConfiguration/components/ColorScaleSelect/utils/colors.d.ts +11 -0
  263. package/build/types/components/Map/components/ThematicLayerConfiguration/components/CustomLegend/index.d.ts +2 -0
  264. package/build/types/components/Map/components/ThematicLayerConfiguration/components/IndicatorSelectorModal/index.d.ts +8 -0
  265. package/build/types/components/Map/components/ThematicLayerConfiguration/components/LegendSetSelector/index.d.ts +9 -0
  266. package/build/types/components/Map/components/ThematicLayerConfiguration/index.d.ts +18 -0
  267. package/build/types/components/Map/constants/colors.d.ts +419 -0
  268. package/build/types/components/Map/constants/legendSet.d.ts +7 -0
  269. package/build/types/components/Map/hooks/map.d.ts +9 -0
  270. package/build/types/components/Map/index.d.ts +8 -0
  271. package/build/types/components/Map/interfaces/index.d.ts +65 -0
  272. package/build/types/components/Map/state/index.d.ts +20 -0
  273. package/build/types/components/Map/utils/colors.d.ts +12 -0
  274. package/build/types/components/Map/utils/helpers.d.ts +6 -0
  275. package/build/types/components/Map/utils/map.d.ts +40 -0
  276. package/build/types/components/SingleValueContainer/components/SingleValueItem/SingleValueItem.d.ts +8 -0
  277. package/build/types/components/SingleValueContainer/components/SingleValueItem/SingleValuePercentage.d.ts +2 -0
  278. package/build/types/components/SingleValueContainer/index.d.ts +5 -0
  279. package/build/types/components/SingleValueContainer/types/props.d.ts +15 -0
  280. package/build/types/dataProviders/map.d.ts +4 -0
  281. package/{src/index.ts → build/types/index.d.ts} +0 -0
  282. package/package.json +26 -5
  283. package/d2.config.js +0 -8
  284. package/i18n/en.pot +0 -409
  285. package/src/components/ChartAnalytics/ChartAnalytics.stories.tsx +0 -250
  286. package/src/components/ChartAnalytics/ChartAnalytics.test.tsx +0 -51
  287. package/src/components/ChartAnalytics/components/DownloadMenu/components/Menu.tsx +0 -48
  288. package/src/components/ChartAnalytics/components/DownloadMenu/constants/menu.ts +0 -38
  289. package/src/components/ChartAnalytics/components/DownloadMenu/index.tsx +0 -67
  290. package/src/components/ChartAnalytics/hooks/useChart.ts +0 -35
  291. package/src/components/ChartAnalytics/index.tsx +0 -23
  292. package/src/components/ChartAnalytics/models/column.ts +0 -50
  293. package/src/components/ChartAnalytics/models/index.ts +0 -78
  294. package/src/components/ChartAnalytics/models/line.ts +0 -31
  295. package/src/components/ChartAnalytics/models/multi-series.ts +0 -115
  296. package/src/components/ChartAnalytics/models/pie.ts +0 -54
  297. package/src/components/ChartAnalytics/services/export.ts +0 -38
  298. package/src/components/ChartAnalytics/types/props.tsx +0 -48
  299. package/src/components/ChartAnalytics/utils/chart.ts +0 -123
  300. package/src/components/CircularProgressDashboard/CircularProgressIndicator.test.tsx +0 -9
  301. package/src/components/CircularProgressDashboard/index.tsx +0 -35
  302. package/src/components/CircularProgressDashboard/types/props.tsx +0 -17
  303. package/src/components/Map/Map.stories.tsx +0 -339
  304. package/src/components/Map/components/EarthEngineLayerConfiguration/EarthEngineLayerConfigModal.stories.tsx +0 -28
  305. package/src/components/Map/components/EarthEngineLayerConfiguration/EarthEngineLayerConfiguration.stories.tsx +0 -34
  306. package/src/components/Map/components/EarthEngineLayerConfiguration/index.tsx +0 -412
  307. package/src/components/Map/components/MapArea/index.tsx +0 -83
  308. package/src/components/Map/components/MapArea/interfaces/index.ts +0 -39
  309. package/src/components/Map/components/MapControls/components/CustomControl/index.tsx +0 -24
  310. package/src/components/Map/components/MapControls/components/DownloadControl/index.tsx +0 -10
  311. package/src/components/Map/components/MapControls/components/FullscreenControl/index.tsx +0 -7
  312. package/src/components/Map/components/MapControls/index.tsx +0 -24
  313. package/src/components/Map/components/MapLayer/components/BoundaryLayer/hooks/useBoundaryData.ts +0 -7
  314. package/src/components/Map/components/MapLayer/components/BoundaryLayer/index.tsx +0 -55
  315. package/src/components/Map/components/MapLayer/components/GoogleEngineLayer/components/EarthEngineLegend.tsx +0 -76
  316. package/src/components/Map/components/MapLayer/components/GoogleEngineLayer/constants/index.ts +0 -430
  317. package/src/components/Map/components/MapLayer/components/GoogleEngineLayer/hooks/index.ts +0 -34
  318. package/src/components/Map/components/MapLayer/components/GoogleEngineLayer/index.tsx +0 -185
  319. package/src/components/Map/components/MapLayer/components/GoogleEngineLayer/interfaces/index.ts +0 -56
  320. package/src/components/Map/components/MapLayer/components/GoogleEngineLayer/services/api.js +0 -34233
  321. package/src/components/Map/components/MapLayer/components/GoogleEngineLayer/services/engine.ts +0 -431
  322. package/src/components/Map/components/MapLayer/components/GoogleEngineLayer/utils/index.ts +0 -105
  323. package/src/components/Map/components/MapLayer/components/LegendArea/components/LegendCardHeader/index.tsx +0 -17
  324. package/src/components/Map/components/MapLayer/components/LegendArea/index.tsx +0 -168
  325. package/src/components/Map/components/MapLayer/components/PointLayer/components/PointLegend/index.tsx +0 -44
  326. package/src/components/Map/components/MapLayer/components/PointLayer/hooks/index.ts +0 -8
  327. package/src/components/Map/components/MapLayer/components/PointLayer/index.tsx +0 -36
  328. package/src/components/Map/components/MapLayer/components/ThematicLayer/components/Bubble/components/BubbleLegend/components/Bubble.tsx +0 -48
  329. package/src/components/Map/components/MapLayer/components/ThematicLayer/components/Bubble/components/BubbleLegend/index.tsx +0 -39
  330. package/src/components/Map/components/MapLayer/components/ThematicLayer/components/Bubble/index.tsx +0 -57
  331. package/src/components/Map/components/MapLayer/components/ThematicLayer/components/Choropleth/components/ChoroplethLegend.tsx +0 -43
  332. package/src/components/Map/components/MapLayer/components/ThematicLayer/components/Choropleth/index.tsx +0 -38
  333. package/src/components/Map/components/MapLayer/components/ThematicLayer/components/CustomTooltip/index.tsx +0 -26
  334. package/src/components/Map/components/MapLayer/components/ThematicLayer/hooks/config.ts +0 -10
  335. package/src/components/Map/components/MapLayer/components/ThematicLayer/index.tsx +0 -46
  336. package/src/components/Map/components/MapLayer/index.tsx +0 -32
  337. package/src/components/Map/components/MapLayer/interfaces/index.ts +0 -139
  338. package/src/components/Map/components/MapProvider/components/MapLayerProvider/hooks/index.tsx +0 -359
  339. package/src/components/Map/components/MapProvider/components/MapLayerProvider/index.tsx +0 -105
  340. package/src/components/Map/components/MapProvider/index.tsx +0 -93
  341. package/src/components/Map/components/MapUpdater/index.tsx +0 -8
  342. package/src/components/Map/components/ThematicLayerConfiguration/ThematicLayerConfigModal.stories.tsx +0 -28
  343. package/src/components/Map/components/ThematicLayerConfiguration/ThematicLayerConfiguration.stories.tsx +0 -34
  344. package/src/components/Map/components/ThematicLayerConfiguration/components/ColorScaleSelect/components/ColorScale/index.tsx +0 -24
  345. package/src/components/Map/components/ThematicLayerConfiguration/components/ColorScaleSelect/index.tsx +0 -50
  346. package/src/components/Map/components/ThematicLayerConfiguration/components/ColorScaleSelect/utils/colors.ts +0 -91
  347. package/src/components/Map/components/ThematicLayerConfiguration/components/CustomLegend/index.tsx +0 -45
  348. package/src/components/Map/components/ThematicLayerConfiguration/components/IndicatorSelectorModal/index.tsx +0 -47
  349. package/src/components/Map/components/ThematicLayerConfiguration/components/LegendSetSelector/index.tsx +0 -57
  350. package/src/components/Map/components/ThematicLayerConfiguration/index.tsx +0 -248
  351. package/src/components/Map/constants/legendSet.ts +0 -19
  352. package/src/components/Map/hooks/map.ts +0 -47
  353. package/src/components/Map/index.tsx +0 -65
  354. package/src/components/Map/interfaces/index.ts +0 -57
  355. package/src/components/Map/state/index.tsx +0 -31
  356. package/src/components/Map/utils/colors.ts +0 -95
  357. package/src/components/Map/utils/helpers.ts +0 -15
  358. package/src/components/Map/utils/map.ts +0 -150
  359. package/src/components/SingleValueContainer/SingleValueContainer.stories.tsx +0 -146
  360. package/src/components/SingleValueContainer/SingleValueContainer.test.tsx +0 -24
  361. package/src/components/SingleValueContainer/components/SingleValueItem/SingleValueItem.tsx +0 -46
  362. package/src/components/SingleValueContainer/components/SingleValueItem/SingleValuePercentage.tsx +0 -12
  363. package/src/components/SingleValueContainer/index.tsx +0 -30
  364. package/src/components/SingleValueContainer/types/props.tsx +0 -16
  365. package/src/dataProviders/map.tsx +0 -24
  366. package/src/index.test.ts +0 -7
  367. package/tsconfig.json +0 -45
@@ -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,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
- }
@@ -1,115 +0,0 @@
1
- import {PlotOptions, SeriesOptionsType, XAxisOptions, YAxisOptions} from "highcharts";
2
- import {compact, head} from "lodash";
3
- import {MultiSeriesConfig} from "../types/props";
4
- import {getAllCategories, getDimensionHeaderIndex} from "../utils/chart";
5
- import {DHIS2Chart} from "./index";
6
-
7
- export class DHIS2MultiSeriesChart extends DHIS2Chart {
8
- getHighchartsType(): string {
9
- return "";
10
- }
11
-
12
- getPlotOptions(): PlotOptions {
13
- return {
14
- column: {},
15
- line: {},
16
- };
17
- }
18
-
19
- getSeries(): SeriesOptionsType[] {
20
- const analytics = this.analytics;
21
- const config = this.config;
22
-
23
- const categoryDimension = head(config.layout.category);
24
- const seriesConfig: MultiSeriesConfig | undefined = this.config.multiSeries;
25
-
26
- const categoryIndex = getDimensionHeaderIndex(analytics.headers ?? [], categoryDimension ?? "");
27
- const seriesIndex = getDimensionHeaderIndex(analytics.headers ?? [], head(config.layout.series) ?? "");
28
- const valueIndex = getDimensionHeaderIndex(analytics.headers ?? [], "value");
29
-
30
- if (!categoryDimension) {
31
- throw new Error("At least one category dimension is required");
32
- }
33
-
34
- if (!seriesConfig) {
35
- throw new Error("MultiSeries config is required for chart type multi-series");
36
- }
37
-
38
- return compact(
39
- seriesConfig?.series?.map(({ id, as, cumulative, yAxis }) => {
40
- const dataItem = analytics.metaData?.items[id as any];
41
- const categoryItems = analytics.metaData?.dimensions[categoryDimension as "dx" | "ou" | "pe"];
42
-
43
- const data = categoryItems?.map((item: string) => {
44
- const row = analytics.rows?.find((row: any) => row[categoryIndex] === item && row[seriesIndex] === id);
45
- return row?.[valueIndex] ? parseFloat(row?.[valueIndex]) : 0;
46
- });
47
-
48
- let cumulativeData: number[] = [];
49
-
50
- if (cumulative) {
51
- cumulativeData =
52
- data?.reduce((acc, curr, index) => {
53
- if (index === 0) {
54
- return [...acc, curr];
55
- }
56
- return [...acc, acc[index - 1] + curr];
57
- }, [] as number[]) ?? [];
58
- }
59
-
60
- return {
61
- name: dataItem?.name,
62
- data: cumulative ? cumulativeData : data,
63
- type: as,
64
- yAxis: yAxis ?? 0,
65
- };
66
- })
67
- ) as SeriesOptionsType[];
68
- }
69
-
70
- getXAxis(): XAxisOptions | undefined {
71
- return {
72
- type: "category",
73
- categories: getAllCategories(this.analytics, this.config),
74
- crosshair: true,
75
- labels: {
76
- enabled: true,
77
- },
78
- title: { text: "" },
79
- };
80
- }
81
-
82
- getYAxis(): YAxisOptions[] {
83
- let yAxes: YAxisOptions[] = [];
84
-
85
- if (this.config.multiSeries?.yAxes) {
86
- yAxes = this.config.multiSeries?.yAxes;
87
- } else {
88
- yAxes = super.getYAxis();
89
- }
90
-
91
- if (!this.config.multiSeries?.target) {
92
- return yAxes;
93
- }
94
-
95
- const { value, styles, label } = this.config.multiSeries?.target ?? {};
96
-
97
- return [
98
- {
99
- ...yAxes[0],
100
- plotLines: [
101
- ...(yAxes[0].plotLines ?? []),
102
- {
103
- color: styles?.color ?? "#00FF00",
104
- dashStyle: styles?.dashStyle ?? "Solid",
105
- value,
106
- width: styles?.width ?? 2,
107
- zIndex: styles?.zIndex ?? 1000,
108
- label: label,
109
- },
110
- ],
111
- },
112
- ...yAxes.slice(1),
113
- ];
114
- }
115
- }
@@ -1,54 +0,0 @@
1
- import {PlotOptions, SeriesOptionsType, XAxisOptions} from "highcharts";
2
- import {head} from "lodash";
3
- import {DHIS2Chart} from "./index";
4
-
5
- export class DHIS2PieChart extends DHIS2Chart {
6
- getHighchartsType(): string {
7
- return "pie";
8
- }
9
-
10
- getPlotOptions(): PlotOptions {
11
- return {
12
- pie: {
13
- allowPointSelect: true,
14
- cursor: "pointer",
15
- dataLabels: {
16
- enabled: true,
17
- format: "<b>{point.name}</b>: {point.percentage:.1f} %",
18
- },
19
- },
20
- };
21
- }
22
-
23
- getSeries(): SeriesOptionsType[] {
24
- const analytics = this.analytics;
25
- const config = this.config;
26
- const seriesDimension = head(config.layout.series);
27
- const seriesIndex = analytics?.headers?.findIndex((h) => h.name === seriesDimension) ?? -1;
28
- const valueIndex = analytics?.headers?.findIndex((h) => h.name === "value") ?? -1;
29
-
30
- if (!seriesDimension) {
31
- throw new Error("Pie chart must have a series dimension");
32
- }
33
- const seriesValues = analytics.metaData?.dimensions?.[seriesDimension as "dx" | "ou" | "pe"];
34
-
35
- return [
36
- {
37
- id: seriesDimension ?? "",
38
- name: analytics.metaData?.items?.[seriesDimension as any]?.name ?? "",
39
- data: seriesValues?.map((value: string) => {
40
- const row = analytics?.rows?.find((row: any) => row[seriesIndex] === value);
41
-
42
- return {
43
- name: analytics.metaData?.items?.[value as any]?.name,
44
- y: row?.[valueIndex] ? parseFloat(row?.[valueIndex] ?? "") : 0,
45
- };
46
- }),
47
- } as SeriesOptionsType,
48
- ];
49
- }
50
-
51
- getXAxis(): XAxisOptions | undefined {
52
- return undefined;
53
- }
54
- }
@@ -1,38 +0,0 @@
1
- import Highcharts from "highcharts";
2
- import HighchartsReact from "highcharts-react-official";
3
- import HighChartsExportCSV from "highcharts/modules/export-data";
4
- import HighChartsExport from "highcharts/modules/exporting";
5
- import HighChartsFullScreen from "highcharts/modules/full-screen";
6
-
7
- export function setupHighchartsModules(highcharts: typeof Highcharts) {
8
- HighChartsExport(highcharts);
9
- HighChartsExportCSV(highcharts);
10
- HighChartsFullScreen(highcharts);
11
- }
12
-
13
- export function onFullScreenView(chartRef: HighchartsReact.RefObject, options?: Highcharts.Options) {
14
- chartRef?.chart?.fullscreen.toggle();
15
- }
16
-
17
- export function onPDFDownload(chartRef: HighchartsReact.RefObject, options?: Highcharts.Options) {
18
- chartRef?.chart.exportChart({ type: "application/pdf" }, options ?? {});
19
- }
20
-
21
- export function onCSVDownload(chartRef: HighchartsReact.RefObject, options?: Highcharts.Options) {
22
- chartRef?.chart.downloadCSV();
23
- }
24
-
25
- export const onImageDownload = (chartRef: HighchartsReact.RefObject, type: "png" | "svg+xml" | "jpeg", options?: Highcharts.Options) => {
26
- chartRef?.chart.exportChart({ type: `image/${type}` }, options ?? {});
27
- };
28
-
29
- export const onViewAsTable = (chartRef: HighchartsReact.RefObject, show: boolean) => {
30
- const options = chartRef?.chart.options;
31
- chartRef?.chart?.update({
32
- ...options,
33
- exporting: {
34
- ...options?.exporting,
35
- showTable: show,
36
- },
37
- });
38
- };
@@ -1,48 +0,0 @@
1
- import type {Analytics} from "@hisptz/dhis2-utils";
2
- import {DashStyleValue, YAxisOptions, YAxisPlotLinesLabelOptions} from "highcharts";
3
-
4
- export type ChartType = "column" | "pie" | "stacked-column" | "line" | "multi-series";
5
-
6
- export interface MultiSeriesConfig {
7
- series?: Array<{
8
- id: string;
9
- as: "column" | "line";
10
- cumulative?: boolean;
11
- yAxis?: number;
12
- }>;
13
- yAxes?: Array<YAxisOptions>;
14
- target?: TargetConfig;
15
- }
16
-
17
- export interface TargetConfig {
18
- id: string;
19
- value: number;
20
- label?: YAxisPlotLinesLabelOptions;
21
- styles: {
22
- color?: string;
23
- width?: number;
24
- dashStyle?: DashStyleValue;
25
- zIndex?: number;
26
- };
27
- }
28
-
29
- export type ChartConfig = {
30
- layout: {
31
- series: Array<string>;
32
- category: Array<string>;
33
- filter: Array<string>;
34
- };
35
- type?: ChartType;
36
- height?: number;
37
- colors?: Array<string>;
38
- name?: string;
39
- allowChartTypeChange?: boolean;
40
- highChartOverrides?: Record<string, any>;
41
- multiSeries?: MultiSeriesConfig;
42
- };
43
-
44
- export type ChartAnalyticsProps = {
45
- analytics: Analytics;
46
- config: ChartConfig;
47
- containerProps?: Record<string, any>;
48
- };