playbook_ui 13.12.0.pre.alpha.play1051highchartstest1567 → 13.12.0.pre.alpha.play1051testhighcharts1574
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/pb_kits/playbook/pb_bar_graph/_bar_graph.tsx +2 -2
- data/app/pb_kits/playbook/pb_circle_chart/_circle_chart.tsx +5 -5
- data/app/pb_kits/playbook/pb_dashboard/pbChartsDarkTheme.ts +207 -459
- data/app/pb_kits/playbook/pb_dashboard/pbChartsLightTheme.ts +209 -207
- data/app/pb_kits/playbook/pb_gauge/_gauge.tsx +8 -8
- data/app/pb_kits/playbook/pb_line_graph/_line_graph.tsx +3 -3
- data/app/pb_kits/playbook/pb_treemap_chart/_treemap_chart.tsx +106 -105
- data/app/pb_kits/playbook/playbook-doc.js +4 -4
- data/app/pb_kits/playbook/playbook-rails-react-bindings.js +4 -4
- data/dist/playbook-rails.js +7 -7
- data/lib/playbook/version.rb +1 -1
- metadata +2 -2
@@ -1,116 +1,117 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
/* eslint-disable */
|
2
|
+
import React, { useState, useEffect } from "react";
|
3
|
+
import classnames from "classnames";
|
3
4
|
|
4
|
-
|
5
|
-
|
5
|
+
import { globalProps } from "../utilities/globalProps";
|
6
|
+
import { buildAriaProps, buildDataProps } from "../utilities/props";
|
6
7
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
8
|
+
import HighchartsReact from "highcharts-react-official";
|
9
|
+
import { highchartsTheme } from "../pb_dashboard/pbChartsLightTheme";
|
10
|
+
import { highchartsDarkTheme } from "../pb_dashboard/pbChartsDarkTheme";
|
11
|
+
import mapColors from "../pb_dashboard/pbChartsColorsHelper";
|
12
|
+
import treemap from 'highcharts/modules/treemap'
|
12
13
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
14
|
+
type TreemapChartProps = {
|
15
|
+
chartData: {
|
16
|
+
name: string,
|
17
|
+
parent?: string | number,
|
18
|
+
value: number,
|
19
|
+
color?: string,
|
20
|
+
id?: string | number,
|
21
|
+
}[],
|
22
|
+
className?: string,
|
23
|
+
colors: string[],
|
24
|
+
dark?: boolean,
|
25
|
+
drillable: boolean,
|
26
|
+
grouped: boolean,
|
27
|
+
height?: string,
|
28
|
+
id: number | string,
|
29
|
+
title?: string,
|
30
|
+
tooltipHtml: string,
|
31
|
+
type?: string,
|
32
|
+
aria?: { [key: string]: string },
|
33
|
+
data?: { [key: string]: string },
|
34
|
+
};
|
34
35
|
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
36
|
+
const TreemapChart = ({
|
37
|
+
aria = {},
|
38
|
+
data = {},
|
39
|
+
chartData,
|
40
|
+
colors,
|
41
|
+
dark = false,
|
42
|
+
drillable = false,
|
43
|
+
grouped = false,
|
44
|
+
height,
|
45
|
+
id,
|
46
|
+
title = "",
|
47
|
+
tooltipHtml = '<span style="font-weight: bold; color:{point.color};">●</span>{point.name}: <b>{point.value}</b>',
|
48
|
+
type = "treemap",
|
49
|
+
...props
|
50
|
+
}: TreemapChartProps) => {
|
51
|
+
const ariaProps = buildAriaProps(aria);
|
52
|
+
const dataProps = buildDataProps(data);
|
52
53
|
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
54
|
+
const staticOptions = {
|
55
|
+
title: {
|
56
|
+
text: title,
|
57
|
+
},
|
58
|
+
chart: {
|
59
|
+
height: height,
|
60
|
+
type: type,
|
61
|
+
},
|
62
|
+
credits: false,
|
63
|
+
series: [
|
64
|
+
{
|
65
|
+
data: chartData,
|
66
|
+
},
|
67
|
+
],
|
68
|
+
plotOptions: {
|
69
|
+
treemap: {
|
70
|
+
tooltip: {
|
71
|
+
pointFormat: tooltipHtml,
|
72
|
+
},
|
73
|
+
allowTraversingTree: drillable,
|
74
|
+
colorByPoint: !grouped,
|
75
|
+
colors:
|
76
|
+
colors !== undefined && colors.length > 0
|
77
|
+
? mapColors(colors)
|
78
|
+
: highchartsTheme(window.Highcharts).colors,
|
79
|
+
},
|
80
|
+
},
|
81
|
+
};
|
81
82
|
|
82
|
-
|
83
|
-
|
83
|
+
const [options, setOptions] = useState({});
|
84
|
+
const [isHighchartsLoaded, setIsHighchartsLoaded] = useState(false);
|
84
85
|
|
85
|
-
|
86
|
-
|
86
|
+
useEffect(() => {
|
87
|
+
setOptions({ ...staticOptions });
|
87
88
|
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
89
|
+
const interval = setInterval(() => {
|
90
|
+
if (window.Highcharts) {
|
91
|
+
clearInterval(interval)
|
92
|
+
dark
|
93
|
+
? window.Highcharts.setOptions(highchartsDarkTheme(window.Highcharts))
|
94
|
+
: window.Highcharts.setOptions(highchartsTheme(window.Highcharts))
|
94
95
|
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
96
|
+
treemap(window.Highcharts)
|
97
|
+
setIsHighchartsLoaded(true)
|
98
|
+
}
|
99
|
+
}, 0)
|
100
|
+
}, [chartData]);
|
100
101
|
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
102
|
+
return (
|
103
|
+
isHighchartsLoaded &&
|
104
|
+
<HighchartsReact
|
105
|
+
containerProps={{
|
106
|
+
className: classnames(globalProps(props), "pb_treemap_chart"),
|
107
|
+
id: id,
|
108
|
+
...ariaProps,
|
109
|
+
...dataProps,
|
110
|
+
}}
|
111
|
+
highcharts={window.Highcharts}
|
112
|
+
options={options}
|
113
|
+
/>
|
114
|
+
);
|
115
|
+
};
|
115
116
|
|
116
|
-
|
117
|
+
export default TreemapChart;
|
@@ -39,7 +39,7 @@ import * as FixedConfirmationToast from 'pb_fixed_confirmation_toast/docs'
|
|
39
39
|
import * as Flex from 'pb_flex/docs'
|
40
40
|
import * as FormGroup from 'pb_form_group/docs'
|
41
41
|
import * as FormPill from 'pb_form_pill/docs'
|
42
|
-
|
42
|
+
import * as Gauge from 'pb_gauge/docs'
|
43
43
|
import * as Hashtag from 'pb_hashtag/docs'
|
44
44
|
import * as Highlight from 'pb_highlight/docs'
|
45
45
|
import * as HomeAddressStreet from 'pb_home_address_street/docs'
|
@@ -97,7 +97,7 @@ import * as TitleCount from 'pb_title_count/docs'
|
|
97
97
|
import * as TitleDetail from 'pb_title_detail/docs'
|
98
98
|
import * as Toggle from 'pb_toggle/docs'
|
99
99
|
import * as Tooltip from 'pb_tooltip/docs'
|
100
|
-
|
100
|
+
import * as TreemapChart from 'pb_treemap_chart/docs'
|
101
101
|
import * as Typeahead from 'pb_typeahead/docs'
|
102
102
|
import * as User from 'pb_user/docs'
|
103
103
|
import * as UserBadge from 'pb_user_badge/docs'
|
@@ -140,7 +140,7 @@ WebpackerReact.registerComponents({
|
|
140
140
|
...Flex,
|
141
141
|
...FormGroup,
|
142
142
|
...FormPill,
|
143
|
-
|
143
|
+
...Gauge,
|
144
144
|
...Hashtag,
|
145
145
|
...Highlight,
|
146
146
|
...HomeAddressStreet,
|
@@ -198,7 +198,7 @@ WebpackerReact.registerComponents({
|
|
198
198
|
...TitleDetail,
|
199
199
|
...Toggle,
|
200
200
|
...Tooltip,
|
201
|
-
|
201
|
+
...TreemapChart,
|
202
202
|
...Typeahead,
|
203
203
|
...User,
|
204
204
|
...UserBadge,
|
@@ -10,13 +10,13 @@ import DialogBody from './pb_dialog/child_kits/_dialog_body'
|
|
10
10
|
import DialogFooter from './pb_dialog/child_kits/_dialog_footer'
|
11
11
|
import DialogHeader from './pb_dialog/child_kits/_dialog_header'
|
12
12
|
import DistributionBar from './pb_distribution_bar/_distribution_bar'
|
13
|
-
|
13
|
+
import Gauge from './pb_gauge/_gauge'
|
14
14
|
import Legend from './pb_legend/_legend'
|
15
15
|
import LineGraph from './pb_line_graph/_line_graph'
|
16
16
|
import MultiLevelSelect from './pb_multi_level_select/_multi_level_select'
|
17
17
|
import Passphrase from './pb_passphrase/_passphrase'
|
18
18
|
import RichTextEditor from './pb_rich_text_editor/_rich_text_editor'
|
19
|
-
|
19
|
+
import TreemapChart from './pb_treemap_chart/_treemap_chart'
|
20
20
|
import Typeahead from './pb_typeahead/_typeahead'
|
21
21
|
import PhoneNumberInput from './pb_phone_number_input/_phone_number_input'
|
22
22
|
|
@@ -33,9 +33,9 @@ WebpackerReact.registerComponents({
|
|
33
33
|
LineGraph,
|
34
34
|
Passphrase,
|
35
35
|
RichTextEditor,
|
36
|
-
|
36
|
+
TreemapChart,
|
37
37
|
Typeahead,
|
38
|
-
|
38
|
+
Gauge,
|
39
39
|
PhoneNumberInput
|
40
40
|
})
|
41
41
|
|