@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.
- package/{dist-package/AnalyticsChart → AnalyticsChart}/AnalyticsChart.d.ts +0 -0
- package/{dist-package/AnalyticsChart → AnalyticsChart}/AnalyticsChart.js +0 -0
- package/{dist-package/AnalyticsChart → AnalyticsChart}/AnalyticsChart.js.map +0 -0
- package/{dist-package/AnalyticsChart → AnalyticsChart}/index.d.ts +0 -0
- package/{dist-package/AnalyticsChart → AnalyticsChart}/index.js +0 -0
- package/{dist-package/AnalyticsChart → AnalyticsChart}/index.js.map +0 -0
- package/{dist-package/CategoriesChart → CategoriesChart}/CategoriesChart.d.ts +0 -0
- package/{dist-package/CategoriesChart → CategoriesChart}/CategoriesChart.js +0 -0
- package/{dist-package/CategoriesChart → CategoriesChart}/CategoriesChart.js.map +0 -0
- package/{dist-package/CategoriesChart → CategoriesChart}/index.d.ts +0 -0
- package/{dist-package/CategoriesChart → CategoriesChart}/index.js +0 -0
- package/{dist-package/CategoriesChart → CategoriesChart}/index.js.map +0 -0
- package/{dist-package/CategoriesChart → CategoriesChart}/types.d.ts +0 -0
- package/{dist-package/CategoriesChart → CategoriesChart}/types.js +0 -0
- package/{dist-package/CategoriesChart → CategoriesChart}/types.js.map +0 -0
- package/{dist-package/CategoriesChart → CategoriesChart}/utils/format-data/format-data.d.ts +0 -0
- package/{dist-package/CategoriesChart → CategoriesChart}/utils/format-data/format-data.js +0 -0
- package/{dist-package/CategoriesChart → CategoriesChart}/utils/format-data/format-data.js.map +0 -0
- package/{dist-package/CategoriesChart → CategoriesChart}/utils/format-data/index.d.ts +0 -0
- package/{dist-package/CategoriesChart → CategoriesChart}/utils/format-data/index.js +0 -0
- package/{dist-package/CategoriesChart → CategoriesChart}/utils/format-data/index.js.map +0 -0
- package/{dist-package/CategoriesChart → CategoriesChart}/utils/get-color/get-color.d.ts +0 -0
- package/{dist-package/CategoriesChart → CategoriesChart}/utils/get-color/get-color.js +0 -0
- package/{dist-package/CategoriesChart → CategoriesChart}/utils/get-color/get-color.js.map +0 -0
- package/{dist-package/CategoriesChart → CategoriesChart}/utils/get-color/index.d.ts +0 -0
- package/{dist-package/CategoriesChart → CategoriesChart}/utils/get-color/index.js +0 -0
- package/{dist-package/CategoriesChart → CategoriesChart}/utils/get-color/index.js.map +0 -0
- package/{dist-package/CategoriesChart → CategoriesChart}/utils/index.d.ts +0 -0
- package/{dist-package/CategoriesChart → CategoriesChart}/utils/index.js +0 -0
- package/{dist-package/CategoriesChart → CategoriesChart}/utils/index.js.map +0 -0
- package/{dist-package/CategoriesChartTooltip → CategoriesChartTooltip}/CategoriesChartTooltip.d.ts +0 -0
- package/{dist-package/CategoriesChartTooltip → CategoriesChartTooltip}/CategoriesChartTooltip.js +0 -0
- package/{dist-package/CategoriesChartTooltip → CategoriesChartTooltip}/CategoriesChartTooltip.js.map +0 -0
- package/{dist-package/CategoriesChartTooltip → CategoriesChartTooltip}/index.d.ts +0 -0
- package/{dist-package/CategoriesChartTooltip → CategoriesChartTooltip}/index.js +0 -0
- package/{dist-package/CategoriesChartTooltip → CategoriesChartTooltip}/index.js.map +0 -0
- package/{dist-package/CategoriesChartTooltip → CategoriesChartTooltip}/utils/get-display-texts/get-display-texts.d.ts +0 -0
- package/{dist-package/CategoriesChartTooltip → CategoriesChartTooltip}/utils/get-display-texts/get-display-texts.js +0 -0
- package/{dist-package/CategoriesChartTooltip → CategoriesChartTooltip}/utils/get-display-texts/get-display-texts.js.map +0 -0
- package/{dist-package/CategoriesChartTooltip → CategoriesChartTooltip}/utils/get-display-texts/index.d.ts +0 -0
- package/{dist-package/CategoriesChartTooltip → CategoriesChartTooltip}/utils/get-display-texts/index.js +0 -0
- package/{dist-package/CategoriesChartTooltip → CategoriesChartTooltip}/utils/get-display-texts/index.js.map +0 -0
- package/{dist-package/CategoriesChartTooltip → CategoriesChartTooltip}/utils/index.d.ts +0 -0
- package/{dist-package/CategoriesChartTooltip → CategoriesChartTooltip}/utils/index.js +0 -0
- package/{dist-package/CategoriesChartTooltip → CategoriesChartTooltip}/utils/index.js.map +0 -0
- package/{dist-package/config.d.ts → config.d.ts} +0 -0
- package/{dist-package/config.js → config.js} +0 -0
- package/{dist-package/config.js.map → config.js.map} +0 -0
- package/{dist-package/index.d.ts → index.d.ts} +0 -0
- package/{dist-package/index.js → index.js} +0 -0
- package/{dist-package/index.js.map → index.js.map} +0 -0
- package/package.json +6 -4
- package/{dist-package/utils → utils}/format-y-axis-tick/format-y-axis-tick.d.ts +0 -0
- package/{dist-package/utils → utils}/format-y-axis-tick/format-y-axis-tick.js +0 -0
- package/{dist-package/utils → utils}/format-y-axis-tick/format-y-axis-tick.js.map +0 -0
- package/{dist-package/utils → utils}/format-y-axis-tick/index.d.ts +0 -0
- package/{dist-package/utils → utils}/format-y-axis-tick/index.js +0 -0
- package/{dist-package/utils → utils}/format-y-axis-tick/index.js.map +0 -0
- package/{dist-package/utils → utils}/generate-reference-key/generate-reference-key.d.ts +0 -0
- package/{dist-package/utils → utils}/generate-reference-key/generate-reference-key.js +0 -0
- package/{dist-package/utils → utils}/generate-reference-key/generate-reference-key.js.map +0 -0
- package/{dist-package/utils → utils}/generate-reference-key/index.d.ts +0 -0
- package/{dist-package/utils → utils}/generate-reference-key/index.js +0 -0
- package/{dist-package/utils → utils}/generate-reference-key/index.js.map +0 -0
- package/{dist-package/utils → utils}/get-x-axis-ticks/get-x-axis-ticks.d.ts +0 -0
- package/{dist-package/utils → utils}/get-x-axis-ticks/get-x-axis-ticks.js +0 -0
- package/{dist-package/utils → utils}/get-x-axis-ticks/get-x-axis-ticks.js.map +0 -0
- package/{dist-package/utils → utils}/get-x-axis-ticks/index.d.ts +0 -0
- package/{dist-package/utils → utils}/get-x-axis-ticks/index.js +0 -0
- package/{dist-package/utils → utils}/get-x-axis-ticks/index.js.map +0 -0
- package/{dist-package/utils → utils}/get-y-axis-ticks/get-y-axis-ticks.d.ts +0 -0
- package/{dist-package/utils → utils}/get-y-axis-ticks/get-y-axis-ticks.js +0 -0
- package/{dist-package/utils → utils}/get-y-axis-ticks/get-y-axis-ticks.js.map +0 -0
- package/{dist-package/utils → utils}/get-y-axis-ticks/index.d.ts +0 -0
- package/{dist-package/utils → utils}/get-y-axis-ticks/index.js +0 -0
- package/{dist-package/utils → utils}/get-y-axis-ticks/index.js.map +0 -0
- package/{dist-package/utils → utils}/index.d.ts +0 -0
- package/{dist-package/utils → utils}/index.js +0 -0
- package/{dist-package/utils → utils}/index.js.map +0 -0
- package/{dist-package/utils → utils}/to-chart-format/index.d.ts +0 -0
- package/{dist-package/utils → utils}/to-chart-format/index.js +0 -0
- package/{dist-package/utils → utils}/to-chart-format/index.js.map +0 -0
- package/{dist-package/utils → utils}/to-chart-format/to-chart-format.d.ts +0 -0
- package/{dist-package/utils → utils}/to-chart-format/to-chart-format.js +0 -0
- package/{dist-package/utils → utils}/to-chart-format/to-chart-format.js.map +0 -0
- package/{dist-package/utils → utils}/to-highlight-format/index.d.ts +0 -0
- package/{dist-package/utils → utils}/to-highlight-format/index.js +0 -0
- package/{dist-package/utils → utils}/to-highlight-format/index.js.map +0 -0
- package/{dist-package/utils → utils}/to-highlight-format/to-highlight-format.d.ts +0 -0
- package/{dist-package/utils → utils}/to-highlight-format/to-highlight-format.js +0 -0
- package/{dist-package/utils → utils}/to-highlight-format/to-highlight-format.js.map +0 -0
- package/{dist-package/utils → utils}/to-line-config-format/index.d.ts +0 -0
- package/{dist-package/utils → utils}/to-line-config-format/index.js +0 -0
- package/{dist-package/utils → utils}/to-line-config-format/index.js.map +0 -0
- package/{dist-package/utils → utils}/to-line-config-format/to-line-config-format.d.ts +0 -0
- package/{dist-package/utils → utils}/to-line-config-format/to-line-config-format.js +0 -0
- package/{dist-package/utils → utils}/to-line-config-format/to-line-config-format.js.map +0 -0
- package/CHANGELOG.md +0 -189
- package/dist-package/README.md +0 -5
- package/dist-package/package.json +0 -36
- package/src/AnalyticsChart/AnalyticsChart.tsx +0 -85
- package/src/AnalyticsChart/__image_snapshots__/analyticschart-custom-format-xaxis-label-snap.png +0 -0
- package/src/AnalyticsChart/__image_snapshots__/analyticschart-default-snap.png +0 -0
- package/src/AnalyticsChart/__image_snapshots__/analyticschart-granularity-snap.png +0 -0
- package/src/AnalyticsChart/__image_snapshots__/analyticschart-highlights-snap.png +0 -0
- package/src/AnalyticsChart/__image_snapshots__/analyticschart-multiple-snap.png +0 -0
- package/src/AnalyticsChart/__image_snapshots__/analyticschart-null-values-snap.png +0 -0
- package/src/AnalyticsChart/__image_snapshots__/analyticschart-reference-lines-snap.png +0 -0
- package/src/AnalyticsChart/index.ts +0 -2
- package/src/AnalyticsChart/story/Default.example.tsx +0 -44
- package/src/AnalyticsChart/story/FormatLabel.example.tsx +0 -46
- package/src/AnalyticsChart/story/Granularity.example.tsx +0 -104
- package/src/AnalyticsChart/story/Highlights.example.tsx +0 -54
- package/src/AnalyticsChart/story/Multiple.example.tsx +0 -72
- package/src/AnalyticsChart/story/NullValues.example.tsx +0 -103
- package/src/AnalyticsChart/story/ReferenceLines.example.tsx +0 -105
- package/src/AnalyticsChart/story/index.jsx +0 -74
- package/src/CategoriesChart/CategoriesChart.tsx +0 -51
- package/src/CategoriesChart/__image_snapshots__/categorieschart-default-snap.png +0 -0
- package/src/CategoriesChart/index.ts +0 -2
- package/src/CategoriesChart/story/Default.example.tsx +0 -234
- package/src/CategoriesChart/story/index.jsx +0 -61
- package/src/CategoriesChart/types.ts +0 -22
- package/src/CategoriesChart/utils/format-data/format-data.ts +0 -23
- package/src/CategoriesChart/utils/format-data/index.ts +0 -1
- package/src/CategoriesChart/utils/format-data/test.ts +0 -99
- package/src/CategoriesChart/utils/get-color/get-color.ts +0 -37
- package/src/CategoriesChart/utils/get-color/index.ts +0 -1
- package/src/CategoriesChart/utils/get-color/test.ts +0 -65
- package/src/CategoriesChart/utils/index.ts +0 -2
- package/src/CategoriesChartTooltip/CategoriesChartTooltip.tsx +0 -57
- package/src/CategoriesChartTooltip/index.ts +0 -1
- package/src/CategoriesChartTooltip/test.tsx +0 -27
- package/src/CategoriesChartTooltip/utils/get-display-texts/get-display-texts.ts +0 -61
- package/src/CategoriesChartTooltip/utils/get-display-texts/index.ts +0 -1
- package/src/CategoriesChartTooltip/utils/get-display-texts/test.ts +0 -81
- package/src/CategoriesChartTooltip/utils/index.ts +0 -1
- package/src/config.ts +0 -3
- package/src/index.ts +0 -3
- package/src/utils/format-y-axis-tick/format-y-axis-tick.ts +0 -23
- package/src/utils/format-y-axis-tick/index.ts +0 -1
- package/src/utils/format-y-axis-tick/test.ts +0 -13
- package/src/utils/generate-reference-key/generate-reference-key.ts +0 -4
- package/src/utils/generate-reference-key/index.ts +0 -1
- package/src/utils/get-x-axis-ticks/get-x-axis-ticks.ts +0 -24
- package/src/utils/get-x-axis-ticks/index.ts +0 -1
- package/src/utils/get-x-axis-ticks/test.ts +0 -37
- package/src/utils/get-y-axis-ticks/get-y-axis-ticks.ts +0 -25
- package/src/utils/get-y-axis-ticks/index.ts +0 -1
- package/src/utils/get-y-axis-ticks/test.ts +0 -22
- package/src/utils/index.ts +0 -7
- package/src/utils/to-chart-format/index.ts +0 -1
- package/src/utils/to-chart-format/test.ts +0 -200
- package/src/utils/to-chart-format/to-chart-format.ts +0 -60
- package/src/utils/to-highlight-format/index.ts +0 -1
- package/src/utils/to-highlight-format/test.ts +0 -56
- package/src/utils/to-highlight-format/to-highlight-format.ts +0 -26
- package/src/utils/to-line-config-format/index.ts +0 -1
- package/src/utils/to-line-config-format/test.ts +0 -50
- package/src/utils/to-line-config-format/to-line-config-format.ts +0 -19
- 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
|
|
Binary file
|