playbook_ui_docs 14.22.0.pre.alpha.play2261highchartsbargraphimportedstyles8730 → 14.22.0.pre.alpha.popoverkittransitionpoppertofloatingui8736

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 (23) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_colors.jsx +15 -33
  3. data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_custom.jsx +72 -0
  4. data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_custom.md +6 -0
  5. data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_default.jsx +15 -33
  6. data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_height.jsx +22 -52
  7. data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_horizontal.jsx +16 -12
  8. data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_legend.jsx +15 -31
  9. data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_legend_non_clickable.jsx +16 -39
  10. data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_legend_position.jsx +38 -86
  11. data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_negative_numbers.jsx +15 -33
  12. data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_pb_styles.jsx +64 -0
  13. data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_pb_styles.md +1 -0
  14. data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_secondary_y_axis.jsx +22 -72
  15. data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_secondary_y_axis.md +1 -1
  16. data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_spline.jsx +15 -32
  17. data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_stacked.jsx +16 -37
  18. data/app/pb_kits/playbook/pb_bar_graph/docs/_description.md +3 -1
  19. data/app/pb_kits/playbook/pb_bar_graph/docs/example.yml +3 -1
  20. data/app/pb_kits/playbook/pb_bar_graph/docs/index.js +2 -0
  21. data/dist/playbook-doc.js +1 -1
  22. metadata +5 -2
  23. data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_height.md +0 -3
@@ -1,9 +1,6 @@
1
1
  import React from 'react'
2
2
 
3
- import Highcharts from "highcharts";
4
- import HighchartsReact from "highcharts-react-official";
5
-
6
- import barGraphTheme from '../barGraphTheme';
3
+ import BarGraph from '../_bar_graph'
7
4
 
8
5
  const chartData = [{
9
6
  name: 'Installation',
@@ -13,41 +10,26 @@ const chartData = [{
13
10
  name: 'Manufacturing',
14
11
  data: [1475, 200, 1000, 654, -656],
15
12
  threshold: 0
16
- },
13
+ },
17
14
  {
18
15
  name: 'Sales & Distribution',
19
16
  data: [1270, 100, -1200, 554, 756],
20
17
  threshold: 0
21
18
  }]
22
19
 
23
- const chartOptions = {
24
- series: chartData,
25
- title: {
26
- text: "Bar Graph with Negative Numbers",
27
- },
28
- xAxis: {
29
- categories: ["Jan", "Feb", "Mar", "Apr", "May"],
30
- },
31
- yAxis: {
32
- title: {
33
- text: "Number of Employees",
34
- },
35
- },
36
- legend: { enabled: true },
37
- };
38
-
39
-
40
- const BarGraphStacked = () => {
41
- const options = Highcharts.merge({}, barGraphTheme, chartOptions)
42
20
 
43
- return(
44
- <div>
45
- <HighchartsReact
46
- highcharts={Highcharts}
47
- options={options}
48
- />
49
- </div>
50
- )
51
- }
21
+ const BarGraphStacked = (props) => (
22
+ <div>
23
+ <BarGraph
24
+ axisTitle="Number of Employees"
25
+ chartData={chartData}
26
+ id="bar-default"
27
+ legend
28
+ title="Bar Graph with Negative Numbers"
29
+ xAxisCategories={['Jan', 'Feb', 'Mar', 'Apr', 'May']}
30
+ {...props}
31
+ />
32
+ </div>
33
+ )
52
34
 
53
35
  export default BarGraphStacked
@@ -0,0 +1,64 @@
1
+ import React from 'react'
2
+ import Highcharts from "highcharts";
3
+ import HighchartsReact from "highcharts-react-official";
4
+
5
+ import "../BarGraphStyles.scss";
6
+ // Your path might look more like this
7
+ //import "playbook-ui/dist/pb_bar_graph/BarGraphStyles.scss";
8
+
9
+ const columnChartData = [
10
+ {
11
+ name: "Installation",
12
+ data: [1475, 200, 3000, 654, 656],
13
+ },
14
+ {
15
+ name: "Manufacturing",
16
+ data: [4434, 524, 2320, 440, 500],
17
+ },
18
+ {
19
+ name: "Sales & Distribution",
20
+ data: [3387, 743, 1344, 434, 440],
21
+ },
22
+ {
23
+ name: "Project Development",
24
+ data: [3227, 878, 999, 780, 1000],
25
+ },
26
+ {
27
+ name: "Other",
28
+ data: [1111, 677, 3245, 500, 200],
29
+ },
30
+ ];
31
+
32
+ const columnOptions = {
33
+ chart: {
34
+ type: "column",
35
+ },
36
+ series: columnChartData,
37
+ title: {
38
+ text: "Solar Employment Growth by Sector, 2010-2016",
39
+ },
40
+ subtitle: {
41
+ text: "Source: thesolarfoundation.com",
42
+ },
43
+ xAxis: {
44
+ categories: ["Jan", "Feb", "Mar", "Apr", "May"],
45
+ },
46
+ yAxis: {
47
+ min: 0,
48
+ title: {
49
+ text: "Number of Employees",
50
+ },
51
+ },
52
+ legend: { enabled: false },
53
+ credits: { enabled: false },
54
+ };
55
+
56
+ const BarGraphPbStyles = () => (
57
+ <div>
58
+ <HighchartsReact highcharts={Highcharts}
59
+ options={columnOptions}
60
+ />
61
+ </div>
62
+ )
63
+
64
+ export default BarGraphPbStyles
@@ -0,0 +1 @@
1
+ You don't need to use the bar graph kit to apply the styles to your Highcharts bar graph. Just import the BarGraphStyles.scss to your component and the styles will apply automatically.
@@ -1,11 +1,6 @@
1
1
  import React from 'react'
2
- import Highcharts from "highcharts"
3
- import HighchartsReact from "highcharts-react-official"
4
2
 
5
-
6
- import barGraphTheme from '../barGraphTheme';
7
- import colors from '../../tokens/exports/_colors.module.scss'
8
- import typography from '../../tokens/exports/_typography.module.scss'
3
+ import BarGraph from '../_bar_graph'
9
4
 
10
5
  const chartData = [{
11
6
  name: 'Number of Installations',
@@ -18,69 +13,24 @@ const chartData = [{
18
13
  yAxis: 1
19
14
  }]
20
15
 
21
- const chartOptions = {
22
- series: chartData,
23
- title: {
24
- text: "Bar Graph with Secondary Y-axis",
25
- },
26
- xAxis: {
27
- categories: ["Jan", "Feb", "Mar", "Apr", "May"],
28
- },
29
- yAxis: [{
30
- labels: {
31
- style: {
32
- fontFamily: typography.font_family_base,
33
- color: colors.text_lt_lighter,
34
- fontWeight: typography.bold,
35
- fontSize: typography.text_smaller,
36
- },
37
- },
38
- title: {
39
- text: "Number of Employees",
40
- style: {
41
- fontFamily: typography.font_family_base,
42
- color: colors.text_lt_lighter,
43
- fontWeight: typography.bold,
44
- fontSize: typography.text_smaller,
45
- },
46
- },
47
- }, {
48
- labels: {
49
- style: {
50
- fontFamily: typography.font_family_base,
51
- color: colors.text_lt_lighter,
52
- fontWeight: typography.bold,
53
- fontSize: typography.text_smaller,
54
- },
55
- },
56
- title: {
57
- text: "Percentage",
58
- style: {
59
- fontFamily: typography.font_family_base,
60
- color: colors.text_lt_lighter,
61
- fontWeight: typography.bold,
62
- fontSize: typography.text_smaller,
63
- },
64
- },
65
-
66
- opposite: true,
67
- min: 0,
68
- max: 100
69
- }],
70
- legend: { enabled: true },
71
- }
72
-
73
- const BarGraphSecondaryYAxis = () => {
74
- const options = Highcharts.merge({}, barGraphTheme, chartOptions)
75
-
76
- return (
77
- <div>
78
- <HighchartsReact
79
- highcharts={Highcharts}
80
- options={options}
81
- />
82
- </div>
83
- )
84
- }
85
-
86
- export default BarGraphSecondaryYAxis
16
+ const axisTitles = [ {name: "Number of Installations"}, {name: "Percentage"}]
17
+
18
+ const axisFormats = [{format: ""}, {format: "{value}%"}]
19
+
20
+ const BarGraphSecondaryYAxis= (props) => (
21
+ <div>
22
+ <BarGraph
23
+ axisFormat={axisFormats}
24
+ axisTitle={axisTitles}
25
+ chartData={chartData}
26
+ id="bar-spline"
27
+ legend
28
+ title="Bar Graph with Secondary Y-axis"
29
+ xAxisCategories={['Jan', 'Feb', 'Mar', 'Apr', 'May']}
30
+ yAxisMin={0}
31
+ {...props}
32
+ />
33
+ </div>
34
+ )
35
+
36
+ export default BarGraphSecondaryYAxis
@@ -1,3 +1,3 @@
1
- Optionally add a second yAxis to support secondary datasets (e.x., a spline) by passing `yAxis: 1` to the second node of your `chartData` array.
1
+ Optionally add a second yAxis to support secondary datasets (e.x., a spline) by passing` yAxis: 1` to the second node of your `chartData` array.
2
2
 
3
3
  To customize the format and/or title of your secondary yAxis, pass your desired values as arrays through the `axisFormat` and `axisTitle` props, respectively.
@@ -1,9 +1,6 @@
1
1
  import React from 'react'
2
2
 
3
- import Highcharts from "highcharts";
4
- import HighchartsReact from "highcharts-react-official";
5
-
6
- import barGraphTheme from '../barGraphTheme';
3
+ import BarGraph from '../_bar_graph'
7
4
 
8
5
  const chartData = [{
9
6
  name: 'Number of Installations',
@@ -15,33 +12,19 @@ const chartData = [{
15
12
  color: '#F9BB00',
16
13
  }]
17
14
 
18
- const chartOptions = {
19
- series: chartData,
20
- title: {
21
- text: "Bar Graph with Spline",
22
- },
23
- xAxis: {
24
- categories: ["Jan", "Feb", "Mar", "Apr", "May"],
25
- },
26
- yAxis: {
27
- title: {
28
- text: "Number of Employees",
29
- },
30
- },
31
- legend: { enabled: true },
32
- };
33
-
34
- const BarGraphSpline = () => {
35
- const options = Highcharts.merge({}, barGraphTheme, chartOptions)
36
-
37
- return (
38
- <div>
39
- <HighchartsReact
40
- highcharts={Highcharts}
41
- options={options}
42
- />
43
- </div>
44
- )
45
- }
15
+ const BarGraphSpline = (props) => (
16
+ <div>
17
+ <BarGraph
18
+ axisTitle="Number of Employees"
19
+ chartData={chartData}
20
+ id="bar-spline"
21
+ legend
22
+ title="Bar Graph with Spline"
23
+ xAxisCategories={['Jan', 'Feb', 'Mar', 'Apr', 'May']}
24
+ yAxisMin={0}
25
+ {...props}
26
+ />
27
+ </div>
28
+ )
46
29
 
47
30
  export default BarGraphSpline
@@ -1,8 +1,6 @@
1
1
  import React from 'react'
2
- import Highcharts from "highcharts";
3
- import HighchartsReact from "highcharts-react-official";
4
2
 
5
- import barGraphTheme from '../barGraphTheme';
3
+ import BarGraph from '../_bar_graph'
6
4
 
7
5
  const chartData = [{
8
6
  name: 'Installation',
@@ -16,40 +14,21 @@ const chartData = [{
16
14
  data: [975, 1600, 1500, 924, 500],
17
15
  }]
18
16
 
19
- const chartOptions = {
20
- series: chartData,
21
- title: {
22
- text: "Bar Graph with Stacked Columns",
23
- },
24
- xAxis: {
25
- categories: ["Jan", "Feb", "Mar", "Apr", "May"],
26
- },
27
- yAxis: {
28
- title: {
29
- text: "Number of Employees",
30
- },
31
- },
32
- plotOptions: {
33
- column: {
34
- stacking: 'normal',
35
- borderWidth: 0,
36
- }
37
- },
38
- legend: { enabled: true },
39
- };
40
17
 
41
-
42
- const BarGraphStacked = () => {
43
- const options = Highcharts.merge({}, barGraphTheme, chartOptions)
44
-
45
- return (
46
- <div>
47
- <HighchartsReact
48
- highcharts={Highcharts}
49
- options={options}
50
- />
51
- </div>
52
- )
53
- }
18
+ const BarGraphStacked = (props) => (
19
+ <div>
20
+ <BarGraph
21
+ axisTitle="Number Of Employees"
22
+ chartData={chartData}
23
+ id="bar-default"
24
+ legend
25
+ stacking="normal"
26
+ title="Bar Graph with Stacked Columns"
27
+ xAxisCategories={['Jan', 'Feb', 'Mar', 'Apr', 'May']}
28
+ yAxisMin={0}
29
+ {...props}
30
+ />
31
+ </div>
32
+ )
54
33
 
55
34
  export default BarGraphStacked
@@ -1 +1,3 @@
1
- To apply Playbook styles to your Highchart, import BarGraphTheme.ts and merge it with your Highchart options. Then, pass the merged value to the options prop. Playbook’s styling will be applied automatically. See the examples in the documentation below.
1
+ Bar graphs are used to compare data. Bar graphs are not typically used to show percentages. The default height of bar graph 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.
2
+
3
+ For more information, see: <a href="https://api.highcharts.com/highcharts/chart.height" target="_blank"> highcharts/chart.height</a>.
@@ -17,13 +17,15 @@ examples:
17
17
 
18
18
  react:
19
19
  - bar_graph_default: Default
20
+ - bar_graph_pb_styles: Playbook Styles
20
21
  - bar_graph_legend: Legend
21
22
  - bar_graph_legend_position: Legend Position
22
23
  - bar_graph_legend_non_clickable: Legend Non Clickable
23
24
  - bar_graph_height: Height
24
25
  - bar_graph_spline: Spline
25
26
  - bar_graph_colors: Color Overrides
27
+ - bar_graph_custom: Custom Overrides
26
28
  - bar_graph_stacked: Stacked
27
29
  - bar_graph_negative_numbers: Negative Numbers
28
30
  - bar_graph_secondary_y_axis: Secondary Y-Axis
29
- - bar_graph_horizontal: Horizontal Bar Graph
31
+ - bar_graph_horizontal: Custom Options From Highcharts
@@ -5,7 +5,9 @@ export { default as BarGraphLegendNonClickable } from './_bar_graph_legend_non_c
5
5
  export { default as BarGraphHeight } from './_bar_graph_height.jsx'
6
6
  export { default as BarGraphSpline } from './_bar_graph_spline.jsx'
7
7
  export { default as BarGraphColors } from './_bar_graph_colors.jsx'
8
+ export { default as BarGraphCustom } from './_bar_graph_custom.jsx'
8
9
  export { default as BarGraphStacked } from './_bar_graph_stacked.jsx'
9
10
  export { default as BarGraphNegativeNumbers } from './_bar_graph_negative_numbers.jsx'
10
11
  export { default as BarGraphSecondaryYAxis } from './_bar_graph_secondary_y_axis.jsx'
11
12
  export { default as BarGraphHorizontal } from './_bar_graph_horizontal.jsx'
13
+ export { default as BarGraphPbStyles } from './_bar_graph_pb_styles.jsx'