playbook_ui 14.21.2.pre.alpha.PLAY2233removetreemapchart8408 → 14.21.2.pre.alpha.PLAY2256stickydataidreact8446
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.
- checksums.yaml +4 -4
- data/app/pb_kits/playbook/_playbook.scss +1 -0
- data/app/pb_kits/playbook/pb_contact/contact.test.js +2 -2
- data/app/pb_kits/playbook/pb_dashboard/pbChartsDarkTheme.ts +39 -1
- data/app/pb_kits/playbook/pb_dashboard/pbChartsLightTheme.ts +39 -1
- data/app/pb_kits/playbook/pb_filter/filter.test.js +2 -2
- data/app/pb_kits/playbook/pb_table/_table.tsx +4 -4
- data/app/pb_kits/playbook/pb_table/docs/_table_sticky_columns.jsx +8 -8
- data/app/pb_kits/playbook/pb_table/docs/_table_sticky_columns_react.md +1 -1
- data/app/pb_kits/playbook/pb_table/docs/_table_sticky_left_columns.jsx +12 -12
- data/app/pb_kits/playbook/pb_table/docs/_table_sticky_left_columns_react.md +3 -3
- data/app/pb_kits/playbook/pb_table/docs/_table_sticky_right_columns.jsx +12 -12
- data/app/pb_kits/playbook/pb_table/docs/_table_sticky_right_columns_react.md +3 -3
- data/app/pb_kits/playbook/pb_tooltip/_tooltip.tsx +34 -22
- data/app/pb_kits/playbook/pb_tooltip/docs/_tooltip_click_open.jsx +25 -0
- data/app/pb_kits/playbook/pb_tooltip/docs/_tooltip_click_open.md +1 -0
- data/app/pb_kits/playbook/pb_tooltip/docs/example.yml +1 -0
- data/app/pb_kits/playbook/pb_tooltip/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_treemap_chart/_treemap_chart.scss +14 -0
- data/app/pb_kits/playbook/pb_treemap_chart/_treemap_chart.tsx +119 -0
- data/app/pb_kits/playbook/pb_treemap_chart/docs/_description.md +5 -0
- data/app/pb_kits/playbook/pb_treemap_chart/docs/_treemap_chart_colors.html.erb +37 -0
- data/app/pb_kits/playbook/pb_treemap_chart/docs/_treemap_chart_colors.jsx +48 -0
- data/app/pb_kits/playbook/pb_treemap_chart/docs/_treemap_chart_colors.md +2 -0
- data/app/pb_kits/playbook/pb_treemap_chart/docs/_treemap_chart_default.html.erb +37 -0
- data/app/pb_kits/playbook/pb_treemap_chart/docs/_treemap_chart_default.jsx +47 -0
- data/app/pb_kits/playbook/pb_treemap_chart/docs/_treemap_chart_default.md +3 -0
- data/app/pb_kits/playbook/pb_treemap_chart/docs/_treemap_chart_drillable.html.erb +79 -0
- data/app/pb_kits/playbook/pb_treemap_chart/docs/_treemap_chart_drillable.jsx +90 -0
- data/app/pb_kits/playbook/pb_treemap_chart/docs/_treemap_chart_drillable.md +1 -0
- data/app/pb_kits/playbook/pb_treemap_chart/docs/_treemap_chart_grouped_data.html.erb +54 -0
- data/app/pb_kits/playbook/pb_treemap_chart/docs/_treemap_chart_grouped_data.jsx +65 -0
- data/app/pb_kits/playbook/pb_treemap_chart/docs/_treemap_chart_grouped_data.md +3 -0
- data/app/pb_kits/playbook/pb_treemap_chart/docs/_treemap_chart_tooltip.html.erb +37 -0
- data/app/pb_kits/playbook/pb_treemap_chart/docs/_treemap_chart_tooltip.jsx +48 -0
- data/app/pb_kits/playbook/pb_treemap_chart/docs/_treemap_chart_tooltip.md +3 -0
- data/app/pb_kits/playbook/pb_treemap_chart/docs/example.yml +15 -0
- data/app/pb_kits/playbook/pb_treemap_chart/docs/index.js +5 -0
- data/app/pb_kits/playbook/pb_treemap_chart/treemapChart.test.js +63 -0
- data/app/pb_kits/playbook/pb_treemap_chart/treemap_chart.html.erb +1 -0
- data/app/pb_kits/playbook/pb_treemap_chart/treemap_chart.rb +48 -0
- data/dist/chunks/_typeahead-BaWcHxpx.js +22 -0
- data/dist/chunks/{_weekday_stacked-SYZ-Kt4V.js → _weekday_stacked-DI-oMuSE.js} +1 -1
- data/dist/chunks/{lib-Carqm8Ip.js → lib-CTkMyvfQ.js} +1 -1
- data/dist/chunks/{pb_form_validation-DqRmTS8m.js → pb_form_validation-BVF3TmcL.js} +1 -1
- data/dist/chunks/vendor.js +1 -1
- data/dist/menu.yml +9 -0
- data/dist/playbook-doc.js +2 -2
- data/dist/playbook-rails-react-bindings.js +1 -1
- data/dist/playbook-rails.js +1 -1
- data/dist/playbook.css +1 -1
- data/lib/playbook/version.rb +1 -1
- metadata +31 -6
- data/dist/chunks/_typeahead-DOgzItP7.js +0 -22
@@ -0,0 +1,37 @@
|
|
1
|
+
<% data = [
|
2
|
+
{
|
3
|
+
name: "Pepperoni",
|
4
|
+
parent: "Toppings",
|
5
|
+
value: 600,
|
6
|
+
}, {
|
7
|
+
name: "Cheese",
|
8
|
+
parent: "Toppings",
|
9
|
+
value: 510,
|
10
|
+
}, {
|
11
|
+
name: "Mushroom",
|
12
|
+
parent: "Toppings",
|
13
|
+
value: 330,
|
14
|
+
},{
|
15
|
+
name: "Onions",
|
16
|
+
parent: "Toppings",
|
17
|
+
value: 250,
|
18
|
+
}, {
|
19
|
+
name: "Olives",
|
20
|
+
parent: "Toppings",
|
21
|
+
value: 204,
|
22
|
+
}, {
|
23
|
+
name: "Pineapple",
|
24
|
+
parent: "Toppings",
|
25
|
+
value: 90,
|
26
|
+
}, {
|
27
|
+
name: "Pizza Toppings",
|
28
|
+
id: "Toppings",
|
29
|
+
},
|
30
|
+
] %>
|
31
|
+
|
32
|
+
<%= pb_rails("treemap_chart", props: {
|
33
|
+
chart_data: data,
|
34
|
+
colors: ["data-4", "data-7", "#8E6E53", "#124732"],
|
35
|
+
id: "treemap-colors",
|
36
|
+
title: "Favored Pizza Toppings",
|
37
|
+
}) %>
|
@@ -0,0 +1,48 @@
|
|
1
|
+
import React from 'react'
|
2
|
+
|
3
|
+
import TreemapChart from '../_treemap_chart'
|
4
|
+
|
5
|
+
const chartData = [
|
6
|
+
{
|
7
|
+
name: "Pepperoni",
|
8
|
+
parent: "Toppings",
|
9
|
+
value: 600,
|
10
|
+
}, {
|
11
|
+
name: "Cheese",
|
12
|
+
parent: "Toppings",
|
13
|
+
value: 510,
|
14
|
+
}, {
|
15
|
+
name: "Mushroom",
|
16
|
+
parent: "Toppings",
|
17
|
+
value: 330,
|
18
|
+
},{
|
19
|
+
name: "Onions",
|
20
|
+
parent: "Toppings",
|
21
|
+
value: 250,
|
22
|
+
}, {
|
23
|
+
name: "Olives",
|
24
|
+
parent: "Toppings",
|
25
|
+
value: 204,
|
26
|
+
}, {
|
27
|
+
name: "Pineapple",
|
28
|
+
parent: "Toppings",
|
29
|
+
value: 90,
|
30
|
+
}, {
|
31
|
+
name: "Pizza Toppings",
|
32
|
+
id: "Toppings",
|
33
|
+
},
|
34
|
+
]
|
35
|
+
|
36
|
+
const TreemapChartColors = (props) => (
|
37
|
+
<div>
|
38
|
+
<TreemapChart
|
39
|
+
chartData={chartData}
|
40
|
+
colors={["data-4", "data-7", "#8E6E53", "#124732"]}
|
41
|
+
id="treemap-colors"
|
42
|
+
title="Favored Pizza Toppings"
|
43
|
+
{...props}
|
44
|
+
/>
|
45
|
+
</div>
|
46
|
+
)
|
47
|
+
|
48
|
+
export default TreemapChartColors
|
@@ -0,0 +1,37 @@
|
|
1
|
+
<% data = [
|
2
|
+
{
|
3
|
+
name: "Pepperoni",
|
4
|
+
parent: "Toppings",
|
5
|
+
value: 600,
|
6
|
+
}, {
|
7
|
+
name: "Cheese",
|
8
|
+
parent: "Toppings",
|
9
|
+
value: 510,
|
10
|
+
}, {
|
11
|
+
name: "Mushroom",
|
12
|
+
parent: "Toppings",
|
13
|
+
value: 330,
|
14
|
+
},{
|
15
|
+
name: "Onions",
|
16
|
+
parent: "Toppings",
|
17
|
+
value: 250,
|
18
|
+
}, {
|
19
|
+
name: "Olives",
|
20
|
+
parent: "Toppings",
|
21
|
+
value: 204,
|
22
|
+
}, {
|
23
|
+
name: "Pineapple",
|
24
|
+
parent: "Toppings",
|
25
|
+
value: 90,
|
26
|
+
}, {
|
27
|
+
name: "Pizza Toppings",
|
28
|
+
id: "Toppings",
|
29
|
+
},
|
30
|
+
] %>
|
31
|
+
|
32
|
+
|
33
|
+
<%= pb_rails("treemap_chart", props: {
|
34
|
+
chart_data: data,
|
35
|
+
id: "treemap-default",
|
36
|
+
title: "Favored Pizza Toppings",
|
37
|
+
}) %>
|
@@ -0,0 +1,47 @@
|
|
1
|
+
import React from 'react'
|
2
|
+
|
3
|
+
import TreemapChart from '../_treemap_chart'
|
4
|
+
|
5
|
+
const chartData = [
|
6
|
+
{
|
7
|
+
name: "Pepperoni",
|
8
|
+
parent: "Toppings",
|
9
|
+
value: 600,
|
10
|
+
}, {
|
11
|
+
name: "Cheese",
|
12
|
+
parent: "Toppings",
|
13
|
+
value: 510,
|
14
|
+
}, {
|
15
|
+
name: "Mushroom",
|
16
|
+
parent: "Toppings",
|
17
|
+
value: 330,
|
18
|
+
},{
|
19
|
+
name: "Onions",
|
20
|
+
parent: "Toppings",
|
21
|
+
value: 250,
|
22
|
+
}, {
|
23
|
+
name: "Olives",
|
24
|
+
parent: "Toppings",
|
25
|
+
value: 204,
|
26
|
+
}, {
|
27
|
+
name: "Pineapple",
|
28
|
+
parent: "Toppings",
|
29
|
+
value: 90,
|
30
|
+
}, {
|
31
|
+
name: "Pizza Toppings",
|
32
|
+
id: "Toppings",
|
33
|
+
},
|
34
|
+
]
|
35
|
+
|
36
|
+
const TreemapChartDefault = (props) => (
|
37
|
+
<div>
|
38
|
+
<TreemapChart
|
39
|
+
chartData={chartData}
|
40
|
+
id="treemap-default"
|
41
|
+
title="Favored Pizza Toppings"
|
42
|
+
{...props}
|
43
|
+
/>
|
44
|
+
</div>
|
45
|
+
)
|
46
|
+
|
47
|
+
export default TreemapChartDefault
|
@@ -0,0 +1,79 @@
|
|
1
|
+
<% data = [
|
2
|
+
{
|
3
|
+
name: "Evergreen",
|
4
|
+
id: "Evergreen",
|
5
|
+
color: "#0056CF",
|
6
|
+
}, {
|
7
|
+
name: "Pine",
|
8
|
+
id: "Pine",
|
9
|
+
parent: "Evergreen",
|
10
|
+
value: 300,
|
11
|
+
color: "#477BC4",
|
12
|
+
}, {
|
13
|
+
name: "Ponderosa Pine",
|
14
|
+
parent: "Pine",
|
15
|
+
value: 50,
|
16
|
+
}, {
|
17
|
+
name: "Scots Pine",
|
18
|
+
parent: "Pine",
|
19
|
+
value: 150,
|
20
|
+
}, {
|
21
|
+
name: "White Pine",
|
22
|
+
parent: "Pine",
|
23
|
+
value: 100,
|
24
|
+
}, {
|
25
|
+
name: "Douglas Fir",
|
26
|
+
parent: "Evergreen",
|
27
|
+
value: 150,
|
28
|
+
}, {
|
29
|
+
name: "Juniper",
|
30
|
+
parent: "Evergreen",
|
31
|
+
value: 80,
|
32
|
+
}, {
|
33
|
+
name: "Hemlock",
|
34
|
+
parent: "Evergreen",
|
35
|
+
value: 30,
|
36
|
+
}, {
|
37
|
+
name: "Deciduous",
|
38
|
+
id: "Deciduous",
|
39
|
+
color: "#F9BB00",
|
40
|
+
}, {
|
41
|
+
name: "Oak",
|
42
|
+
parent: "Deciduous",
|
43
|
+
value: 80,
|
44
|
+
}, {
|
45
|
+
name: "Maple",
|
46
|
+
id: "Maple",
|
47
|
+
parent: "Deciduous",
|
48
|
+
value: 180,
|
49
|
+
color: "#F7CE52",
|
50
|
+
}, {
|
51
|
+
name: "Red Maple",
|
52
|
+
parent: "Maple",
|
53
|
+
value: 80,
|
54
|
+
}, {
|
55
|
+
name: "Sugar Maple",
|
56
|
+
parent: "Maple",
|
57
|
+
value: 100,
|
58
|
+
}, {
|
59
|
+
name: "Beech",
|
60
|
+
parent: "Deciduous",
|
61
|
+
value: 50,
|
62
|
+
}, {
|
63
|
+
name: "Willow",
|
64
|
+
parent: "Deciduous",
|
65
|
+
value: 100,
|
66
|
+
}, {
|
67
|
+
name: "Juniper",
|
68
|
+
parent: "Deciduous",
|
69
|
+
value: 90,
|
70
|
+
},
|
71
|
+
] %>
|
72
|
+
|
73
|
+
<%= pb_rails("treemap_chart", props: {
|
74
|
+
chart_data: data,
|
75
|
+
drillable: true,
|
76
|
+
grouped: true,
|
77
|
+
id: "treemap-drillable",
|
78
|
+
title: "Drillable Grouped Tree Species",
|
79
|
+
}) %>
|
@@ -0,0 +1,90 @@
|
|
1
|
+
import React from 'react'
|
2
|
+
|
3
|
+
import TreemapChart from '../_treemap_chart'
|
4
|
+
|
5
|
+
const chartData = [
|
6
|
+
{
|
7
|
+
name: "Evergreen",
|
8
|
+
id: "Evergreen",
|
9
|
+
color: "#0056CF",
|
10
|
+
}, {
|
11
|
+
name: "Pine",
|
12
|
+
id: "Pine",
|
13
|
+
parent: "Evergreen",
|
14
|
+
value: 300,
|
15
|
+
color: "#477BC4",
|
16
|
+
}, {
|
17
|
+
name: "Ponderosa Pine",
|
18
|
+
parent: "Pine",
|
19
|
+
value: 50,
|
20
|
+
}, {
|
21
|
+
name: "Scots Pine",
|
22
|
+
parent: "Pine",
|
23
|
+
value: 150,
|
24
|
+
}, {
|
25
|
+
name: "White Pine",
|
26
|
+
parent: "Pine",
|
27
|
+
value: 100,
|
28
|
+
}, {
|
29
|
+
name: "Douglas Fir",
|
30
|
+
parent: "Evergreen",
|
31
|
+
value: 150,
|
32
|
+
}, {
|
33
|
+
name: "Juniper",
|
34
|
+
parent: "Evergreen",
|
35
|
+
value: 80,
|
36
|
+
}, {
|
37
|
+
name: "Hemlock",
|
38
|
+
parent: "Evergreen",
|
39
|
+
value: 30,
|
40
|
+
}, {
|
41
|
+
name: "Deciduous",
|
42
|
+
id: "Deciduous",
|
43
|
+
color: "#F9BB00",
|
44
|
+
}, {
|
45
|
+
name: "Oak",
|
46
|
+
parent: "Deciduous",
|
47
|
+
value: 80,
|
48
|
+
}, {
|
49
|
+
name: "Maple",
|
50
|
+
id: "Maple",
|
51
|
+
parent: "Deciduous",
|
52
|
+
value: 180,
|
53
|
+
color: "#F7CE52",
|
54
|
+
}, {
|
55
|
+
name: "Red Maple",
|
56
|
+
parent: "Maple",
|
57
|
+
value: 80,
|
58
|
+
}, {
|
59
|
+
name: "Sugar Maple",
|
60
|
+
parent: "Maple",
|
61
|
+
value: 100,
|
62
|
+
}, {
|
63
|
+
name: "Beech",
|
64
|
+
parent: "Deciduous",
|
65
|
+
value: 50,
|
66
|
+
}, {
|
67
|
+
name: "Willow",
|
68
|
+
parent: "Deciduous",
|
69
|
+
value: 100,
|
70
|
+
}, {
|
71
|
+
name: "Juniper",
|
72
|
+
parent: "Deciduous",
|
73
|
+
value: 90,
|
74
|
+
},
|
75
|
+
]
|
76
|
+
|
77
|
+
const TreemapChartDrillable = (props) => (
|
78
|
+
<div>
|
79
|
+
<TreemapChart
|
80
|
+
chartData={chartData}
|
81
|
+
drillable
|
82
|
+
grouped
|
83
|
+
id="treemap-drillable"
|
84
|
+
title="Drillable Grouped Tree Species"
|
85
|
+
{...props}
|
86
|
+
/>
|
87
|
+
</div>
|
88
|
+
)
|
89
|
+
|
90
|
+
export default TreemapChartDrillable
|
@@ -0,0 +1 @@
|
|
1
|
+
Adding the `drillable` prop allows the tree to be traversed up and down by clicking into each box. Relationships are established through the `chartData`, detailed in the <a href="#treemap-grouped-data">Grouped Data section above</a>.
|
@@ -0,0 +1,54 @@
|
|
1
|
+
<% data = [
|
2
|
+
{
|
3
|
+
name: 'Meat',
|
4
|
+
id: 'Meat',
|
5
|
+
color: "#0056CF",
|
6
|
+
}, {
|
7
|
+
name: 'Pepperoni',
|
8
|
+
parent: 'Meat',
|
9
|
+
value: 250,
|
10
|
+
}, {
|
11
|
+
name: 'Meatball',
|
12
|
+
parent: 'Meat',
|
13
|
+
value: 400,
|
14
|
+
}, {
|
15
|
+
name: "Anchovy",
|
16
|
+
parent: 'Meat',
|
17
|
+
value: 40,
|
18
|
+
}, {
|
19
|
+
name: 'Vegetarian',
|
20
|
+
id: 'Vegetarian',
|
21
|
+
color: "#F9BB00",
|
22
|
+
}, {
|
23
|
+
name: 'Onions',
|
24
|
+
parent: 'Vegetarian',
|
25
|
+
value: 300,
|
26
|
+
}, {
|
27
|
+
name: 'Pineapple',
|
28
|
+
parent: 'Vegetarian',
|
29
|
+
value: 90,
|
30
|
+
}, {
|
31
|
+
name: "Peppers",
|
32
|
+
parent: 'Vegetarian',
|
33
|
+
value: 80,
|
34
|
+
}, {
|
35
|
+
name: "Specialty",
|
36
|
+
id: "Specialty",
|
37
|
+
color: "#9E64E9",
|
38
|
+
},{
|
39
|
+
name: "Buffalo Chicken",
|
40
|
+
parent: "Specialty",
|
41
|
+
value: 400,
|
42
|
+
}, {
|
43
|
+
name: "Supreme",
|
44
|
+
parent: "Specialty",
|
45
|
+
value: 150,
|
46
|
+
}
|
47
|
+
] %>
|
48
|
+
|
49
|
+
<%= pb_rails("treemap_chart", props: {
|
50
|
+
chart_data: data,
|
51
|
+
grouped: true,
|
52
|
+
id: "treemap-grouped",
|
53
|
+
title: "Grouped Toppings",
|
54
|
+
}) %>
|
@@ -0,0 +1,65 @@
|
|
1
|
+
import React from 'react'
|
2
|
+
|
3
|
+
import TreemapChart from '../_treemap_chart'
|
4
|
+
|
5
|
+
const chartData = [
|
6
|
+
{
|
7
|
+
name: 'Meat',
|
8
|
+
id: 'Meat',
|
9
|
+
color: "#0056CF",
|
10
|
+
}, {
|
11
|
+
name: 'Pepperoni',
|
12
|
+
parent: 'Meat',
|
13
|
+
value: 250,
|
14
|
+
}, {
|
15
|
+
name: 'Meatball',
|
16
|
+
parent: 'Meat',
|
17
|
+
value: 400,
|
18
|
+
}, {
|
19
|
+
name: "Anchovy",
|
20
|
+
parent: 'Meat',
|
21
|
+
value: 40,
|
22
|
+
}, {
|
23
|
+
name: 'Vegetarian',
|
24
|
+
id: 'Vegetarian',
|
25
|
+
color: "#F9BB00",
|
26
|
+
}, {
|
27
|
+
name: 'Onions',
|
28
|
+
parent: 'Vegetarian',
|
29
|
+
value: 300,
|
30
|
+
}, {
|
31
|
+
name: 'Pineapple',
|
32
|
+
parent: 'Vegetarian',
|
33
|
+
value: 90,
|
34
|
+
}, {
|
35
|
+
name: "Peppers",
|
36
|
+
parent: 'Vegetarian',
|
37
|
+
value: 80,
|
38
|
+
}, {
|
39
|
+
name: "Specialty",
|
40
|
+
id: "Specialty",
|
41
|
+
color: "#9E64E9",
|
42
|
+
},{
|
43
|
+
name: "Buffalo Chicken",
|
44
|
+
parent: "Specialty",
|
45
|
+
value: 400,
|
46
|
+
}, {
|
47
|
+
name: "Supreme",
|
48
|
+
parent: "Specialty",
|
49
|
+
value: 150,
|
50
|
+
}
|
51
|
+
]
|
52
|
+
|
53
|
+
const TreemapChartGroupedData = (props) => (
|
54
|
+
<div>
|
55
|
+
<TreemapChart
|
56
|
+
chartData={chartData}
|
57
|
+
grouped
|
58
|
+
id="treemap-grouped-data"
|
59
|
+
title="Grouped Toppings"
|
60
|
+
{...props}
|
61
|
+
/>
|
62
|
+
</div>
|
63
|
+
)
|
64
|
+
|
65
|
+
export default TreemapChartGroupedData
|
@@ -0,0 +1,3 @@
|
|
1
|
+
Data can be grouped into distinct segments by specifying the relationship in the `chartData`. For a point to be a parent, it needs an `id` of type `string` included in its object. Any other data points may then reference that `id` as their `parent` value to establish the tree structure.
|
2
|
+
|
3
|
+
Parents can also be passed a custom color to be applied to all of its child points.
|
@@ -0,0 +1,37 @@
|
|
1
|
+
<% data = [
|
2
|
+
{
|
3
|
+
name: "Pepperoni",
|
4
|
+
parent: "Toppings",
|
5
|
+
value: 600,
|
6
|
+
}, {
|
7
|
+
name: "Cheese",
|
8
|
+
parent: "Toppings",
|
9
|
+
value: 510,
|
10
|
+
}, {
|
11
|
+
name: "Mushroom",
|
12
|
+
parent: "Toppings",
|
13
|
+
value: 330,
|
14
|
+
},{
|
15
|
+
name: "Onions",
|
16
|
+
parent: "Toppings",
|
17
|
+
value: 250,
|
18
|
+
}, {
|
19
|
+
name: "Olives",
|
20
|
+
parent: "Toppings",
|
21
|
+
value: 204,
|
22
|
+
}, {
|
23
|
+
name: "Pineapple",
|
24
|
+
parent: "Toppings",
|
25
|
+
value: 90,
|
26
|
+
}, {
|
27
|
+
name: "Pizza Toppings",
|
28
|
+
id: "Toppings",
|
29
|
+
},
|
30
|
+
] %>
|
31
|
+
|
32
|
+
<%= pb_rails("treemap_chart", props: {
|
33
|
+
chart_data: data,
|
34
|
+
id: "treemap-tooltip",
|
35
|
+
title: "Favored Pizza Toppings",
|
36
|
+
tooltip_html: "<p>Custom tooltip for {point.name} <br/>with value: {point.value}</p>",
|
37
|
+
}) %>
|
@@ -0,0 +1,48 @@
|
|
1
|
+
import React from 'react'
|
2
|
+
|
3
|
+
import TreemapChart from '../_treemap_chart'
|
4
|
+
|
5
|
+
const chartData = [
|
6
|
+
{
|
7
|
+
name: "Pepperoni",
|
8
|
+
parent: "Toppings",
|
9
|
+
value: 600,
|
10
|
+
}, {
|
11
|
+
name: "Cheese",
|
12
|
+
parent: "Toppings",
|
13
|
+
value: 510,
|
14
|
+
}, {
|
15
|
+
name: "Mushroom",
|
16
|
+
parent: "Toppings",
|
17
|
+
value: 330,
|
18
|
+
},{
|
19
|
+
name: "Onions",
|
20
|
+
parent: "Toppings",
|
21
|
+
value: 250,
|
22
|
+
}, {
|
23
|
+
name: "Olives",
|
24
|
+
parent: "Toppings",
|
25
|
+
value: 204,
|
26
|
+
}, {
|
27
|
+
name: "Pineapple",
|
28
|
+
parent: "Toppings",
|
29
|
+
value: 90,
|
30
|
+
}, {
|
31
|
+
name: "Pizza Toppings",
|
32
|
+
id: "Toppings",
|
33
|
+
},
|
34
|
+
]
|
35
|
+
|
36
|
+
const TreemapChartTooltip = (props) => (
|
37
|
+
<div>
|
38
|
+
<TreemapChart
|
39
|
+
chartData={chartData}
|
40
|
+
id="treemap-tooltip"
|
41
|
+
title="Favored Pizza Toppings"
|
42
|
+
tooltipHtml= '<p>Custom tooltip for {point.name} <br/>with value: {point.value}</p>'
|
43
|
+
{...props}
|
44
|
+
/>
|
45
|
+
</div>
|
46
|
+
)
|
47
|
+
|
48
|
+
export default TreemapChartTooltip
|
@@ -0,0 +1,15 @@
|
|
1
|
+
examples:
|
2
|
+
|
3
|
+
rails:
|
4
|
+
- treemap_chart_default: Default
|
5
|
+
- treemap_chart_grouped_data: Grouped Data
|
6
|
+
- treemap_chart_drillable: Drillable
|
7
|
+
- treemap_chart_colors: Color Overrides
|
8
|
+
- treemap_chart_tooltip: Tooltip Customization
|
9
|
+
|
10
|
+
react:
|
11
|
+
- treemap_chart_default: Default
|
12
|
+
- treemap_chart_grouped_data: Grouped Data
|
13
|
+
- treemap_chart_drillable: Drillable
|
14
|
+
- treemap_chart_colors: Color Overrides
|
15
|
+
- treemap_chart_tooltip: Tooltip Customization
|
@@ -0,0 +1,5 @@
|
|
1
|
+
export { default as TreemapChartDefault } from './_treemap_chart_default.jsx'
|
2
|
+
export { default as TreemapChartGroupedData } from './_treemap_chart_grouped_data.jsx'
|
3
|
+
export { default as TreemapChartDrillable } from './_treemap_chart_drillable.jsx'
|
4
|
+
export { default as TreemapChartColors } from './_treemap_chart_colors.jsx'
|
5
|
+
export { default as TreemapChartTooltip } from './_treemap_chart_tooltip.jsx'
|
@@ -0,0 +1,63 @@
|
|
1
|
+
/* eslint-disable no-console */
|
2
|
+
|
3
|
+
import React from 'react';
|
4
|
+
import { render, screen } from '../utilities/test-utils';
|
5
|
+
import TreemapChart from './_treemap_chart';
|
6
|
+
|
7
|
+
beforeEach(() => {
|
8
|
+
// Silences error logs within the test suite.
|
9
|
+
jest.spyOn(console, 'error');
|
10
|
+
jest.spyOn(console, 'warn');
|
11
|
+
console.error.mockImplementation(() => {});
|
12
|
+
console.warn.mockImplementation(() => {});
|
13
|
+
});
|
14
|
+
|
15
|
+
afterEach(() => {
|
16
|
+
console.error.mockRestore();
|
17
|
+
console.warn.mockRestore();
|
18
|
+
});
|
19
|
+
|
20
|
+
const testId = 'treemapchart1';
|
21
|
+
|
22
|
+
test('uses exact classname', () => {
|
23
|
+
const data = [
|
24
|
+
{
|
25
|
+
name: "Pepperoni",
|
26
|
+
parent: "Toppings",
|
27
|
+
value: 600,
|
28
|
+
}, {
|
29
|
+
name: "Cheese",
|
30
|
+
parent: "Toppings",
|
31
|
+
value: 510,
|
32
|
+
}, {
|
33
|
+
name: "Mushroom",
|
34
|
+
parent: "Toppings",
|
35
|
+
value: 330,
|
36
|
+
},{
|
37
|
+
name: "Onions",
|
38
|
+
parent: "Toppings",
|
39
|
+
value: 250,
|
40
|
+
}, {
|
41
|
+
name: "Olives",
|
42
|
+
parent: "Toppings",
|
43
|
+
value: 204,
|
44
|
+
}, {
|
45
|
+
name: "Pineapple",
|
46
|
+
parent: "Toppings",
|
47
|
+
value: 90,
|
48
|
+
}, {
|
49
|
+
name: "Pizza Toppings",
|
50
|
+
id: "Toppings",
|
51
|
+
},
|
52
|
+
]
|
53
|
+
render(
|
54
|
+
<TreemapChart
|
55
|
+
chartData={data}
|
56
|
+
data={{ testid: testId }}
|
57
|
+
id="tree-map-id"
|
58
|
+
/>
|
59
|
+
);
|
60
|
+
|
61
|
+
const kit = screen.getByTestId(testId);
|
62
|
+
expect(kit).toHaveClass('pb_treemap_chart');
|
63
|
+
});
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= react_component('TreemapChart', object.chart_options) %>
|