@topkit/analytics-charts 1.1.4 → 1.1.5-alpha-fix-alpha-packages.2603

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 (161) hide show
  1. package/{dist-package/AnalyticsChart → AnalyticsChart}/AnalyticsChart.d.ts +0 -0
  2. package/{dist-package/AnalyticsChart → AnalyticsChart}/AnalyticsChart.js +0 -0
  3. package/{dist-package/AnalyticsChart → AnalyticsChart}/AnalyticsChart.js.map +0 -0
  4. package/{dist-package/AnalyticsChart → AnalyticsChart}/index.d.ts +0 -0
  5. package/{dist-package/AnalyticsChart → AnalyticsChart}/index.js +0 -0
  6. package/{dist-package/AnalyticsChart → AnalyticsChart}/index.js.map +0 -0
  7. package/{dist-package/CategoriesChart → CategoriesChart}/CategoriesChart.d.ts +0 -0
  8. package/{dist-package/CategoriesChart → CategoriesChart}/CategoriesChart.js +0 -0
  9. package/{dist-package/CategoriesChart → CategoriesChart}/CategoriesChart.js.map +0 -0
  10. package/{dist-package/CategoriesChart → CategoriesChart}/index.d.ts +0 -0
  11. package/{dist-package/CategoriesChart → CategoriesChart}/index.js +0 -0
  12. package/{dist-package/CategoriesChart → CategoriesChart}/index.js.map +0 -0
  13. package/{dist-package/CategoriesChart → CategoriesChart}/types.d.ts +0 -0
  14. package/{dist-package/CategoriesChart → CategoriesChart}/types.js +0 -0
  15. package/{dist-package/CategoriesChart → CategoriesChart}/types.js.map +0 -0
  16. package/{dist-package/CategoriesChart → CategoriesChart}/utils/format-data/format-data.d.ts +0 -0
  17. package/{dist-package/CategoriesChart → CategoriesChart}/utils/format-data/format-data.js +0 -0
  18. package/{dist-package/CategoriesChart → CategoriesChart}/utils/format-data/format-data.js.map +0 -0
  19. package/{dist-package/CategoriesChart → CategoriesChart}/utils/format-data/index.d.ts +0 -0
  20. package/{dist-package/CategoriesChart → CategoriesChart}/utils/format-data/index.js +0 -0
  21. package/{dist-package/CategoriesChart → CategoriesChart}/utils/format-data/index.js.map +0 -0
  22. package/{dist-package/CategoriesChart → CategoriesChart}/utils/get-color/get-color.d.ts +0 -0
  23. package/{dist-package/CategoriesChart → CategoriesChart}/utils/get-color/get-color.js +0 -0
  24. package/{dist-package/CategoriesChart → CategoriesChart}/utils/get-color/get-color.js.map +0 -0
  25. package/{dist-package/CategoriesChart → CategoriesChart}/utils/get-color/index.d.ts +0 -0
  26. package/{dist-package/CategoriesChart → CategoriesChart}/utils/get-color/index.js +0 -0
  27. package/{dist-package/CategoriesChart → CategoriesChart}/utils/get-color/index.js.map +0 -0
  28. package/{dist-package/CategoriesChart → CategoriesChart}/utils/index.d.ts +0 -0
  29. package/{dist-package/CategoriesChart → CategoriesChart}/utils/index.js +0 -0
  30. package/{dist-package/CategoriesChart → CategoriesChart}/utils/index.js.map +0 -0
  31. package/{dist-package/CategoriesChartTooltip → CategoriesChartTooltip}/CategoriesChartTooltip.d.ts +0 -0
  32. package/{dist-package/CategoriesChartTooltip → CategoriesChartTooltip}/CategoriesChartTooltip.js +0 -0
  33. package/{dist-package/CategoriesChartTooltip → CategoriesChartTooltip}/CategoriesChartTooltip.js.map +0 -0
  34. package/{dist-package/CategoriesChartTooltip → CategoriesChartTooltip}/index.d.ts +0 -0
  35. package/{dist-package/CategoriesChartTooltip → CategoriesChartTooltip}/index.js +0 -0
  36. package/{dist-package/CategoriesChartTooltip → CategoriesChartTooltip}/index.js.map +0 -0
  37. package/{dist-package/CategoriesChartTooltip → CategoriesChartTooltip}/utils/get-display-texts/get-display-texts.d.ts +0 -0
  38. package/{dist-package/CategoriesChartTooltip → CategoriesChartTooltip}/utils/get-display-texts/get-display-texts.js +0 -0
  39. package/{dist-package/CategoriesChartTooltip → CategoriesChartTooltip}/utils/get-display-texts/get-display-texts.js.map +0 -0
  40. package/{dist-package/CategoriesChartTooltip → CategoriesChartTooltip}/utils/get-display-texts/index.d.ts +0 -0
  41. package/{dist-package/CategoriesChartTooltip → CategoriesChartTooltip}/utils/get-display-texts/index.js +0 -0
  42. package/{dist-package/CategoriesChartTooltip → CategoriesChartTooltip}/utils/get-display-texts/index.js.map +0 -0
  43. package/{dist-package/CategoriesChartTooltip → CategoriesChartTooltip}/utils/index.d.ts +0 -0
  44. package/{dist-package/CategoriesChartTooltip → CategoriesChartTooltip}/utils/index.js +0 -0
  45. package/{dist-package/CategoriesChartTooltip → CategoriesChartTooltip}/utils/index.js.map +0 -0
  46. package/{dist-package/config.d.ts → config.d.ts} +0 -0
  47. package/{dist-package/config.js → config.js} +0 -0
  48. package/{dist-package/config.js.map → config.js.map} +0 -0
  49. package/{dist-package/index.d.ts → index.d.ts} +0 -0
  50. package/{dist-package/index.js → index.js} +0 -0
  51. package/{dist-package/index.js.map → index.js.map} +0 -0
  52. package/package.json +6 -4
  53. package/{dist-package/utils → utils}/format-y-axis-tick/format-y-axis-tick.d.ts +0 -0
  54. package/{dist-package/utils → utils}/format-y-axis-tick/format-y-axis-tick.js +0 -0
  55. package/{dist-package/utils → utils}/format-y-axis-tick/format-y-axis-tick.js.map +0 -0
  56. package/{dist-package/utils → utils}/format-y-axis-tick/index.d.ts +0 -0
  57. package/{dist-package/utils → utils}/format-y-axis-tick/index.js +0 -0
  58. package/{dist-package/utils → utils}/format-y-axis-tick/index.js.map +0 -0
  59. package/{dist-package/utils → utils}/generate-reference-key/generate-reference-key.d.ts +0 -0
  60. package/{dist-package/utils → utils}/generate-reference-key/generate-reference-key.js +0 -0
  61. package/{dist-package/utils → utils}/generate-reference-key/generate-reference-key.js.map +0 -0
  62. package/{dist-package/utils → utils}/generate-reference-key/index.d.ts +0 -0
  63. package/{dist-package/utils → utils}/generate-reference-key/index.js +0 -0
  64. package/{dist-package/utils → utils}/generate-reference-key/index.js.map +0 -0
  65. package/{dist-package/utils → utils}/get-x-axis-ticks/get-x-axis-ticks.d.ts +0 -0
  66. package/{dist-package/utils → utils}/get-x-axis-ticks/get-x-axis-ticks.js +0 -0
  67. package/{dist-package/utils → utils}/get-x-axis-ticks/get-x-axis-ticks.js.map +0 -0
  68. package/{dist-package/utils → utils}/get-x-axis-ticks/index.d.ts +0 -0
  69. package/{dist-package/utils → utils}/get-x-axis-ticks/index.js +0 -0
  70. package/{dist-package/utils → utils}/get-x-axis-ticks/index.js.map +0 -0
  71. package/{dist-package/utils → utils}/get-y-axis-ticks/get-y-axis-ticks.d.ts +0 -0
  72. package/{dist-package/utils → utils}/get-y-axis-ticks/get-y-axis-ticks.js +0 -0
  73. package/{dist-package/utils → utils}/get-y-axis-ticks/get-y-axis-ticks.js.map +0 -0
  74. package/{dist-package/utils → utils}/get-y-axis-ticks/index.d.ts +0 -0
  75. package/{dist-package/utils → utils}/get-y-axis-ticks/index.js +0 -0
  76. package/{dist-package/utils → utils}/get-y-axis-ticks/index.js.map +0 -0
  77. package/{dist-package/utils → utils}/index.d.ts +0 -0
  78. package/{dist-package/utils → utils}/index.js +0 -0
  79. package/{dist-package/utils → utils}/index.js.map +0 -0
  80. package/{dist-package/utils → utils}/to-chart-format/index.d.ts +0 -0
  81. package/{dist-package/utils → utils}/to-chart-format/index.js +0 -0
  82. package/{dist-package/utils → utils}/to-chart-format/index.js.map +0 -0
  83. package/{dist-package/utils → utils}/to-chart-format/to-chart-format.d.ts +0 -0
  84. package/{dist-package/utils → utils}/to-chart-format/to-chart-format.js +0 -0
  85. package/{dist-package/utils → utils}/to-chart-format/to-chart-format.js.map +0 -0
  86. package/{dist-package/utils → utils}/to-highlight-format/index.d.ts +0 -0
  87. package/{dist-package/utils → utils}/to-highlight-format/index.js +0 -0
  88. package/{dist-package/utils → utils}/to-highlight-format/index.js.map +0 -0
  89. package/{dist-package/utils → utils}/to-highlight-format/to-highlight-format.d.ts +0 -0
  90. package/{dist-package/utils → utils}/to-highlight-format/to-highlight-format.js +0 -0
  91. package/{dist-package/utils → utils}/to-highlight-format/to-highlight-format.js.map +0 -0
  92. package/{dist-package/utils → utils}/to-line-config-format/index.d.ts +0 -0
  93. package/{dist-package/utils → utils}/to-line-config-format/index.js +0 -0
  94. package/{dist-package/utils → utils}/to-line-config-format/index.js.map +0 -0
  95. package/{dist-package/utils → utils}/to-line-config-format/to-line-config-format.d.ts +0 -0
  96. package/{dist-package/utils → utils}/to-line-config-format/to-line-config-format.js +0 -0
  97. package/{dist-package/utils → utils}/to-line-config-format/to-line-config-format.js.map +0 -0
  98. package/CHANGELOG.md +0 -189
  99. package/dist-package/README.md +0 -5
  100. package/dist-package/package.json +0 -36
  101. package/src/AnalyticsChart/AnalyticsChart.tsx +0 -85
  102. package/src/AnalyticsChart/__image_snapshots__/analyticschart-custom-format-xaxis-label-snap.png +0 -0
  103. package/src/AnalyticsChart/__image_snapshots__/analyticschart-default-snap.png +0 -0
  104. package/src/AnalyticsChart/__image_snapshots__/analyticschart-granularity-snap.png +0 -0
  105. package/src/AnalyticsChart/__image_snapshots__/analyticschart-highlights-snap.png +0 -0
  106. package/src/AnalyticsChart/__image_snapshots__/analyticschart-multiple-snap.png +0 -0
  107. package/src/AnalyticsChart/__image_snapshots__/analyticschart-null-values-snap.png +0 -0
  108. package/src/AnalyticsChart/__image_snapshots__/analyticschart-reference-lines-snap.png +0 -0
  109. package/src/AnalyticsChart/index.ts +0 -2
  110. package/src/AnalyticsChart/story/Default.example.tsx +0 -44
  111. package/src/AnalyticsChart/story/FormatLabel.example.tsx +0 -46
  112. package/src/AnalyticsChart/story/Granularity.example.tsx +0 -104
  113. package/src/AnalyticsChart/story/Highlights.example.tsx +0 -54
  114. package/src/AnalyticsChart/story/Multiple.example.tsx +0 -72
  115. package/src/AnalyticsChart/story/NullValues.example.tsx +0 -103
  116. package/src/AnalyticsChart/story/ReferenceLines.example.tsx +0 -105
  117. package/src/AnalyticsChart/story/index.jsx +0 -74
  118. package/src/CategoriesChart/CategoriesChart.tsx +0 -51
  119. package/src/CategoriesChart/__image_snapshots__/categorieschart-default-snap.png +0 -0
  120. package/src/CategoriesChart/index.ts +0 -2
  121. package/src/CategoriesChart/story/Default.example.tsx +0 -234
  122. package/src/CategoriesChart/story/index.jsx +0 -61
  123. package/src/CategoriesChart/types.ts +0 -22
  124. package/src/CategoriesChart/utils/format-data/format-data.ts +0 -23
  125. package/src/CategoriesChart/utils/format-data/index.ts +0 -1
  126. package/src/CategoriesChart/utils/format-data/test.ts +0 -99
  127. package/src/CategoriesChart/utils/get-color/get-color.ts +0 -37
  128. package/src/CategoriesChart/utils/get-color/index.ts +0 -1
  129. package/src/CategoriesChart/utils/get-color/test.ts +0 -65
  130. package/src/CategoriesChart/utils/index.ts +0 -2
  131. package/src/CategoriesChartTooltip/CategoriesChartTooltip.tsx +0 -57
  132. package/src/CategoriesChartTooltip/index.ts +0 -1
  133. package/src/CategoriesChartTooltip/test.tsx +0 -27
  134. package/src/CategoriesChartTooltip/utils/get-display-texts/get-display-texts.ts +0 -61
  135. package/src/CategoriesChartTooltip/utils/get-display-texts/index.ts +0 -1
  136. package/src/CategoriesChartTooltip/utils/get-display-texts/test.ts +0 -81
  137. package/src/CategoriesChartTooltip/utils/index.ts +0 -1
  138. package/src/config.ts +0 -3
  139. package/src/index.ts +0 -3
  140. package/src/utils/format-y-axis-tick/format-y-axis-tick.ts +0 -23
  141. package/src/utils/format-y-axis-tick/index.ts +0 -1
  142. package/src/utils/format-y-axis-tick/test.ts +0 -13
  143. package/src/utils/generate-reference-key/generate-reference-key.ts +0 -4
  144. package/src/utils/generate-reference-key/index.ts +0 -1
  145. package/src/utils/get-x-axis-ticks/get-x-axis-ticks.ts +0 -24
  146. package/src/utils/get-x-axis-ticks/index.ts +0 -1
  147. package/src/utils/get-x-axis-ticks/test.ts +0 -37
  148. package/src/utils/get-y-axis-ticks/get-y-axis-ticks.ts +0 -25
  149. package/src/utils/get-y-axis-ticks/index.ts +0 -1
  150. package/src/utils/get-y-axis-ticks/test.ts +0 -22
  151. package/src/utils/index.ts +0 -7
  152. package/src/utils/to-chart-format/index.ts +0 -1
  153. package/src/utils/to-chart-format/test.ts +0 -200
  154. package/src/utils/to-chart-format/to-chart-format.ts +0 -60
  155. package/src/utils/to-highlight-format/index.ts +0 -1
  156. package/src/utils/to-highlight-format/test.ts +0 -56
  157. package/src/utils/to-highlight-format/to-highlight-format.ts +0 -26
  158. package/src/utils/to-line-config-format/index.ts +0 -1
  159. package/src/utils/to-line-config-format/test.ts +0 -50
  160. package/src/utils/to-line-config-format/to-line-config-format.ts +0 -19
  161. package/tsconfig.build.json +0 -7
@@ -1,44 +0,0 @@
1
- import React from 'react'
2
- import { palette } from '@toptal/picasso/utils'
3
- import { AnalyticsChart } from '@topkit/analytics-charts'
4
-
5
- const CHART_DATA = [
6
- {
7
- id: 'role',
8
- values: {
9
- '2020-10-20': 1.7,
10
- '2020-10-21': 2,
11
- '2020-10-22': 1.7,
12
- '2020-10-23': 2,
13
- '2020-10-24': 1.5,
14
- '2020-10-25': 1.3,
15
- '2020-10-26': 1.6,
16
- '2020-10-27': 2.7,
17
- '2020-10-28': 3.7,
18
- '2020-10-29': 1.7,
19
- '2020-10-30': 1.5,
20
- '2020-10-31': 1.6,
21
- '2020-11-01': 2,
22
- '2020-11-02': 1.5,
23
- '2020-11-03': 1.3,
24
- '2020-11-04': 1.5,
25
- '2020-11-05': 1.5,
26
- '2020-11-06': 1.8,
27
- '2020-11-07': 1.6,
28
- '2020-11-08': 2,
29
- '2020-11-09': 2,
30
- '2020-11-10': 3.1
31
- }
32
- }
33
- ]
34
-
35
- const Example = () => (
36
- <AnalyticsChart
37
- data={CHART_DATA}
38
- lineConfig={{
39
- role: { color: palette.blue.main }
40
- }}
41
- />
42
- )
43
-
44
- export default Example
@@ -1,46 +0,0 @@
1
- import React from 'react'
2
- import { format, parseISO } from 'date-fns'
3
- import { palette } from '@toptal/picasso/utils'
4
- import { AnalyticsChart } from '@topkit/analytics-charts'
5
-
6
- const CHART_DATA = [
7
- {
8
- id: 'role',
9
- values: {
10
- '2020-10-20': 1.7,
11
- '2020-10-21': 2,
12
- '2020-10-22': 1.7,
13
- '2020-10-23': 2,
14
- '2020-10-24': 1.5,
15
- '2020-10-25': 1.3,
16
- '2020-10-26': 1.6,
17
- '2020-10-27': 2.7,
18
- '2020-10-28': 3.7,
19
- '2020-10-29': 1.7,
20
- '2020-10-30': 1.5,
21
- '2020-10-31': 1.6,
22
- '2020-11-01': 2,
23
- '2020-11-02': 1.5,
24
- '2020-11-03': 1.3,
25
- '2020-11-04': 1.5,
26
- '2020-11-05': 1.5,
27
- '2020-11-06': 1.8,
28
- '2020-11-07': 1.6,
29
- '2020-11-08': 2,
30
- '2020-11-09': 2,
31
- '2020-11-10': 3.1
32
- }
33
- }
34
- ]
35
-
36
- const Example = () => (
37
- <AnalyticsChart
38
- data={CHART_DATA}
39
- lineConfig={{
40
- role: { color: palette.blue.main }
41
- }}
42
- formatXAxisLabel={(label: string) => format(parseISO(label), 'MMM dd')}
43
- />
44
- )
45
-
46
- export default Example
@@ -1,104 +0,0 @@
1
- import React from 'react'
2
- import { format, parseISO, addHours } from 'date-fns'
3
- import { palette } from '@toptal/picasso/utils'
4
- import { AnalyticsChart } from '@topkit/analytics-charts'
5
-
6
- const CHART_DATA_DAY = [
7
- {
8
- id: 'global',
9
- values: {
10
- '2020-11-10': 684.18,
11
- '2020-11-11': 843.88,
12
- '2020-11-12': 950.23,
13
- '2020-11-13': 1049.47,
14
- '2020-11-14': 1220,
15
- '2020-11-15': 1294.53,
16
- '2020-11-16': 1406.08,
17
- '2020-11-17': 1865.98,
18
- '2020-11-18': 2430.15,
19
- '2020-11-19': 2740,
20
- '2020-11-20': 3347.23,
21
- '2020-11-21': 3777.12,
22
- '2020-11-22': 4107.37,
23
- '2020-11-23': 4157.9,
24
- '2020-11-24': 4385.87,
25
- '2020-11-25': 4499.3,
26
- '2020-11-26': 4306.65,
27
- '2020-11-27': 4277.67,
28
- '2020-11-28': 4760,
29
- '2020-11-29': 5229.86,
30
- '2020-11-30': 5436.27,
31
- '2020-12-01': 5399.07,
32
- '2020-12-02': 5375.63,
33
- '2020-12-03': 5443.1,
34
- '2020-12-04': 5015.43,
35
- '2020-12-05': 3494.52,
36
- '2020-12-06': 2700,
37
- '2020-12-07': 2516.31,
38
- '2020-12-08': 1944.33,
39
- '2020-12-09': 802.15
40
- }
41
- }
42
- ]
43
-
44
- const CHART_DATA_HOUR = [
45
- {
46
- id: 'global',
47
- values: {
48
- '2020-11-18 02:59:59': 5.2,
49
- '2020-11-18 03:59:59': 8.63,
50
- '2020-11-18 04:59:59': 6.5,
51
- '2020-11-18 05:59:59': 18.3,
52
- '2020-11-18 06:59:59': 23.87,
53
- '2020-11-18 07:59:59': 35.5,
54
- '2020-11-18 08:59:59': 16.67,
55
- '2020-11-18 09:59:59': 12.83,
56
- '2020-11-18 10:59:59': 18.08,
57
- '2020-11-18 11:59:59': 10.75,
58
- '2020-11-18 12:59:59': 19.89,
59
- '2020-11-18 13:59:59': 5.25,
60
- '2020-11-18 14:59:59': 6.17,
61
- '2020-11-18 15:59:59': 12.3,
62
- '2020-11-18 16:59:59': 8.67,
63
- '2020-11-18 17:59:59': 2.56,
64
- '2020-11-18 18:59:59': 4,
65
- '2020-11-18 19:59:59': 8,
66
- '2020-11-18 20:59:59': 1.78,
67
- '2020-11-18 21:59:59': 5.92,
68
- '2020-11-18 22:59:59': 20.5,
69
- '2020-11-18 23:59:59': null,
70
- '2020-11-19 00:59:59': null,
71
- '2020-11-19 01:59:59': null
72
- }
73
- }
74
- ]
75
-
76
- const Example = () => (
77
- <>
78
- <h3>Granularity: day</h3>
79
- <AnalyticsChart
80
- data={CHART_DATA_DAY}
81
- lineConfig={{
82
- global: { color: palette.blue.main }
83
- }}
84
- granularity='day'
85
- unit='minutes'
86
- formatXAxisLabel={label => format(parseISO(label), 'MMM dd')}
87
- showBottomYAxisLabel
88
- />
89
-
90
- <h3>Granularity: hour</h3>
91
- <AnalyticsChart
92
- data={CHART_DATA_HOUR}
93
- lineConfig={{
94
- global: { color: palette.blue.main }
95
- }}
96
- granularity='hour'
97
- unit='minutes'
98
- formatXAxisLabel={label => format(addHours(parseISO(label), 1), 'ha')}
99
- showBottomYAxisLabel
100
- />
101
- </>
102
- )
103
-
104
- export default Example
@@ -1,54 +0,0 @@
1
- import React from 'react'
2
- import { palette } from '@toptal/picasso/utils'
3
- import { AnalyticsChart } from '@topkit/analytics-charts'
4
-
5
- const CHART_DATA = [
6
- {
7
- id: 'team',
8
- values: {
9
- '2020-10-20': 1.7,
10
- '2020-10-21': 2,
11
- '2020-10-22': 1.7,
12
- '2020-10-23': 2,
13
- '2020-10-24': 1.5,
14
- '2020-10-25': 1.3,
15
- '2020-10-26': 1.6,
16
- '2020-10-27': 2.7,
17
- '2020-10-28': 3.7,
18
- '2020-10-29': 1.7,
19
- '2020-10-30': 1.5,
20
- '2020-10-31': 1.6,
21
- '2020-11-01': 2,
22
- '2020-11-02': 1.5,
23
- '2020-11-03': 1.3,
24
- '2020-11-04': 1.5,
25
- '2020-11-05': 1.5,
26
- '2020-11-06': 1.8,
27
- '2020-11-07': 1.6,
28
- '2020-11-08': 2,
29
- '2020-11-09': 2,
30
- '2020-11-10': 3.1
31
- }
32
- }
33
- ]
34
-
35
- const Example = () => (
36
- <AnalyticsChart
37
- data={CHART_DATA}
38
- highlights={[
39
- {
40
- data: ['2020-10-21'],
41
- color: palette.green.main
42
- },
43
- {
44
- data: ['2020-11-01', '2020-11-02'],
45
- color: palette.red.main
46
- }
47
- ]}
48
- lineConfig={{
49
- team: { color: palette.blue.main }
50
- }}
51
- />
52
- )
53
-
54
- export default Example
@@ -1,72 +0,0 @@
1
- import React from 'react'
2
- import { palette } from '@toptal/picasso/utils'
3
- import { AnalyticsChart } from '@topkit/analytics-charts'
4
-
5
- const CHART_DATA = [
6
- {
7
- id: 'role',
8
- values: {
9
- '2020-10-20': 0.0,
10
- '2020-10-21': 0.0,
11
- '2020-10-22': 0.0,
12
- '2020-10-23': 0.0,
13
- '2020-10-24': 0.0,
14
- '2020-10-25': 0.0,
15
- '2020-10-26': 0.0,
16
- '2020-10-27': 0.0,
17
- '2020-10-28': 0.0,
18
- '2020-10-29': 0.0,
19
- '2020-10-30': 1.0,
20
- '2020-10-31': 1.0,
21
- '2020-11-01': 0.0,
22
- '2020-11-02': 0.0,
23
- '2020-11-03': 0.0,
24
- '2020-11-04': 0.0,
25
- '2020-11-05': 0.0,
26
- '2020-11-06': 0.0,
27
- '2020-11-07': 2.0,
28
- '2020-11-08': 0.0,
29
- '2020-11-09': 0.0,
30
- '2020-11-10': 0.0
31
- }
32
- },
33
- {
34
- id: 'team',
35
- values: {
36
- '2020-10-20': 1.7,
37
- '2020-10-21': 2,
38
- '2020-10-22': 1.7,
39
- '2020-10-23': 2,
40
- '2020-10-24': 1.5,
41
- '2020-10-25': 1.3,
42
- '2020-10-26': 1.6,
43
- '2020-10-27': 2.7,
44
- '2020-10-28': 3.7,
45
- '2020-10-29': 1.7,
46
- '2020-10-30': 1.5,
47
- '2020-10-31': 1.6,
48
- '2020-11-01': 2,
49
- '2020-11-02': 1.5,
50
- '2020-11-03': 1.3,
51
- '2020-11-04': 1.5,
52
- '2020-11-05': 1.5,
53
- '2020-11-06': 1.8,
54
- '2020-11-07': 1.6,
55
- '2020-11-08': 2,
56
- '2020-11-09': 2,
57
- '2020-11-10': 3.1
58
- }
59
- }
60
- ]
61
-
62
- const Example = () => (
63
- <AnalyticsChart
64
- data={CHART_DATA}
65
- lineConfig={{
66
- role: { color: palette.yellow.main },
67
- team: { color: palette.blue.main }
68
- }}
69
- />
70
- )
71
-
72
- export default Example
@@ -1,103 +0,0 @@
1
- import React from 'react'
2
- import { Container } from '@toptal/picasso'
3
- import { palette } from '@toptal/picasso/utils'
4
- import { AnalyticsChart } from '@topkit/analytics-charts'
5
-
6
- const CHART_DATA = [
7
- {
8
- id: 'role',
9
- values: {
10
- '2020-10-20': 0.0,
11
- '2020-10-21': 0.0,
12
- '2020-10-22': 0.0,
13
- '2020-10-23': 0.0,
14
- '2020-10-24': 0.0,
15
- '2020-10-25': 0.0,
16
- '2020-10-26': null,
17
- '2020-10-27': 0.0,
18
- '2020-10-28': 0.0,
19
- '2020-10-29': 0.0,
20
- '2020-10-30': 1.0,
21
- '2020-10-31': 1.0,
22
- '2020-11-01': 0.0,
23
- '2020-11-02': null,
24
- '2020-11-03': 0.0,
25
- '2020-11-04': 0.0,
26
- '2020-11-05': 0.0,
27
- '2020-11-06': 0.0,
28
- '2020-11-07': 2.0,
29
- '2020-11-08': 0.0,
30
- '2020-11-09': 0.0,
31
- '2020-11-10': 0.0
32
- }
33
- },
34
- {
35
- id: 'team',
36
- values: {
37
- '2020-10-20': 1.7,
38
- '2020-10-21': 2,
39
- '2020-10-22': 1.7,
40
- '2020-10-23': 2,
41
- '2020-10-24': 1.5,
42
- '2020-10-25': 1.3,
43
- '2020-10-26': 1.6,
44
- '2020-10-27': 2.7,
45
- '2020-10-28': 3.7,
46
- '2020-10-29': null,
47
- '2020-10-30': 1.5,
48
- '2020-10-31': 1.6,
49
- '2020-11-01': 2,
50
- '2020-11-02': 1.5,
51
- '2020-11-03': 1.3,
52
- '2020-11-04': 1.5,
53
- '2020-11-05': 1.5,
54
- '2020-11-06': 1.8,
55
- '2020-11-07': null,
56
- '2020-11-08': 2,
57
- '2020-11-09': 2,
58
- '2020-11-10': 3.1
59
- }
60
- }
61
- ]
62
-
63
- type Payload = {
64
- name: string
65
- value: number
66
- payload: Record<string, number | boolean>
67
- }
68
-
69
- const CustomTooltip = ({
70
- active,
71
- payload
72
- }: {
73
- active?: boolean
74
- payload?: Payload[]
75
- }) => {
76
- if (!active || !payload) {
77
- return null
78
- }
79
-
80
- return (
81
- <Container style={{ background: '#fff' }}>
82
- {payload.map(({ name, value, payload: data }) => (
83
- <Container key={name}>
84
- <b>{name}</b>: {data[`${name}IsEmpty`] ? 'No data provided.' : value}
85
- </Container>
86
- ))}
87
- </Container>
88
- )
89
- }
90
-
91
- const Example = () => (
92
- <AnalyticsChart
93
- tooltip
94
- customTooltip={<CustomTooltip />}
95
- data={CHART_DATA}
96
- lineConfig={{
97
- role: { color: palette.yellow.main },
98
- team: { color: palette.blue.main }
99
- }}
100
- />
101
- )
102
-
103
- export default Example
@@ -1,105 +0,0 @@
1
- import React from 'react'
2
- import { palette } from '@toptal/picasso/utils'
3
- import { AnalyticsChart } from '@topkit/analytics-charts'
4
-
5
- const CHART_DATA = [
6
- {
7
- id: 'team',
8
- values: {
9
- '2020-10-20': 1.7,
10
- '2020-10-21': 2,
11
- '2020-10-22': 1.7,
12
- '2020-10-23': 2,
13
- '2020-10-24': 1.5,
14
- '2020-10-25': 1.3,
15
- '2020-10-26': 1.6,
16
- '2020-10-27': 2.7,
17
- '2020-10-28': 3.7,
18
- '2020-10-29': 1.7,
19
- '2020-10-30': 1.5,
20
- '2020-10-31': 1.6,
21
- '2020-11-01': 2,
22
- '2020-11-02': 1.5,
23
- '2020-11-03': 1.3,
24
- '2020-11-04': 1.5,
25
- '2020-11-05': 1.5,
26
- '2020-11-06': 1.8,
27
- '2020-11-07': 1.6,
28
- '2020-11-08': 2,
29
- '2020-11-09': 2,
30
- '2020-11-10': 3.1
31
- }
32
- }
33
- ]
34
-
35
- const REFERENCE_LINE_DATA = {
36
- red: {
37
- '2020-10-20': 2,
38
- '2020-10-21': 2,
39
- '2020-10-22': 2,
40
- '2020-10-23': 2,
41
- '2020-10-24': 2,
42
- '2020-10-25': 2,
43
- '2020-10-26': 2,
44
- '2020-10-27': 2,
45
- '2020-10-28': 2,
46
- '2020-10-29': 2,
47
- '2020-10-30': 2,
48
- '2020-10-31': 2,
49
- '2020-11-01': 3,
50
- '2020-11-02': 3,
51
- '2020-11-03': 3,
52
- '2020-11-04': 3,
53
- '2020-11-05': 3,
54
- '2020-11-06': 3,
55
- '2020-11-07': 3,
56
- '2020-11-08': 3,
57
- '2020-11-09': 3,
58
- '2020-11-10': 3
59
- },
60
- green: {
61
- '2020-10-20': 1,
62
- '2020-10-21': 1,
63
- '2020-10-22': 1,
64
- '2020-10-23': 1,
65
- '2020-10-24': 1,
66
- '2020-10-25': 1,
67
- '2020-10-26': 1,
68
- '2020-10-27': 1,
69
- '2020-10-28': 1,
70
- '2020-10-29': 1,
71
- '2020-10-30': 1,
72
- '2020-10-31': 1,
73
- '2020-11-01': 1,
74
- '2020-11-02': 1,
75
- '2020-11-03': 1,
76
- '2020-11-04': 1,
77
- '2020-11-05': 1,
78
- '2020-11-06': 1,
79
- '2020-11-07': 1,
80
- '2020-11-08': 1,
81
- '2020-11-09': 1,
82
- '2020-11-10': 1
83
- }
84
- }
85
-
86
- const Example = () => (
87
- <AnalyticsChart
88
- data={CHART_DATA}
89
- referenceLines={[
90
- {
91
- data: REFERENCE_LINE_DATA.red,
92
- color: palette.red.main
93
- },
94
- {
95
- data: REFERENCE_LINE_DATA.green,
96
- color: palette.green.main
97
- }
98
- ]}
99
- lineConfig={{
100
- team: { color: palette.blue.main }
101
- }}
102
- />
103
- )
104
-
105
- export default Example
@@ -1,74 +0,0 @@
1
- import AnalyticsChart from '../AnalyticsChart'
2
- import { sharedLineChartDocs } from '../../../../picasso-charts/src/LineChart/story'
3
- import PicassoBook from '~/.storybook/components/PicassoBook'
4
-
5
- const page = PicassoBook.section('Picasso Charts').createPage(
6
- 'AnalyticsChart',
7
- 'Use LineChart with analytics data'
8
- )
9
-
10
- page.createTabChapter('Props').addComponentDocs({
11
- component: AnalyticsChart,
12
- name: 'AnalyticsChart',
13
- additionalDocs: Object.assign({}, sharedLineChartDocs, {
14
- data: {
15
- name: 'data',
16
- type: {
17
- name: '[]',
18
- description: '{ id: string, values: { [key: string]: number | null } }'
19
- },
20
- description: 'A record of data points to be rendered as a line chart',
21
- required: true
22
- },
23
- highlights: {
24
- name: 'highlights',
25
- type: {
26
- name: '[]',
27
- description: '{ data: string[], color: string }'
28
- },
29
- description: 'A list of dates and to be highlighted'
30
- },
31
- referenceLines: {
32
- name: 'referenceLines',
33
- type: {
34
- name: '[]',
35
- description: `{ data: { [key: string]: number }, color: string }`
36
- },
37
- description:
38
- 'A record of data points to be rendered as a dashed horizontal line'
39
- },
40
- formatXAxisLabel: {
41
- name: 'formatXAxisLabel',
42
- type: {
43
- name: 'function',
44
- description: `(label: string) => string`
45
- },
46
- description: 'A function to custom format the X axis label'
47
- },
48
- granularity: {
49
- name: 'granularity',
50
- type: "'month' | 'week' | 'day' | 'hour'",
51
- description: 'A value that helps formatting the chart'
52
- }
53
- })
54
- })
55
-
56
- page
57
- .createChapter()
58
- .addExample('AnalyticsChart/story/Default.example.tsx', 'Default')
59
- .addExample('AnalyticsChart/story/Multiple.example.tsx', 'Multiple')
60
- .addExample('AnalyticsChart/story/NullValues.example.tsx', {
61
- title: 'Null values',
62
- description:
63
- 'You can provide `null` values as part of chart dataset. Those values will be indicated by "empty" dots on the chart. Additionally this information will be passed to custom tooltip component in case you will need it there.'
64
- })
65
- .addExample('AnalyticsChart/story/Highlights.example.tsx', 'Highlights')
66
- .addExample(
67
- 'AnalyticsChart/story/ReferenceLines.example.tsx',
68
- 'Reference Lines'
69
- )
70
- .addExample(
71
- 'AnalyticsChart/story/FormatLabel.example.tsx',
72
- 'Custom Format xAxis Label'
73
- )
74
- .addExample('AnalyticsChart/story/Granularity.example.tsx', 'Granularity')
@@ -1,51 +0,0 @@
1
- import React, { useMemo } from 'react'
2
- import { BarChartProps, BarChart } from '@toptal/picasso-charts'
3
-
4
- import { DataItem, LabelMap, TooltipMap } from './types'
5
- import { formatData, getColor } from './utils'
6
- import CategoriesChartTooltip from '../CategoriesChartTooltip'
7
-
8
- export type Props = Pick<BarChartProps<string>, 'width' | 'height'> & {
9
- data: DataItem[]
10
- labels: LabelMap
11
- tooltips: TooltipMap
12
- }
13
-
14
- export const CategoriesChart = ({
15
- data,
16
- labels,
17
- tooltips,
18
- ...restProps
19
- }: Props) => {
20
- const chartData = useMemo(() => formatData(data, labels), [data, labels])
21
-
22
- const getBarLabelColor = ({
23
- index,
24
- dataKey
25
- }: {
26
- index?: number
27
- dataKey: string
28
- }) =>
29
- index !== undefined ? getColor({ dataKey, entry: chartData[index] }) : ''
30
-
31
- return (
32
- <BarChart
33
- labelKey='label'
34
- data={chartData}
35
- tooltip
36
- getBarLabelColor={getBarLabelColor}
37
- customTooltip={
38
- // @ts-expect-error: Recharts passes 2 props under the hood: active and payload. We need to assume they are there without explicitly passing them.
39
- <CategoriesChartTooltip originalData={data} tooltips={tooltips} />
40
- }
41
- getBarColor={getColor}
42
- {...restProps}
43
- />
44
- )
45
- }
46
-
47
- CategoriesChart.defaultProps = {}
48
-
49
- CategoriesChart.displayName = 'CategoriesChart'
50
-
51
- export default CategoriesChart
@@ -1,2 +0,0 @@
1
- export { default } from './CategoriesChart'
2
- export type { DataItem } from './types'