sea-chart 0.0.1 → 0.0.2

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 (330) hide show
  1. package/README.md +117 -1
  2. package/dist/api/index.js +101 -0
  3. package/{lib → dist}/components/collaborator/index.js +8 -6
  4. package/{lib → dist}/components/icon/index.css +1 -1
  5. package/{lib → dist}/components/icon/index.js +7 -5
  6. package/dist/components/index.js +8 -0
  7. package/{lib → dist}/components/loading/index.js +4 -2
  8. package/dist/components/number-input/index.js +31 -0
  9. package/{lib → dist}/components/pixel-editor/index.css +4 -4
  10. package/{lib → dist}/components/pixel-editor/index.js +11 -15
  11. package/{lib → dist}/components/select-group/index.css +10 -10
  12. package/dist/components/select-group/index.js +52 -0
  13. package/dist/components/types-dialog/index.css +97 -0
  14. package/dist/components/types-dialog/index.js +117 -0
  15. package/{lib → dist}/constants/geolocation.js +3 -3
  16. package/dist/constants/index.js +184 -0
  17. package/{lib → dist}/constants/model.js +25 -5
  18. package/dist/constants/style.js +15 -0
  19. package/dist/constants/type-image.js +59 -0
  20. package/dist/constants/type.js +124 -0
  21. package/dist/context.js +83 -0
  22. package/dist/editor/index.js +41 -0
  23. package/dist/index.js +9 -0
  24. package/dist/intl.js +37 -0
  25. package/dist/locale/index.js +18 -0
  26. package/{lib → dist}/locale/lang/de.js +1 -1
  27. package/{lib → dist}/locale/lang/en.js +1 -1
  28. package/{lib → dist}/locale/lang/es.js +1 -1
  29. package/{lib → dist}/locale/lang/fr.js +1 -1
  30. package/{lib → dist}/locale/lang/pt.js +1 -1
  31. package/{lib → dist}/locale/lang/ru.js +1 -1
  32. package/{lib → dist}/locale/lang/zh_CN.js +1 -1
  33. package/dist/model/area-group.js +41 -0
  34. package/dist/model/area.js +32 -0
  35. package/dist/model/bar-group.js +44 -0
  36. package/dist/model/bar-stack.js +41 -0
  37. package/dist/model/bar.js +38 -0
  38. package/dist/model/base-model.js +9 -0
  39. package/dist/model/basic-number-card.js +22 -0
  40. package/dist/model/chart.js +23 -0
  41. package/dist/model/combination.js +38 -0
  42. package/dist/model/compare-bar.js +39 -0
  43. package/dist/model/completeness-group.js +24 -0
  44. package/dist/model/completeness.js +18 -0
  45. package/dist/model/dashboard.js +16 -0
  46. package/dist/model/generic-model.js +224 -0
  47. package/dist/model/heat-map.js +23 -0
  48. package/dist/model/horizontal-bar.js +38 -0
  49. package/dist/model/horizontal-group-bar.js +43 -0
  50. package/dist/model/index.js +63 -0
  51. package/dist/model/line-group.js +44 -0
  52. package/dist/model/line.js +38 -0
  53. package/dist/model/map-bubble.js +27 -0
  54. package/dist/model/map.js +27 -0
  55. package/dist/model/mirror.js +26 -0
  56. package/dist/model/pie.js +26 -0
  57. package/dist/model/ring.js +26 -0
  58. package/dist/model/scatter.js +19 -0
  59. package/dist/model/stacked-horizontal-bar.js +32 -0
  60. package/dist/model/table.js +23 -0
  61. package/dist/model/tree-map.js +20 -0
  62. package/dist/model/trend.js +24 -0
  63. package/dist/model/user.js +15 -0
  64. package/dist/model/world-map-bubble.js +26 -0
  65. package/dist/model/world-map.js +26 -0
  66. package/{lib/components → dist}/settings/advance-bar-settings/data-settings.js +68 -45
  67. package/dist/settings/advance-bar-settings/style-settings.js +161 -0
  68. package/{lib/components → dist}/settings/bar-settings/data-settings.js +76 -51
  69. package/dist/settings/bar-settings/style-settings.js +179 -0
  70. package/dist/settings/basic-number-card/data-settings.js +126 -0
  71. package/dist/settings/basic-number-card/style-settings.js +42 -0
  72. package/dist/settings/combination-settings/data-settings.js +279 -0
  73. package/dist/settings/combination-settings/style-settings.js +174 -0
  74. package/dist/settings/dashboard-settings/data-settings.js +179 -0
  75. package/{lib/components → dist}/settings/data-settings.js +28 -22
  76. package/dist/settings/horizontal-bar-settings/data-settings.js +55 -0
  77. package/dist/settings/horizontal-bar-settings/style-settings.js +46 -0
  78. package/dist/settings/index.css +85 -0
  79. package/dist/settings/index.js +76 -0
  80. package/{lib/components → dist}/settings/pie-settings/data-settings.js +67 -44
  81. package/{lib/components → dist}/settings/pie-settings/style-settings.js +67 -49
  82. package/dist/settings/style-settings.js +118 -0
  83. package/{lib/components → dist}/settings/table-settings/data-settings.js +269 -208
  84. package/{lib/components → dist}/settings/time-comparison-settings/data-settings.js +82 -67
  85. package/dist/settings/time-comparison-settings/style-settings.js +213 -0
  86. package/dist/settings/widgets/basic-summary/index.css +12 -0
  87. package/dist/settings/widgets/basic-summary/index.js +176 -0
  88. package/{lib/components/settings/widgets/statistic-type → dist/settings/widgets/chart-type}/index.css +5 -5
  89. package/dist/settings/widgets/chart-type/index.js +59 -0
  90. package/{lib/components → dist}/settings/widgets/common-data-settings.js +24 -18
  91. package/dist/settings/widgets/data-filter/index.css +17 -0
  92. package/{lib/components → dist}/settings/widgets/data-filter/index.js +51 -37
  93. package/dist/settings/widgets/data-sort.js +44 -0
  94. package/dist/settings/widgets/date-summary-item.js +111 -0
  95. package/dist/settings/widgets/display-values-settings/index.css +13 -0
  96. package/{lib/components → dist}/settings/widgets/display-values-settings/index.js +19 -14
  97. package/{lib/components → dist}/settings/widgets/divider/index.css +1 -1
  98. package/dist/settings/widgets/divider/index.js +12 -0
  99. package/{lib/components → dist}/settings/widgets/font-settings/font-size-settings.js +14 -12
  100. package/{lib/components → dist}/settings/widgets/font-settings/font-weight-settings.js +14 -16
  101. package/dist/settings/widgets/group-by.js +160 -0
  102. package/{lib/components → dist}/settings/widgets/label-color.js +10 -10
  103. package/dist/settings/widgets/min-max-setting.js +52 -0
  104. package/dist/settings/widgets/mininum-slice-percent.js +63 -0
  105. package/dist/settings/widgets/numeric-summary-item.js +90 -0
  106. package/dist/settings/widgets/select-table/index.js +38 -0
  107. package/dist/settings/widgets/stack.js +50 -0
  108. package/dist/settings/widgets/summary-method-setting.js +66 -0
  109. package/dist/settings/widgets/summary-settings.js +411 -0
  110. package/dist/settings/widgets/switch/index.css +37 -0
  111. package/{lib/components → dist}/settings/widgets/switch/index.js +11 -8
  112. package/{lib/components → dist}/settings/widgets/text-horizontal-settings.js +12 -10
  113. package/dist/settings/widgets/time-picker.js +174 -0
  114. package/{lib/components → dist}/settings/widgets/title-settings/index.js +15 -13
  115. package/dist/settings/widgets/title-settings/title-text.js +25 -0
  116. package/dist/settings/widgets/x-axios.js +0 -0
  117. package/dist/settings/widgets/y-axis-group-settings.js +438 -0
  118. package/dist/utils/cell-format-utils.js +42 -0
  119. package/dist/utils/chart-data-sql.js +606 -0
  120. package/dist/utils/chart-utils.js +1803 -0
  121. package/dist/utils/chart.js +6 -0
  122. package/dist/utils/collaborator-manager.js +24 -0
  123. package/dist/utils/collaborator-utils.js +40 -0
  124. package/dist/utils/column-2-sql-column.js +551 -0
  125. package/dist/utils/column-utils.js +208 -0
  126. package/{lib → dist}/utils/custom-g2.js +11 -11
  127. package/{lib → dist}/utils/date-translate.js +11 -11
  128. package/dist/utils/index.js +48 -0
  129. package/dist/utils/key-generator.js +13 -0
  130. package/dist/utils/object-utils.js +45 -0
  131. package/{lib → dist}/utils/options-utils.js +17 -18
  132. package/dist/view/index.css +53 -0
  133. package/dist/view/index.js +169 -0
  134. package/{lib/layout → dist/view}/title/index.css +1 -1
  135. package/dist/view/title/index.js +46 -0
  136. package/dist/view/wrapper/area.js +150 -0
  137. package/dist/view/wrapper/bar-group.js +148 -0
  138. package/dist/view/wrapper/bar.js +138 -0
  139. package/dist/view/wrapper/basic-number-card.js +127 -0
  140. package/dist/view/wrapper/chart-component.js +261 -0
  141. package/dist/view/wrapper/combination.js +399 -0
  142. package/dist/view/wrapper/dashboard.js +164 -0
  143. package/dist/view/wrapper/horizontal-bar-group.js +149 -0
  144. package/dist/view/wrapper/horizontal-bar.js +140 -0
  145. package/dist/view/wrapper/horizontal-component.js +78 -0
  146. package/{lib/components/formatter → dist/view/wrapper}/index.js +90 -71
  147. package/dist/view/wrapper/line-group.js +145 -0
  148. package/dist/view/wrapper/line.js +157 -0
  149. package/dist/view/wrapper/pie.js +185 -0
  150. package/dist/view/wrapper/ring.js +264 -0
  151. package/{lib/components/formatter → dist/view/wrapper}/table/index.css +18 -18
  152. package/dist/view/wrapper/table/index.js +31 -0
  153. package/dist/view/wrapper/table/one-dimension-table-no-numeric-columns.js +144 -0
  154. package/dist/view/wrapper/table/one-dimension-table-with-numeric-columns.js +198 -0
  155. package/dist/view/wrapper/table/pivot-table-display-name.js +248 -0
  156. package/dist/view/wrapper/table/two-dimension-table.js +249 -0
  157. package/dist/view/wrapper/treemap.js +186 -0
  158. package/package.json +91 -100
  159. package/lib/components/formatter/area.js +0 -162
  160. package/lib/components/formatter/bar-group.js +0 -160
  161. package/lib/components/formatter/bar.js +0 -150
  162. package/lib/components/formatter/basic-number-card.js +0 -138
  163. package/lib/components/formatter/chart-component.js +0 -266
  164. package/lib/components/formatter/combination.js +0 -407
  165. package/lib/components/formatter/dashboard.js +0 -182
  166. package/lib/components/formatter/horizontal-bar-group.js +0 -161
  167. package/lib/components/formatter/horizontal-bar.js +0 -152
  168. package/lib/components/formatter/horizontal-component.js +0 -91
  169. package/lib/components/formatter/line-group.js +0 -157
  170. package/lib/components/formatter/line.js +0 -170
  171. package/lib/components/formatter/pie.js +0 -201
  172. package/lib/components/formatter/ring.js +0 -277
  173. package/lib/components/formatter/table/index.js +0 -42
  174. package/lib/components/formatter/table/one-dimension-table-no-numeric-columns.js +0 -145
  175. package/lib/components/formatter/table/one-dimension-table-with-numeric-columns.js +0 -193
  176. package/lib/components/formatter/table/pivot-table-display-name.js +0 -249
  177. package/lib/components/formatter/table/two-dimension-table.js +0 -241
  178. package/lib/components/formatter/treemap.js +0 -213
  179. package/lib/components/index.js +0 -5
  180. package/lib/components/number-input/index.js +0 -31
  181. package/lib/components/select-group/index.js +0 -63
  182. package/lib/components/settings/advance-bar-settings/style-settings.js +0 -149
  183. package/lib/components/settings/bar-settings/style-settings.js +0 -163
  184. package/lib/components/settings/basic-number-card/data-settings.js +0 -121
  185. package/lib/components/settings/basic-number-card/style-settings.js +0 -42
  186. package/lib/components/settings/combination-settings/data-settings.js +0 -256
  187. package/lib/components/settings/combination-settings/style-settings.js +0 -183
  188. package/lib/components/settings/dashboard-settings/data-settings.js +0 -167
  189. package/lib/components/settings/horizontal-bar-settings/data-settings.js +0 -45
  190. package/lib/components/settings/horizontal-bar-settings/style-settings.js +0 -38
  191. package/lib/components/settings/index.css +0 -73
  192. package/lib/components/settings/index.js +0 -74
  193. package/lib/components/settings/style-settings.js +0 -100
  194. package/lib/components/settings/time-comparison-settings/style-settings.js +0 -191
  195. package/lib/components/settings/widgets/basic-summary/index.css +0 -12
  196. package/lib/components/settings/widgets/basic-summary/index.js +0 -173
  197. package/lib/components/settings/widgets/data-filter/index.css +0 -17
  198. package/lib/components/settings/widgets/data-sort.js +0 -38
  199. package/lib/components/settings/widgets/date-summary-item.js +0 -126
  200. package/lib/components/settings/widgets/display-values-settings/index.css +0 -13
  201. package/lib/components/settings/widgets/divider/index.js +0 -10
  202. package/lib/components/settings/widgets/group-by.js +0 -168
  203. package/lib/components/settings/widgets/min-max-setting.js +0 -64
  204. package/lib/components/settings/widgets/mininum-slice-percent.js +0 -72
  205. package/lib/components/settings/widgets/numeric-summary-item.js +0 -109
  206. package/lib/components/settings/widgets/select-table/index.js +0 -49
  207. package/lib/components/settings/widgets/stack.js +0 -58
  208. package/lib/components/settings/widgets/statistic-type/index.js +0 -54
  209. package/lib/components/settings/widgets/summary-method-setting.js +0 -80
  210. package/lib/components/settings/widgets/summary-settings.js +0 -394
  211. package/lib/components/settings/widgets/switch/index.css +0 -37
  212. package/lib/components/settings/widgets/time-picker.js +0 -182
  213. package/lib/components/settings/widgets/title-settings/title-text.js +0 -31
  214. package/lib/components/settings/widgets/y-axis-group-settings.js +0 -399
  215. package/lib/components/types-dialog/index.css +0 -97
  216. package/lib/components/types-dialog/index.js +0 -127
  217. package/lib/constants/index.js +0 -164
  218. package/lib/constants/style.js +0 -13
  219. package/lib/constants/type-image.js +0 -32
  220. package/lib/constants/type.js +0 -97
  221. package/lib/context.js +0 -49
  222. package/lib/index.js +0 -6
  223. package/lib/intl.js +0 -37
  224. package/lib/layout/index.js +0 -4
  225. package/lib/layout/statistic/index.css +0 -53
  226. package/lib/layout/statistic/index.js +0 -190
  227. package/lib/layout/title/index.js +0 -41
  228. package/lib/locale/index.js +0 -11
  229. package/lib/model/area-group.js +0 -51
  230. package/lib/model/area.js +0 -42
  231. package/lib/model/bar-group.js +0 -54
  232. package/lib/model/bar-stack.js +0 -51
  233. package/lib/model/bar.js +0 -48
  234. package/lib/model/base-model.js +0 -11
  235. package/lib/model/basic-number-card.js +0 -32
  236. package/lib/model/combination.js +0 -48
  237. package/lib/model/compare-bar.js +0 -49
  238. package/lib/model/completeness-group.js +0 -34
  239. package/lib/model/completeness.js +0 -28
  240. package/lib/model/dashboard.js +0 -26
  241. package/lib/model/generic-model.js +0 -235
  242. package/lib/model/heat-map.js +0 -33
  243. package/lib/model/horizontal-bar.js +0 -48
  244. package/lib/model/horizontal-group-bar.js +0 -53
  245. package/lib/model/index.js +0 -36
  246. package/lib/model/line-group.js +0 -54
  247. package/lib/model/line.js +0 -48
  248. package/lib/model/map-bubble.js +0 -37
  249. package/lib/model/map.js +0 -37
  250. package/lib/model/mirror.js +0 -36
  251. package/lib/model/pie.js +0 -36
  252. package/lib/model/ring.js +0 -36
  253. package/lib/model/scatter.js +0 -29
  254. package/lib/model/stacked-horizontal-bar.js +0 -42
  255. package/lib/model/statistic.js +0 -22
  256. package/lib/model/table.js +0 -33
  257. package/lib/model/tree-map.js +0 -30
  258. package/lib/model/trend.js +0 -34
  259. package/lib/model/user.js +0 -22
  260. package/lib/model/world-map-bubble.js +0 -36
  261. package/lib/model/world-map.js +0 -36
  262. package/lib/utils/cell-format-utils.js +0 -41
  263. package/lib/utils/chart.js +0 -6
  264. package/lib/utils/collaborator-utils.js +0 -40
  265. package/lib/utils/column-utils.js +0 -247
  266. package/lib/utils/data-filter/filter-item-utils.js +0 -80
  267. package/lib/utils/data-filter/filters-utils.js +0 -406
  268. package/lib/utils/data-filter/index.js +0 -3
  269. package/lib/utils/index.js +0 -50
  270. package/lib/utils/key-generator.js +0 -13
  271. package/lib/utils/object-utils.js +0 -61
  272. package/lib/utils/statistic-column-2-sql-column-utils.js +0 -499
  273. package/lib/utils/statistic-utils.js +0 -1685
  274. /package/{lib → dist}/assets/icons/area-chart.svg +0 -0
  275. /package/{lib → dist}/assets/icons/bar-chart.svg +0 -0
  276. /package/{lib → dist}/assets/icons/card.svg +0 -0
  277. /package/{lib → dist}/assets/icons/combination-chart.svg +0 -0
  278. /package/{lib → dist}/assets/icons/dtable-logo.svg +0 -0
  279. /package/{lib → dist}/assets/icons/facet-chart.svg +0 -0
  280. /package/{lib → dist}/assets/icons/gauge.svg +0 -0
  281. /package/{lib → dist}/assets/icons/heat-map.svg +0 -0
  282. /package/{lib → dist}/assets/icons/histogram.svg +0 -0
  283. /package/{lib → dist}/assets/icons/line-chart.svg +0 -0
  284. /package/{lib → dist}/assets/icons/map.svg +0 -0
  285. /package/{lib → dist}/assets/icons/pie-chart.svg +0 -0
  286. /package/{lib → dist}/assets/icons/rectangular-tree-diagram.svg +0 -0
  287. /package/{lib → dist}/assets/icons/scatter-chart.svg +0 -0
  288. /package/{lib → dist}/assets/icons/type-change.svg +0 -0
  289. /package/{lib → dist}/assets/img/area-chart.png +0 -0
  290. /package/{lib → dist}/assets/img/area-group-chart.png +0 -0
  291. /package/{lib → dist}/assets/img/bar-group.png +0 -0
  292. /package/{lib → dist}/assets/img/bar-stack.png +0 -0
  293. /package/{lib → dist}/assets/img/bar.png +0 -0
  294. /package/{lib → dist}/assets/img/combination-chart.png +0 -0
  295. /package/{lib → dist}/assets/img/compared-chart.png +0 -0
  296. /package/{lib → dist}/assets/img/completeness-chart.png +0 -0
  297. /package/{lib → dist}/assets/img/custom-bar.png +0 -0
  298. /package/{lib → dist}/assets/img/dashboard-chart.png +0 -0
  299. /package/{lib → dist}/assets/img/group-completeness-chart.png +0 -0
  300. /package/{lib → dist}/assets/img/group_line.png +0 -0
  301. /package/{lib → dist}/assets/img/heat-map.png +0 -0
  302. /package/{lib → dist}/assets/img/horizontal-bar.png +0 -0
  303. /package/{lib → dist}/assets/img/horizontal-group-bar.png +0 -0
  304. /package/{lib → dist}/assets/img/line.png +0 -0
  305. /package/{lib → dist}/assets/img/map-bubble.png +0 -0
  306. /package/{lib → dist}/assets/img/map.png +0 -0
  307. /package/{lib → dist}/assets/img/mirror.png +0 -0
  308. /package/{lib → dist}/assets/img/number-card.png +0 -0
  309. /package/{lib → dist}/assets/img/pie.png +0 -0
  310. /package/{lib → dist}/assets/img/pivot-table.png +0 -0
  311. /package/{lib → dist}/assets/img/ring.png +0 -0
  312. /package/{lib → dist}/assets/img/scatter.png +0 -0
  313. /package/{lib → dist}/assets/img/stacked-horizontal-bar.png +0 -0
  314. /package/{lib → dist}/assets/img/treemap.png +0 -0
  315. /package/{lib → dist}/assets/img/trend-chart.png +0 -0
  316. /package/{lib → dist}/assets/img/world-map-bubble.png +0 -0
  317. /package/{lib → dist}/assets/img/world-map.png +0 -0
  318. /package/{lib → dist}/components/loading/index.css +0 -0
  319. /package/{lib/components/settings/widgets/select-table → dist/editor}/index.css +0 -0
  320. /package/{lib/components → dist}/settings/advance-bar-settings/index.js +0 -0
  321. /package/{lib/components → dist}/settings/bar-settings/index.js +0 -0
  322. /package/{lib/components → dist}/settings/basic-number-card/index.js +0 -0
  323. /package/{lib/components → dist}/settings/combination-settings/index.js +0 -0
  324. /package/{lib/components → dist}/settings/dashboard-settings/index.js +0 -0
  325. /package/{lib/components → dist}/settings/horizontal-bar-settings/index.js +0 -0
  326. /package/{lib/components → dist}/settings/pie-settings/index.js +0 -0
  327. /package/{lib/components → dist}/settings/table-settings/index.js +0 -0
  328. /package/{lib/components → dist}/settings/time-comparison-settings/index.js +0 -0
  329. /package/{lib/components → dist}/settings/widgets/font-settings/index.js +0 -0
  330. /package/{lib/components/settings/widgets/x-axios.js → dist/settings/widgets/select-table/index.css} +0 -0
@@ -1,6 +1,6 @@
1
1
  import React, { useCallback } from 'react';
2
- import { STATISTIC_TYPE, STATISTIC_THEME_COLOR } from '../../constants';
3
- import { StatisticsUtils, eventStopPropagation } from '../../utils';
2
+ import { CHART_TYPE, CHART_THEME_COLOR } from '../../constants';
3
+ import { ChartUtils, eventStopPropagation } from '../../utils';
4
4
  import Table from './table';
5
5
  import Bar from './bar';
6
6
  import BarGroup from './bar-group';
@@ -15,158 +15,177 @@ import BasicNumericCard from './basic-number-card';
15
15
  import Treemap from './treemap';
16
16
  import Combination from './combination';
17
17
  import Dashboard from './dashboard';
18
- var Formatter = function Formatter(_ref) {
19
- var data = _ref.data,
20
- statistic = _ref.statistic,
21
- tables = _ref.tables,
22
- canvasStyle = _ref.canvasStyle;
18
+ const Wrapper = _ref => {
19
+ let {
20
+ data,
21
+ chart,
22
+ tables,
23
+ canvasStyle
24
+ } = _ref;
23
25
  // const [statisticRecords, setStatisticRecords] = useState({});
24
26
  // const [isStatisticRecordsDialogShow, setIsStatisticRecordsDialogShow] = useState(false);
25
27
  // const [selectedCell, setSelectedCell] = useState({});
26
28
 
27
- var toggleStatisticRecordsDialog = useCallback(function (statisticRecords, selectedCell) {
29
+ const toggleStatisticRecordsDialog = useCallback((statisticRecords, selectedCell) => {
28
30
  // setIsStatisticRecordsDialogShow(!isStatisticRecordsDialogShow)
29
31
  // setSelectedCell(selectedCell);
30
32
  // setStatisticRecords(statisticRecords);
31
33
  }, []);
32
- var onTableClick = useCallback(function (event) {
34
+ const onTableClick = useCallback(event => {
33
35
  eventStopPropagation(event);
34
36
  }, []);
35
- var result = data.result,
36
- groupbyColumn = data.groupbyColumn,
37
- columnGroupbyColumn = data.columnGroupbyColumn,
38
- summaryColumn = data.summaryColumn,
39
- statisticTableColumns = data.statisticTableColumns;
40
- var _statistic$config = statistic.config,
41
- type = _statistic$config.type,
42
- summary_columns = _statistic$config.summary_columns,
43
- summary_method = _statistic$config.summary_method;
44
- var baseProps = {
45
- statistic: statistic,
46
- result: result,
47
- tables: tables,
48
- groupbyColumn: groupbyColumn,
49
- columnGroupbyColumn: columnGroupbyColumn,
50
- summaryColumn: summaryColumn,
51
- theme: STATISTIC_THEME_COLOR['light'],
37
+ const {
38
+ result,
39
+ groupbyColumn,
40
+ columnGroupbyColumn,
41
+ summaryColumn,
42
+ chartTableColumns
43
+ } = data;
44
+ const {
45
+ type,
46
+ summary_columns,
47
+ summary_method
48
+ } = chart.config;
49
+ const baseProps = {
50
+ chart,
51
+ result,
52
+ tables,
53
+ groupbyColumn,
54
+ columnGroupbyColumn,
55
+ summaryColumn,
56
+ theme: CHART_THEME_COLOR['light'],
52
57
  toggleRecords: toggleStatisticRecordsDialog
53
58
  };
54
59
  switch (type) {
55
- case STATISTIC_TYPE.TABLE:
60
+ case CHART_TYPE.TABLE:
56
61
  {
57
62
  return /*#__PURE__*/React.createElement("div", {
58
- className: "statistic-table-wrapper",
63
+ className: "chart-table-wrapper",
59
64
  onClick: onTableClick
60
65
  }, result && /*#__PURE__*/React.createElement(Table, Object.assign({}, baseProps, {
61
66
  summaryColumns: summary_columns,
62
67
  summaryMethod: summary_method,
63
- statisticTableColumns: statisticTableColumns
68
+ chartTableColumns: chartTableColumns
64
69
  })));
65
70
  }
66
- case STATISTIC_TYPE.COMBINATION:
71
+ case CHART_TYPE.COMBINATION:
67
72
  {
68
73
  return /*#__PURE__*/React.createElement(Combination, Object.assign({}, baseProps, {
69
74
  canvasStyle: canvasStyle
70
75
  }));
71
76
  }
72
- case STATISTIC_TYPE.BAR:
77
+ case CHART_TYPE.BAR:
73
78
  {
74
79
  return /*#__PURE__*/React.createElement(Bar, Object.assign({}, baseProps, {
75
80
  canvasStyle: canvasStyle
76
81
  }));
77
82
  }
78
- case STATISTIC_TYPE.BAR_GROUP:
83
+ case CHART_TYPE.BAR_GROUP:
79
84
  {
80
- var config = statistic.config;
81
- var column_groupby_column_key = config.column_groupby_column_key,
82
- column_groupby_multiple_numeric_column = config.column_groupby_multiple_numeric_column;
83
- var BarGroupComponent = column_groupby_column_key || column_groupby_multiple_numeric_column ? BarGroup : Bar;
85
+ const {
86
+ config
87
+ } = chart;
88
+ const {
89
+ column_groupby_column_key,
90
+ column_groupby_multiple_numeric_column
91
+ } = config;
92
+ const BarGroupComponent = column_groupby_column_key || column_groupby_multiple_numeric_column ? BarGroup : Bar;
84
93
  return /*#__PURE__*/React.createElement(BarGroupComponent, Object.assign({}, baseProps, {
85
94
  canvasStyle: canvasStyle
86
95
  }));
87
96
  }
88
- case STATISTIC_TYPE.HORIZONTAL_BAR:
97
+ case CHART_TYPE.HORIZONTAL_BAR:
89
98
  {
90
- var _config = statistic.config,
91
- id = statistic.id,
92
- style_config = statistic.style_config;
93
- var newConfig = StatisticsUtils.convertStatisticConfig(_config);
94
- var newStatistic = {
95
- id: id,
99
+ const {
100
+ config,
101
+ id,
102
+ style_config
103
+ } = chart;
104
+ const newConfig = ChartUtils.convertConfig(config);
105
+ const newChart = {
106
+ id,
96
107
  config: newConfig,
97
- style_config: style_config
108
+ style_config
98
109
  };
99
110
  return /*#__PURE__*/React.createElement(HorizontalBar, Object.assign({}, baseProps, {
100
111
  canvasStyle: canvasStyle,
101
- statistic: newStatistic
112
+ chart: newChart
102
113
  }));
103
114
  }
104
- case STATISTIC_TYPE.HORIZONTAL_GROUP_BAR:
115
+ case CHART_TYPE.HORIZONTAL_GROUP_BAR:
105
116
  {
106
- var _config2 = statistic.config,
107
- _id = statistic.id,
108
- _style_config = statistic.style_config;
109
- var _newConfig = StatisticsUtils.convertStatisticConfig(_config2);
110
- var _newStatistic = {
111
- id: _id,
112
- config: _newConfig,
113
- style_config: _style_config
117
+ const {
118
+ config,
119
+ id,
120
+ style_config
121
+ } = chart;
122
+ const newConfig = ChartUtils.convertConfig(config);
123
+ const newChart = {
124
+ id,
125
+ config: newConfig,
126
+ style_config
114
127
  };
115
- var _column_groupby_column_key = _config2.column_groupby_column_key,
116
- _column_groupby_multiple_numeric_column = _config2.column_groupby_multiple_numeric_column;
117
- var HorizontalComponent = _column_groupby_column_key || _column_groupby_multiple_numeric_column ? HorizontalBarGroup : HorizontalBar;
128
+ const {
129
+ column_groupby_column_key,
130
+ column_groupby_multiple_numeric_column
131
+ } = config;
132
+ const HorizontalComponent = column_groupby_column_key || column_groupby_multiple_numeric_column ? HorizontalBarGroup : HorizontalBar;
118
133
  return /*#__PURE__*/React.createElement(HorizontalComponent, Object.assign({}, baseProps, {
119
134
  canvasStyle: canvasStyle,
120
- statistic: _newStatistic
135
+ chart: newChart
121
136
  }));
122
137
  }
123
- case STATISTIC_TYPE.LINE_GROUP:
138
+ case CHART_TYPE.LINE_GROUP:
124
139
  {
125
- var _config3 = statistic.config;
126
- var _column_groupby_column_key2 = _config3.column_groupby_column_key,
127
- _column_groupby_multiple_numeric_column2 = _config3.column_groupby_multiple_numeric_column;
128
- var LineGroupComponent = _column_groupby_column_key2 || _column_groupby_multiple_numeric_column2 ? LineGroup : Line;
140
+ const {
141
+ config
142
+ } = chart;
143
+ const {
144
+ column_groupby_column_key,
145
+ column_groupby_multiple_numeric_column
146
+ } = config;
147
+ const LineGroupComponent = column_groupby_column_key || column_groupby_multiple_numeric_column ? LineGroup : Line;
129
148
  return /*#__PURE__*/React.createElement(LineGroupComponent, Object.assign({}, baseProps, {
130
149
  canvasStyle: canvasStyle
131
150
  }));
132
151
  }
133
- case STATISTIC_TYPE.LINE:
152
+ case CHART_TYPE.LINE:
134
153
  {
135
154
  return /*#__PURE__*/React.createElement(Line, Object.assign({}, baseProps, {
136
155
  canvasStyle: canvasStyle
137
156
  }));
138
157
  }
139
- case STATISTIC_TYPE.BASIC_NUMBER_CARD:
158
+ case CHART_TYPE.BASIC_NUMBER_CARD:
140
159
  {
141
160
  return /*#__PURE__*/React.createElement(BasicNumericCard, Object.assign({}, baseProps, {
142
161
  canvasStyle: canvasStyle
143
162
  }));
144
163
  }
145
- case STATISTIC_TYPE.AREA:
164
+ case CHART_TYPE.AREA:
146
165
  {
147
166
  return /*#__PURE__*/React.createElement(Area, Object.assign({}, baseProps, {
148
167
  canvasStyle: canvasStyle
149
168
  }));
150
169
  }
151
- case STATISTIC_TYPE.PIE:
170
+ case CHART_TYPE.PIE:
152
171
  {
153
172
  return /*#__PURE__*/React.createElement(Pie, Object.assign({}, baseProps, {
154
173
  canvasStyle: canvasStyle
155
174
  }));
156
175
  }
157
- case STATISTIC_TYPE.RING:
176
+ case CHART_TYPE.RING:
158
177
  {
159
178
  return /*#__PURE__*/React.createElement(Ring, Object.assign({}, baseProps, {
160
179
  canvasStyle: canvasStyle
161
180
  }));
162
181
  }
163
- case STATISTIC_TYPE.TREE_MAP:
182
+ case CHART_TYPE.TREE_MAP:
164
183
  {
165
184
  return /*#__PURE__*/React.createElement(Treemap, Object.assign({}, baseProps, {
166
185
  canvasStyle: canvasStyle
167
186
  }));
168
187
  }
169
- case STATISTIC_TYPE.DASHBOARD:
188
+ case CHART_TYPE.DASHBOARD:
170
189
  {
171
190
  return /*#__PURE__*/React.createElement(Dashboard, Object.assign({}, baseProps, {
172
191
  canvasStyle: canvasStyle
@@ -178,4 +197,4 @@ var Formatter = function Formatter(_ref) {
178
197
  }
179
198
  }
180
199
  };
181
- export default Formatter;
200
+ export default Wrapper;
@@ -0,0 +1,145 @@
1
+ import React from 'react';
2
+ import PropTypes from 'prop-types';
3
+ import classnames from 'classnames';
4
+ import { EMPTY_NAME } from '../../constants';
5
+ import { ChartUtils } from '../../utils';
6
+ import intl from '../../intl';
7
+ import ChartComponent from './chart-component';
8
+ class LineGroup extends ChartComponent {
9
+ constructor(props) {
10
+ super(props);
11
+ this.createChart = () => {
12
+ const {
13
+ chart
14
+ } = this.props;
15
+ const {
16
+ y_axis_show_value
17
+ } = chart.config;
18
+ const appendPadding = [y_axis_show_value ? 17 : 0, 0, 0, 0];
19
+ this.initChart(this.container, {
20
+ appendPadding
21
+ });
22
+ this.chart.on('chart:click', e => {
23
+ this.props.toggleRecords(e.data.data);
24
+ });
25
+ };
26
+ this.clearChart = () => {
27
+ this.chart.annotation().clear(true);
28
+ this.chart.clear(true);
29
+ };
30
+ this.drawChart = () => {
31
+ let {
32
+ result: data
33
+ } = this.props;
34
+ data = ChartUtils.formatEmptyName(data, '', intl.get('Empty'));
35
+ if (!Array.isArray(data)) return;
36
+ this.chart.scale(this.groupName, {
37
+ type: 'cat'
38
+ });
39
+ this.loadData(data);
40
+ this.draw(data);
41
+ this.chart.render();
42
+ };
43
+ this.draw = data => {
44
+ const {
45
+ chart,
46
+ summaryColumn,
47
+ theme
48
+ } = this.props;
49
+ const {
50
+ y_axis_summary_method,
51
+ y_axis_show_value,
52
+ label_font_size
53
+ } = chart.config;
54
+ const chartBarColor = this.groupName;
55
+ const newData = this.getChartGroupData(data);
56
+ this.drawLabels(newData);
57
+
58
+ // set Coord type
59
+ this.chart.coordinate('rect');
60
+ this.autoAdjustDataOptions(chart, data, summaryColumn);
61
+ this.chart.scale({
62
+ group_name: {
63
+ type: 'cat'
64
+ }
65
+ });
66
+ this.chart.line().position('name*value').color(chartBarColor);
67
+ this.chart.point().label(y_axis_show_value ? 'value' : false, {
68
+ style: {
69
+ fontSize: ChartUtils.getLabelFontSize(label_font_size),
70
+ fill: theme.textColor
71
+ }
72
+ }).position('name*value').size(3).color(chartBarColor).tooltip('name*value*group_name', (name, value, group_name) => {
73
+ return {
74
+ title: !name && typeof name !== 'number' ? intl.get(EMPTY_NAME) : name,
75
+ value: ChartUtils.getSummaryValueDisplayString(summaryColumn, value, y_axis_summary_method),
76
+ name: !group_name && typeof group_name !== 'number' ? intl.get(EMPTY_NAME) : group_name
77
+ };
78
+ }).shape('circle').style({
79
+ lineWidth: 1,
80
+ stroke: '#fff'
81
+ });
82
+ this.chart.tooltip({
83
+ showCrosshairs: true,
84
+ showTitle: true,
85
+ containerTpl: '<div class="g2-tooltip"><div class="g2-tooltip-list"></div></div>',
86
+ itemTpl: '<div class="g2-tooltip-content"><div class="tooltip-name">{title}<div><div class="tooltip-item">{name}: {value}<div></div>',
87
+ domStyles: {
88
+ 'g2-tooltip': {
89
+ borderRadius: '2px',
90
+ backgroundColor: '#fff',
91
+ padding: '10px'
92
+ },
93
+ 'tooltip-item': {
94
+ marginTop: '5px'
95
+ }
96
+ }
97
+ });
98
+ this.setNameLabelAndTooltip(theme, this.labelCount);
99
+ this.setValueLabel(theme);
100
+ this.setLegend(this.groupName, theme, 'bottom');
101
+ };
102
+ this.chart = null;
103
+ this.groupName = 'group_name';
104
+ }
105
+ componentDidMount() {
106
+ this.createChart();
107
+ this.drawChart();
108
+ this.renderAxisLabel(this.props.chart, this.props.tables);
109
+ }
110
+ componentDidUpdate(prevProps) {
111
+ if (ChartUtils.shouldChartComponentUpdate(prevProps, this.props)) {
112
+ this.chart && this.chart.destroy();
113
+ this.createChart();
114
+ this.drawChart();
115
+ this.renderAxisLabel(prevProps.chart, prevProps.tables);
116
+ }
117
+ }
118
+ componentWillUnmount() {
119
+ this.chart && this.chart.destroy();
120
+ }
121
+ render() {
122
+ const {
123
+ chart
124
+ } = this.props;
125
+ return /*#__PURE__*/React.createElement("div", {
126
+ className: classnames('sea-chart-container w-100', {
127
+ 'show-x-axis-label': this.isShowXAxisLabel(chart),
128
+ 'show-y-axis-label': this.isShowYAxisLabel(chart)
129
+ }),
130
+ ref: ref => this.container = ref
131
+ });
132
+ }
133
+ }
134
+ LineGroup.propTypes = {
135
+ canvasStyle: PropTypes.object,
136
+ chart: PropTypes.object,
137
+ groupbyColumn: PropTypes.object,
138
+ columnGroupbyColumn: PropTypes.object,
139
+ summaryColumn: PropTypes.object,
140
+ result: PropTypes.array,
141
+ tables: PropTypes.array,
142
+ theme: PropTypes.object,
143
+ toggleRecords: PropTypes.func
144
+ };
145
+ export default LineGroup;
@@ -0,0 +1,157 @@
1
+ import React from 'react';
2
+ import PropTypes from 'prop-types';
3
+ import classnames from 'classnames';
4
+ import { CHART_SUMMARY_TYPE, CHART_SUMMARY_SHOW } from '../../constants';
5
+ import { ChartUtils } from '../../utils';
6
+ import ChartComponent from './chart-component';
7
+ import intl from '../../intl';
8
+ class Line extends ChartComponent {
9
+ constructor(props) {
10
+ super(props);
11
+ this.createChart = () => {
12
+ const {
13
+ chart
14
+ } = this.props;
15
+ const {
16
+ y_axis_show_value
17
+ } = chart.config;
18
+ const appendPadding = [y_axis_show_value ? 17 : 0, 0, 0, 0];
19
+ this.initChart(this.container, {
20
+ appendPadding
21
+ });
22
+ this.chart.on('point:click', e => {
23
+ this.props.toggleRecords(e.data.data);
24
+ });
25
+ };
26
+ this.clearChart = () => {
27
+ this.chart.annotation().clear(true);
28
+ this.chart.clear(true);
29
+ };
30
+ this.drawChart = () => {
31
+ let {
32
+ result: data,
33
+ chart,
34
+ summaryColumn
35
+ } = this.props;
36
+ data = ChartUtils.formatEmptyName(data, '', intl.get('Empty'));
37
+ if (!Array.isArray(data)) return;
38
+ this.loadData(data);
39
+ this.draw(data);
40
+ this.autoAdjustDataOptions(chart, data, summaryColumn);
41
+ this.chart.render();
42
+ };
43
+ this.draw = data => {
44
+ const {
45
+ summaryColumn,
46
+ chart,
47
+ theme
48
+ } = this.props;
49
+ const {
50
+ y_axis_summary_type,
51
+ y_axis_summary_method,
52
+ y_axis_label_color,
53
+ y_axis_show_value,
54
+ label_font_size
55
+ } = chart.config;
56
+ const chartBarColor = y_axis_label_color || '#2a67d1';
57
+ this.drawLabels(data);
58
+
59
+ // set Coord type
60
+ this.chart.coordinate('rect');
61
+ this.chart.line().label(y_axis_show_value ? 'value' : false, {
62
+ style: {
63
+ fontSize: ChartUtils.getLabelFontSize(label_font_size),
64
+ fill: theme.textColor
65
+ }
66
+ }).position('name*value').color(chartBarColor).tooltip('name*value', (name, value) => {
67
+ return {
68
+ name: y_axis_summary_type === CHART_SUMMARY_TYPE.COUNT ? intl.get('Amount') : intl.get(CHART_SUMMARY_SHOW[y_axis_summary_method]),
69
+ value: ChartUtils.getSummaryValueDisplayString(summaryColumn, value, y_axis_summary_method)
70
+ };
71
+ });
72
+ this.chart.point().position('name*value').color(chartBarColor).shape('circle').size(3).style({
73
+ lineWidth: 1,
74
+ stroke: '#fff'
75
+ }).tooltip('name*value', (name, value) => {
76
+ return {
77
+ name: name,
78
+ value: ChartUtils.getSummaryValueDisplayString(summaryColumn, value, y_axis_summary_method),
79
+ title: y_axis_summary_type === CHART_SUMMARY_TYPE.COUNT ? intl.get('Amount') : intl.get(CHART_SUMMARY_SHOW[y_axis_summary_method])
80
+ };
81
+ });
82
+ this.chart.tooltip({
83
+ showCrosshairs: true,
84
+ showTitle: true,
85
+ containerTpl: '<div class="g2-tooltip"><div class="g2-tooltip-list"></div></div>',
86
+ itemTpl: '<div class="g2-tooltip-content"><div class="tooltip-name">{title}<div><div class="tooltip-item">{name}: {value}<div></div>',
87
+ domStyles: {
88
+ 'g2-tooltip': {
89
+ borderRadius: '2px',
90
+ backgroundColor: '#fff',
91
+ padding: '10px'
92
+ },
93
+ 'tooltip-item': {
94
+ marginTop: '5px'
95
+ }
96
+ }
97
+ });
98
+ this.setNameLabelAndTooltip(theme, this.labelCount);
99
+ this.setValueLabel(theme);
100
+ this.chart.theme({
101
+ geometries: {
102
+ point: {
103
+ circle: {
104
+ active: {
105
+ style: {
106
+ stroke: 'rgba(0, 0, 0, 0)',
107
+ r: 4
108
+ }
109
+ }
110
+ }
111
+ }
112
+ }
113
+ });
114
+ };
115
+ this.chart = null;
116
+ }
117
+ componentDidMount() {
118
+ this.createChart();
119
+ this.drawChart();
120
+ this.renderAxisLabel(this.props.chart, this.props.tables);
121
+ }
122
+ componentDidUpdate(prevProps) {
123
+ if (ChartUtils.shouldChartComponentUpdate(prevProps, this.props)) {
124
+ this.chart && this.chart.destroy();
125
+ this.createChart();
126
+ this.drawChart();
127
+ this.renderAxisLabel(prevProps.chart, prevProps.tables);
128
+ }
129
+ }
130
+ componentWillUnmount() {
131
+ this.chart && this.chart.destroy();
132
+ }
133
+ render() {
134
+ const {
135
+ chart
136
+ } = this.props;
137
+ return /*#__PURE__*/React.createElement("div", {
138
+ className: classnames('sea-chart-container w-100', {
139
+ 'show-x-axis-label': this.isShowXAxisLabel(chart),
140
+ 'show-y-axis-label': this.isShowYAxisLabel(chart)
141
+ }),
142
+ ref: ref => this.container = ref
143
+ });
144
+ }
145
+ }
146
+ Line.propTypes = {
147
+ canvasStyle: PropTypes.object,
148
+ chart: PropTypes.object,
149
+ groupbyColumn: PropTypes.object,
150
+ columnGroupbyColumn: PropTypes.object,
151
+ summaryColumn: PropTypes.object,
152
+ result: PropTypes.array,
153
+ tables: PropTypes.array,
154
+ theme: PropTypes.object,
155
+ toggleRecords: PropTypes.func
156
+ };
157
+ export default Line;