playbook_ui 10.26.0.pre.alpha.sticky1 → 10.27.0.pre.datepicker1
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/_playbook.scss +1 -0
- data/app/pb_kits/playbook/data/menu.yml +1 -0
- data/app/pb_kits/playbook/index.js +2 -1
- data/app/pb_kits/playbook/pb_avatar/_avatar.tsx +3 -3
- data/app/pb_kits/playbook/pb_background/{_background.jsx → _background.tsx} +20 -13
- data/app/pb_kits/playbook/pb_badge/{_badge.jsx → _badge.tsx} +14 -15
- data/app/pb_kits/playbook/pb_badge/docs/_badge_colors.jsx +1 -1
- data/app/pb_kits/playbook/pb_badge/docs/_badge_default.jsx +1 -1
- data/app/pb_kits/playbook/pb_badge/docs/_badge_rounded.jsx +1 -1
- data/app/pb_kits/playbook/pb_badge/docs/index.js +3 -3
- data/app/pb_kits/playbook/pb_body/_body.tsx +9 -9
- data/app/pb_kits/playbook/pb_button/{_button.jsx → _button.tsx} +65 -46
- data/app/pb_kits/playbook/pb_button/docs/_button_default.html.erb +1 -0
- data/app/pb_kits/playbook/pb_button/docs/_button_options.jsx +1 -1
- data/app/pb_kits/playbook/pb_caption/{_caption.jsx → _caption.tsx} +7 -8
- data/app/pb_kits/playbook/pb_card/{_card.jsx → _card.tsx} +24 -22
- data/app/pb_kits/playbook/pb_card/_card_mixin.scss +1 -0
- data/app/pb_kits/playbook/pb_card/docs/_card_background.jsx +1 -1
- data/app/pb_kits/playbook/pb_card/docs/_card_border_none.jsx +1 -1
- data/app/pb_kits/playbook/pb_card/docs/_card_border_radius.jsx +1 -1
- data/app/pb_kits/playbook/pb_card/docs/_card_light.jsx +1 -1
- data/app/pb_kits/playbook/pb_card/docs/_card_selected.jsx +1 -1
- data/app/pb_kits/playbook/pb_collapsible/child_kits/CollapsibleMain.jsx +4 -2
- data/app/pb_kits/playbook/pb_collapsible/collapsible_main.html.erb +1 -1
- data/app/pb_kits/playbook/pb_dashboard/pbChartsDarkTheme.js +37 -0
- data/app/pb_kits/playbook/pb_dashboard/pbChartsLightTheme.js +37 -0
- data/app/pb_kits/playbook/pb_date_picker/_date_picker.jsx +2 -2
- data/app/pb_kits/playbook/pb_date_picker/_date_picker.scss +1 -0
- data/app/pb_kits/playbook/pb_date_picker/date_picker.rb +3 -2
- data/app/pb_kits/playbook/pb_date_picker/date_picker_helper.js +16 -7
- data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_default.html.erb +1 -1
- data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_month_and_year.html.erb +1 -1
- data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_month_and_year.jsx +1 -1
- data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_month_and_year.md +1 -1
- data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_week.html.erb +5 -0
- data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_week.jsx +18 -0
- data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_week.md +1 -0
- data/app/pb_kits/playbook/pb_date_picker/docs/example.yml +2 -0
- data/app/pb_kits/playbook/pb_date_picker/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_date_picker/sass_partials/_week_styles.scss +127 -0
- data/app/pb_kits/playbook/pb_flex/{_flex.jsx → _flex.tsx} +5 -5
- data/app/pb_kits/playbook/pb_form_pill/_form_pill.jsx +2 -2
- data/app/pb_kits/playbook/pb_highlight/_highlight.tsx +1 -1
- data/app/pb_kits/playbook/pb_icon/{_icon.jsx → _icon.tsx} +40 -30
- data/app/pb_kits/playbook/pb_image/_image.tsx +1 -1
- data/app/pb_kits/playbook/pb_pill/{_pill.jsx → _pill.tsx} +6 -8
- data/app/pb_kits/playbook/pb_pill/docs/_pill_default.jsx +1 -1
- data/app/pb_kits/playbook/pb_pill/docs/_pill_variants.jsx +1 -1
- data/app/pb_kits/playbook/pb_title/{_title.jsx → _title.tsx} +10 -12
- data/app/pb_kits/playbook/pb_title/title.test.js +2 -2
- data/app/pb_kits/playbook/pb_treemap_chart/_treemap_chart.jsx +79 -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/treemap_chart.html.erb +1 -0
- data/app/pb_kits/playbook/pb_treemap_chart/treemap_chart.rb +43 -0
- data/app/pb_kits/playbook/pb_user/{_user.jsx → _user.tsx} +20 -24
- data/app/pb_kits/playbook/playbook-doc.js +2 -0
- data/app/pb_kits/playbook/playbook-rails-react-bindings.js +2 -0
- data/app/pb_kits/playbook/plugins/pb_chart.js +34 -0
- data/app/pb_kits/playbook/tokens/_colors.scss +2 -1
- data/app/pb_kits/playbook/tokens/_display.scss +13 -0
- data/app/pb_kits/playbook/tokens/_screen_sizes.scss +36 -0
- data/app/pb_kits/playbook/utilities/_align_content.scss +10 -29
- data/app/pb_kits/playbook/utilities/_align_items.scss +11 -35
- data/app/pb_kits/playbook/utilities/_align_self.scss +10 -29
- data/app/pb_kits/playbook/utilities/_display.scss +26 -2
- data/app/pb_kits/playbook/utilities/_flex.scss +19 -14
- data/app/pb_kits/playbook/utilities/_flex_direction.scss +7 -18
- data/app/pb_kits/playbook/utilities/_flex_grow.scss +5 -8
- data/app/pb_kits/playbook/utilities/_flex_shrink.scss +5 -8
- data/app/pb_kits/playbook/utilities/_flex_wrap.scss +6 -13
- data/app/pb_kits/playbook/utilities/_justify_content.scss +10 -23
- data/app/pb_kits/playbook/utilities/_justify_self.scss +9 -19
- data/app/pb_kits/playbook/utilities/_mixins.scss +26 -0
- data/app/pb_kits/playbook/utilities/_order.scss +17 -55
- data/app/pb_kits/playbook/utilities/globalProps.ts +150 -121
- data/app/pb_kits/playbook/utilities/test/globalProps/alignContent.test.js +37 -0
- data/app/pb_kits/playbook/utilities/test/globalProps/alignItems.test.js +36 -0
- data/app/pb_kits/playbook/utilities/test/globalProps/alignSelf.test.js +37 -0
- data/app/pb_kits/playbook/utilities/test/globalProps/display.test.js +38 -0
- data/app/pb_kits/playbook/utilities/test/globalProps/flex.test.js +64 -0
- data/app/pb_kits/playbook/utilities/test/globalProps/flexDirection.test.js +37 -0
- data/app/pb_kits/playbook/utilities/test/globalProps/flexGrow.test.js +35 -0
- data/app/pb_kits/playbook/utilities/test/globalProps/flexShrink.test.js +35 -0
- data/app/pb_kits/playbook/utilities/test/globalProps/flexWrap.test.js +37 -0
- data/app/pb_kits/playbook/utilities/test/globalProps/justifyContent.test.js +37 -0
- data/app/pb_kits/playbook/utilities/test/globalProps/justifySelf.test.js +37 -0
- data/app/pb_kits/playbook/utilities/test/globalProps/order.test.js +35 -0
- data/app/pb_kits/playbook/utilities/test-utils.js +2 -0
- data/app/pb_kits/playbook/utilities/text.ts +22 -0
- data/dist/reset.css +1 -60
- data/lib/playbook/align_content.rb +11 -3
- data/lib/playbook/align_items.rb +10 -2
- data/lib/playbook/align_self.rb +9 -1
- data/lib/playbook/display.rb +19 -7
- data/lib/playbook/flex.rb +9 -1
- data/lib/playbook/flex_direction.rb +10 -2
- data/lib/playbook/flex_grow.rb +9 -1
- data/lib/playbook/flex_shrink.rb +9 -1
- data/lib/playbook/flex_wrap.rb +10 -2
- data/lib/playbook/justify_content.rb +10 -2
- data/lib/playbook/justify_self.rb +9 -1
- data/lib/playbook/order.rb +10 -2
- data/lib/playbook/version.rb +2 -2
- metadata +52 -13
- data/app/pb_kits/playbook/utilities/text.js +0 -15
@@ -1,24 +1,22 @@
|
|
1
|
-
/* @flow */
|
2
|
-
|
3
1
|
import React from 'react'
|
4
2
|
import classnames from 'classnames'
|
5
3
|
import { buildAriaProps, buildCss, buildDataProps } from '../utilities/props'
|
6
|
-
import { deprecatedProps, globalProps } from '../utilities/globalProps'
|
4
|
+
import { deprecatedProps, GlobalProps, globalProps } from '../utilities/globalProps'
|
7
5
|
|
8
6
|
type TitleProps = {
|
9
|
-
aria?:
|
10
|
-
children?:
|
7
|
+
aria?: {[key: string]: string},
|
8
|
+
children?: React.ReactChild[],
|
11
9
|
className?: string,
|
12
10
|
color?: "default" | "light" | "lighter" | "success" | "error" | "link",
|
13
|
-
data?:
|
11
|
+
data?: {[key: string]: string},
|
14
12
|
id?: string,
|
15
13
|
size?: 1 | 2 | 3 | 4,
|
16
14
|
tag?: "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "div" | "span",
|
17
15
|
text?: string,
|
18
16
|
variant?: null | "link",
|
19
|
-
}
|
17
|
+
} & GlobalProps
|
20
18
|
|
21
|
-
const Title = (props: TitleProps) => {
|
19
|
+
const Title = (props: TitleProps): React.ReactElement => {
|
22
20
|
if (props.variant) deprecatedProps('Title', ['variant']) //variant prop is deprecated, use color instead
|
23
21
|
const {
|
24
22
|
aria = {},
|
@@ -33,14 +31,14 @@ const Title = (props: TitleProps) => {
|
|
33
31
|
variant = null,
|
34
32
|
} = props
|
35
33
|
|
36
|
-
const ariaProps = buildAriaProps(aria)
|
37
|
-
const dataProps = buildDataProps(data)
|
34
|
+
const ariaProps: {[key: string]: string | number} = buildAriaProps(aria)
|
35
|
+
const dataProps: {[key: string]: string | number} = buildDataProps(data)
|
38
36
|
const classes = classnames(
|
39
|
-
buildCss('pb_title_kit', size
|
37
|
+
buildCss('pb_title_kit', `size_${size}`, variant, color),
|
40
38
|
globalProps(props),
|
41
39
|
className,
|
42
40
|
)
|
43
|
-
const Tag = `${tag}`
|
41
|
+
const Tag: React.ReactElement | any = `${tag}`
|
44
42
|
|
45
43
|
return (
|
46
44
|
<Tag
|
@@ -12,7 +12,7 @@ test('returns namespaced class name', () => {
|
|
12
12
|
)
|
13
13
|
|
14
14
|
const kit = screen.getByTestId('primary-test')
|
15
|
-
expect(kit).toHaveClass('
|
15
|
+
expect(kit).toHaveClass('pb_title_kit_size_3')
|
16
16
|
})
|
17
17
|
|
18
18
|
test('with colors', () => {
|
@@ -25,5 +25,5 @@ test('with colors', () => {
|
|
25
25
|
)
|
26
26
|
|
27
27
|
const kit = screen.getByTestId('primary-test')
|
28
|
-
expect(kit).toHaveClass('
|
28
|
+
expect(kit).toHaveClass('pb_title_kit_size_3_success')
|
29
29
|
})
|
@@ -0,0 +1,79 @@
|
|
1
|
+
/* @flow */
|
2
|
+
|
3
|
+
import React from 'react'
|
4
|
+
import classnames from 'classnames'
|
5
|
+
|
6
|
+
import { globalProps } from '../utilities/globalProps'
|
7
|
+
import pbChart from '../plugins/pb_chart'
|
8
|
+
|
9
|
+
type TreemapChartProps = {
|
10
|
+
chartData: array<{
|
11
|
+
name: string,
|
12
|
+
parent?: string | number,
|
13
|
+
value: number,
|
14
|
+
color?: string,
|
15
|
+
id?: string | number,
|
16
|
+
}>,
|
17
|
+
className?: string,
|
18
|
+
colors: array,
|
19
|
+
dark?: boolean,
|
20
|
+
drillable: boolean,
|
21
|
+
grouped: boolean,
|
22
|
+
height?: string,
|
23
|
+
id: number,
|
24
|
+
title: string,
|
25
|
+
tooltipHtml: string,
|
26
|
+
type?: string,
|
27
|
+
}
|
28
|
+
|
29
|
+
export default class TreemapChart extends React.Component<TreemapChartProps> {
|
30
|
+
static defaultProps = {
|
31
|
+
className: 'pb_treemap_chart',
|
32
|
+
dark: false,
|
33
|
+
drillable: false,
|
34
|
+
grouped: false,
|
35
|
+
type: 'treemap',
|
36
|
+
}
|
37
|
+
|
38
|
+
componentDidMount() {
|
39
|
+
const {
|
40
|
+
chartData,
|
41
|
+
className,
|
42
|
+
colors = [],
|
43
|
+
dark,
|
44
|
+
drillable,
|
45
|
+
grouped,
|
46
|
+
height,
|
47
|
+
id,
|
48
|
+
title = "",
|
49
|
+
tooltipHtml = '<span style="font-weight: bold; color:{point.color};">● </span>{point.name}: <b>{point.value}</b>',
|
50
|
+
type,
|
51
|
+
} = this.props
|
52
|
+
|
53
|
+
new pbChart(`.${className}`, {
|
54
|
+
chartData: chartData,
|
55
|
+
colors: colors,
|
56
|
+
dark,
|
57
|
+
drillable,
|
58
|
+
grouped,
|
59
|
+
height: height,
|
60
|
+
id: id,
|
61
|
+
title: title,
|
62
|
+
tooltipHtml,
|
63
|
+
type,
|
64
|
+
})
|
65
|
+
}
|
66
|
+
|
67
|
+
props: TreemapChartProps
|
68
|
+
|
69
|
+
render() {
|
70
|
+
const { className, id } = this.props
|
71
|
+
|
72
|
+
return (
|
73
|
+
<div
|
74
|
+
className={classnames(globalProps(this.props), className)}
|
75
|
+
id={id}
|
76
|
+
/>
|
77
|
+
)
|
78
|
+
}
|
79
|
+
}
|
@@ -0,0 +1,5 @@
|
|
1
|
+
Treemap charts are used to compare the relative size of groups of data. They can also use a nested data structure, allowing a user to drill down into a group to see its constituent data points.
|
2
|
+
|
3
|
+
The default height of treemap is 400px and can be changed. The default height is in pixel units, but can also use percentage string (percentage would be that of the width. For example, `height:"50%"` would mean that the height is 50% of the width). This allows for preserving the aspect ratio across responsive sizes.
|
4
|
+
|
5
|
+
For more information, see: <a href="https://api.highcharts.com/highcharts/chart.height" target="_blank"> highcharts/chart.height</a>.
|
@@ -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
|
+
}) %>
|