playbook_ui 14.22.0.pre.alpha.PLAY2292advancedtablepinnedrowsloading8632 → 14.22.0.pre.alpha.PLAY2303optB8977

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 (74) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/pb_advanced_table/Hooks/useTableState.ts +3 -24
  3. data/app/pb_kits/playbook/pb_advanced_table/docs/example.yml +7 -6
  4. data/app/pb_kits/playbook/pb_badge/_badge.scss +5 -6
  5. data/app/pb_kits/playbook/pb_bar_graph/barGraphTheme.ts +106 -0
  6. data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_colors.jsx +33 -15
  7. data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_default.jsx +33 -15
  8. data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_height.jsx +52 -22
  9. data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_height.md +3 -0
  10. data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_horizontal.jsx +12 -16
  11. data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_legend.jsx +31 -15
  12. data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_legend_non_clickable.jsx +39 -16
  13. data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_legend_position.jsx +86 -38
  14. data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_negative_numbers.jsx +32 -15
  15. data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_secondary_y_axis.jsx +72 -22
  16. data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_secondary_y_axis.md +1 -1
  17. data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_spline.jsx +31 -15
  18. data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_stacked.jsx +37 -16
  19. data/app/pb_kits/playbook/pb_bar_graph/docs/_description.md +1 -3
  20. data/app/pb_kits/playbook/pb_bar_graph/docs/example.yml +1 -3
  21. data/app/pb_kits/playbook/pb_bar_graph/docs/index.js +0 -2
  22. data/app/pb_kits/playbook/pb_body/docs/_body_truncate.jsx +3 -3
  23. data/app/pb_kits/playbook/pb_body/docs/_body_truncate_react.md +4 -0
  24. data/app/pb_kits/playbook/pb_circle_chart/circleChartTheme.ts +36 -1
  25. data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_block.jsx +71 -26
  26. data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_colors.jsx +29 -16
  27. data/app/pb_kits/playbook/pb_circle_chart/docs/{_circle_chart_colors.md → _circle_chart_colors_rails.md} +1 -1
  28. data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_colors_react.md +2 -0
  29. data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_custom_tooltip.jsx +28 -16
  30. data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_custom_tooltip.md +4 -2
  31. data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_default.jsx +23 -15
  32. data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_inner_sizes.jsx +81 -51
  33. data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_legend_position.jsx +103 -75
  34. data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_legend_position.md +3 -6
  35. data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_live_data.jsx +19 -13
  36. data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_rounded.jsx +30 -17
  37. data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_with_labels.jsx +34 -20
  38. data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_with_legend_kit.jsx +29 -20
  39. data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_with_title.jsx +28 -20
  40. data/app/pb_kits/playbook/pb_circle_chart/docs/_description.md +1 -0
  41. data/app/pb_kits/playbook/pb_circle_chart/docs/example.yml +0 -1
  42. data/app/pb_kits/playbook/pb_circle_chart/docs/index.js +0 -1
  43. data/app/pb_kits/playbook/pb_draggable/context/index.tsx +12 -4
  44. data/app/pb_kits/playbook/pb_draggable/context/types.ts +5 -2
  45. data/app/pb_kits/playbook/pb_phone_number_input/_phone_number_input.tsx +27 -17
  46. data/app/pb_kits/playbook/pb_title/docs/_title_truncate.jsx +3 -3
  47. data/app/pb_kits/playbook/pb_title/docs/_title_truncate_react.md +4 -0
  48. data/app/pb_kits/playbook/pb_tooltip/docs/_tooltip_click_open.html.erb +14 -0
  49. data/app/pb_kits/playbook/pb_tooltip/docs/_tooltip_click_open_rails.md +1 -0
  50. data/app/pb_kits/playbook/pb_tooltip/docs/example.yml +1 -0
  51. data/app/pb_kits/playbook/pb_tooltip/index.js +59 -36
  52. data/app/pb_kits/playbook/pb_tooltip/tooltip.rb +9 -2
  53. data/dist/chunks/_circle_chart-BZmlhBs2.js +1 -0
  54. data/dist/chunks/{_typeahead-B7FRYVtS.js → _typeahead-B1tu_vWi.js} +3 -3
  55. data/dist/chunks/{_weekday_stacked-DdYjKH-i.js → _weekday_stacked-CKk0dR5s.js} +2 -2
  56. data/dist/chunks/{lib-Carqm8Ip.js → lib-DYpq0k8j.js} +1 -1
  57. data/dist/chunks/{pb_form_validation-DqRmTS8m.js → pb_form_validation-BUOKwfvW.js} +1 -1
  58. data/dist/chunks/vendor.js +1 -1
  59. data/dist/menu.yml +68 -8
  60. data/dist/playbook-doc.js +2 -2
  61. data/dist/playbook-rails-react-bindings.js +1 -1
  62. data/dist/playbook-rails.js +1 -1
  63. data/dist/playbook.css +1 -1
  64. data/lib/playbook/version.rb +1 -1
  65. metadata +19 -16
  66. data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_custom.jsx +0 -72
  67. data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_custom.md +0 -6
  68. data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_pb_styles.jsx +0 -64
  69. data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_pb_styles.md +0 -1
  70. data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_pb_styles.jsx +0 -38
  71. data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_pb_styles.md +0 -1
  72. /data/app/pb_kits/playbook/pb_body/docs/{_body_truncate.md → _body_truncate_rails.md} +0 -0
  73. /data/app/pb_kits/playbook/pb_title/docs/{_title_truncate.md → _title_truncate_rails.md} +0 -0
  74. /data/app/pb_kits/playbook/pb_tooltip/docs/{_tooltip_click_open.md → _tooltip_click_open_react.md} +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1a87d5a3b0f1ba4c0e20a6d286acb82d538fb5bd2cb68700d81df41cf44f1449
4
- data.tar.gz: 507e84e412dc50c8020a636f6c46e1fa326605de6ba7ffbd60499790770d6c54
3
+ metadata.gz: 3672cfbb818cbb482ce3c2044ccdf0b85d99895ada5dd9b151e4296dd02560df
4
+ data.tar.gz: '028c8a45076c258ecb086df992ba825d618e3775ceffccbbba6fe56c0b8e936d'
5
5
  SHA512:
6
- metadata.gz: 90f4a2e682d5d0575ea805a1adc4a0bde6aaf65bb592093c4c98a8122eab250960f90547c9c64ac17724331933ba040a5fb4d60b7bab8b800cc87d01af6cbbf5
7
- data.tar.gz: 2a44d15f9f3d820cd44c807cdaab752bd116b2e0ba30dac1dcfdee66f5e1e47828b9c507008948d2baef396cf5ccb780ae4b0c328bf650081ad2f3c5feaa8c78
6
+ metadata.gz: fad49a6fa76abfda7e777b17cd5211fac506d19a173ea4d3cd6be8b36714f90e26cd6c7d8badffc2c267bcead8664d91c5883ebd8603b2c3f1d13bf2ca86ed5b
7
+ data.tar.gz: 69a327d5234349c0d67593a12e7657ac06285dc60a93542c753b60dc5d03561a62bf4b5ef27187904ce5965e12a00e142db17ec8329c03ec202aba092151c144
@@ -66,7 +66,7 @@ export function useTableState({
66
66
  const setExpanded = expandedControl ? expandedControl.onChange : setLocalExpanded;
67
67
  const columnVisibility = (columnVisibilityControl && columnVisibilityControl.value) ? columnVisibilityControl.value : localColumnVisibility;
68
68
  const setColumnVisibility = (columnVisibilityControl && columnVisibilityControl.onChange) ? columnVisibilityControl.onChange : setLocalColumnVisibility;
69
- const rowPinning = loading ? { top: [] } : (pinnedRows?.value ?? localRowPinning);
69
+ const rowPinning = pinnedRows?.value ?? localRowPinning
70
70
  const onRowPinningChange = pinnedRows?.onChange ?? setLocalRowPinning
71
71
 
72
72
  // Virtualized data handling (chunked loading)
@@ -180,29 +180,8 @@ export function useTableState({
180
180
  ...tableOptions,
181
181
  });
182
182
 
183
- // Create a stable hash of the data to detect changes
184
- const dataHash = useMemo(() => {
185
- if (loading) return '';
186
- const currentData = virtualizedRows ? dataChunk : tableData;
187
- return currentData.map(row => row.id).join(',');
188
- }, [tableData, dataChunk, virtualizedRows, loading]);
189
-
190
- const [prevDataHash, setPrevDataHash] = useState(dataHash);
191
-
192
- // Clear pins when data actually changes (by ID composition)
193
- useEffect(() => {
194
- if (loading) return;
195
-
196
- if (dataHash !== prevDataHash) {
197
- setPrevDataHash(dataHash);
198
- onRowPinningChange({ top: [] });
199
- }
200
- }, [dataHash, prevDataHash, loading, onRowPinningChange]);
201
-
202
183
  // Handle row pinning changes
203
- useEffect(() => {
204
- if (loading) return;
205
-
184
+ useEffect(() => {
206
185
  const topPins = pinnedRows?.value?.top ?? [];
207
186
  if (topPins.length === 0) {
208
187
  onRowPinningChange({ top: [] });
@@ -219,7 +198,7 @@ export function useTableState({
219
198
  }
220
199
  });
221
200
  onRowPinningChange({ top: allPinned });
222
- }, [table, pinnedRows?.value?.top?.join(','), loading]);
201
+ }, [table, pinnedRows?.value?.top?.join(',')]);
223
202
 
224
203
  // Check if table has any sub-rows
225
204
  const hasAnySubRows = table.getRowModel().rows.some(row => row.subRows && row.subRows.length > 0);
@@ -12,7 +12,6 @@ examples:
12
12
  - advanced_table_custom_cell_rails: Custom Components for Cells
13
13
  - advanced_table_column_headers: Multi-Header Columns
14
14
  - advanced_table_column_headers_multiple: Multi-Header Columns (Multiple Levels)
15
- - advanced_table_column_border_color_rails: Column Group Border Color
16
15
  - advanced_table_no_subrows: Table with No Subrows or Expansion
17
16
  - advanced_table_selectable_rows_rails: Selectable Rows
18
17
  - advanced_table_selectable_rows_no_subrows_rails: Selectable Rows (No Subrows)
@@ -21,10 +20,11 @@ examples:
21
20
  - advanced_table_scrollbar_none: Advanced Table Scrollbar None
22
21
  - advanced_table_column_styling_rails: Column Styling
23
22
  - advanced_table_column_styling_column_headers_rails: Column Styling with Multiple Headers
23
+ - advanced_table_column_border_color_rails: Column Group Border Color
24
+
24
25
 
25
26
  react:
26
27
  - advanced_table_default: Default (Required Props)
27
- - advanced_table_loading: Loading State
28
28
  - advanced_table_sort: Enable Sorting
29
29
  - advanced_table_sort_control: Sort Control
30
30
  - advanced_table_custom_sort: Custom Sort
@@ -38,30 +38,31 @@ examples:
38
38
  - advanced_table_table_props_sticky_header: Sticky Header for Responsive Table
39
39
  - advanced_table_sticky_columns: Sticky Columns
40
40
  - advanced_table_sticky_columns_and_header: Sticky Columns with Sticky Header
41
- - advanced_table_inline_row_loading: Inline Row Loading
42
41
  - advanced_table_responsive: Responsive Tables
43
42
  - advanced_table_custom_cell: Custom Components for Cells
44
43
  - advanced_table_with_custom_header: Custom Header Cell
45
44
  - advanced_table_pagination: Pagination
46
45
  - advanced_table_pagination_with_props: Pagination Props
46
+ - advanced_table_loading: Loading State
47
+ - advanced_table_inline_row_loading: Inline Row Loading
47
48
  - advanced_table_column_headers: Multi-Header Columns
48
49
  - advanced_table_column_headers_multiple: Multi-Header Columns (Multiple Levels)
49
50
  - advanced_table_column_headers_custom_cell: Multi-Header Columns with Custom Cells
50
- - advanced_table_column_border_color: Column Group Border Color
51
51
  - advanced_table_no_subrows: Table with No Subrows or Expansion
52
+ - advanced_table_pinned_rows: Pinned Rows
52
53
  - advanced_table_selectable_rows: Selectable Rows
53
54
  - advanced_table_selectable_rows_no_subrows_react: Selectable Rows (No Subrows)
54
55
  - advanced_table_selectable_rows_actions: Selectable Rows (With Actions)
55
56
  - advanced_table_selectable_rows_header: Selectable Rows (No Actions Bar)
56
57
  - advanced_table_inline_editing: Inline Cell Editing
57
- - advanced_table_fullscreen: Fullscreen
58
58
  - advanced_table_column_visibility: Column Visibility Control
59
59
  - advanced_table_column_visibility_with_state: Column Visibility Control With State
60
60
  - advanced_table_column_visibility_custom: Column Visibility Control with Custom Dropdown
61
61
  - advanced_table_column_visibility_multi: Column Visibility Control with Multi-Header Columns
62
- - advanced_table_pinned_rows: Pinned Rows
63
62
  - advanced_table_scrollbar_none: Advanced Table Scrollbar None
64
63
  - advanced_table_row_styling: Row Styling
65
64
  - advanced_table_column_styling: Column Styling
66
65
  - advanced_table_column_styling_column_headers: Column Styling with Multiple Headers
66
+ - advanced_table_column_border_color: Column Group Border Color
67
+ - advanced_table_fullscreen: Fullscreen
67
68
  - advanced_table_infinite_scroll: Infinite Scroll
@@ -5,7 +5,7 @@
5
5
  @import "../tokens/typography";
6
6
 
7
7
  [class^=pb_badge_kit] {
8
- $pb_badge_height: 18px;
8
+ $pb_badge_height_rounded: 16px;
9
9
 
10
10
  display: inline-flex;
11
11
  align-items: center;
@@ -13,7 +13,6 @@
13
13
  border-radius: $border_rad_light;
14
14
  padding: 0 $space_xs/2;
15
15
  border-width: 1px;
16
- border-style: solid;
17
16
  border-color: $card_light;
18
17
  white-space: nowrap;
19
18
 
@@ -31,10 +30,10 @@
31
30
  }
32
31
 
33
32
  &[class*=_rounded] {
34
- height: $pb_badge_height;
35
- min-height: $pb_badge_height;
36
- min-width: $pb_badge_height;
37
- border-radius: $pb_badge_height / 2;
33
+ height: $pb_badge_height_rounded;
34
+ min-height: $pb_badge_height_rounded;
35
+ min-width: $pb_badge_height_rounded;
36
+ border-radius: $pb_badge_height_rounded / 2;
38
37
  }
39
38
 
40
39
  &[class*=_notification] {
@@ -0,0 +1,106 @@
1
+ import colors from '../tokens/exports/_colors.module.scss'
2
+ import typography from '../tokens/exports/_typography.module.scss'
3
+
4
+ const barGraphTheme = {
5
+ title: {
6
+ text: "",
7
+ style: {
8
+ color: colors.text_lt_default,
9
+ fontFamily: typography.font_family_base,
10
+ fontWeight: typography.bold,
11
+ fontSize: typography.heading_3,
12
+ },
13
+ },
14
+ subtitle: {
15
+ text: "",
16
+ style: {
17
+ fontFamily: typography.font_family_base,
18
+ color: colors.text_lt_light,
19
+ fontWeight: typography.regular,
20
+ fontSize: typography.text_base,
21
+ },
22
+ },
23
+ chart: {
24
+ type: "column",
25
+ },
26
+ tooltip: {
27
+ backgroundColor: {
28
+ linearGradient: { x1: 0, y1: 0, x2: 0, y2: 1 },
29
+ stops: [
30
+ [0, colors.bg_dark],
31
+ [1, colors.bg_dark],
32
+ ],
33
+ },
34
+ style: {
35
+ fontFamily: typography.font_family_base,
36
+ color: colors.text_dk_default,
37
+ fontWeight: typography.regular,
38
+ fontSize: typography.text_smaller,
39
+ },
40
+ },
41
+ colors: [
42
+ colors.data_1,
43
+ colors.data_2,
44
+ colors.data_3,
45
+ colors.data_4,
46
+ colors.data_5,
47
+ colors.data_6,
48
+ colors.data_7,
49
+ ],
50
+ credits: { enabled: false },
51
+ legend: {
52
+ enabled: false,
53
+ itemStyle: {
54
+ color: colors.text_lt_light,
55
+ fill: colors.text_lt_light,
56
+ fontSize: typography.text_smaller,
57
+ },
58
+ },
59
+ xAxis: {
60
+ gridLineWidth: 0,
61
+ lineColor: colors.border_light,
62
+ tickColor: colors.border_light,
63
+ labels: {
64
+ style: {
65
+ fontFamily: typography.font_family_base,
66
+ color: colors.text_lt_lighter,
67
+ fontWeight: typography.bold,
68
+ fontSize: typography.text_smaller,
69
+ },
70
+ },
71
+ title: {
72
+ style: {
73
+ color: colors.text_lt_default,
74
+ fontFamily: typography.font_family_base,
75
+ fontWeight: typography.regular,
76
+ fontSize: typography.heading_4,
77
+ },
78
+ },
79
+ },
80
+ yAxis: {
81
+ alternateGridColor: undefined as string | undefined,
82
+ minorTickInterval: null as number | null,
83
+ gridLineColor: colors.border_light,
84
+ minorGridLineColor: colors.border_light,
85
+ lineWidth: 0,
86
+ tickWidth: 0,
87
+ labels: {
88
+ style: {
89
+ fontFamily: typography.font_family_base,
90
+ color: colors.text_lt_lighter,
91
+ fontWeight: typography.bold,
92
+ fontSize: typography.text_smaller,
93
+ },
94
+ },
95
+ title: {
96
+ style: {
97
+ fontFamily: typography.font_family_base,
98
+ color: colors.text_lt_lighter,
99
+ fontWeight: typography.bold,
100
+ fontSize: typography.text_smaller,
101
+ },
102
+ },
103
+ },
104
+ }
105
+
106
+ export default barGraphTheme;
@@ -1,6 +1,10 @@
1
1
  import React from 'react'
2
+ import colors from '../../tokens/exports/_colors.module.scss'
3
+ import barGraphTheme from '../barGraphTheme';
4
+ import Highcharts from "highcharts";
5
+ import HighchartsReact from "highcharts-react-official";
6
+
2
7
 
3
- import BarGraph from '../_bar_graph'
4
8
 
5
9
  const chartData = [{
6
10
  name: 'Installation',
@@ -19,19 +23,33 @@ const chartData = [{
19
23
  data: [1111, 677, 3245, 500, 200],
20
24
  }]
21
25
 
22
- const BarGraphColors = (props) => (
23
- <div>
24
- <BarGraph
25
- axisTitle="Number of Employees"
26
- chartData={chartData}
27
- colors={['data-4', 'data-5', 'data-6', 'data-7', 'data-8']}
28
- id="bar-colors"
29
- title="Bar Graph with Custom Data Colors"
30
- xAxisCategories={['Jan', 'Feb', 'Mar', 'Apr', 'May']}
31
- yAxisMin={0}
32
- {...props}
33
- />
34
- </div>
35
- )
26
+ const chartOptions = {
27
+ series: chartData,
28
+ title: {
29
+ text: "Bar Graph with Custom Data Colors",
30
+ },
31
+ xAxis: {
32
+ categories: ["Jan", "Feb", "Mar", "Apr", "May"],
33
+ },
34
+ yAxis: {
35
+ title: {
36
+ text: "Number of Employees",
37
+ },
38
+ },
39
+ colors: [colors.data_4, colors.data_5, colors.data_6, colors.data_7, colors.data_8],
40
+ }
41
+
42
+ const BarGraphColors = () => {
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
+ }
36
54
 
37
55
  export default BarGraphColors
@@ -1,6 +1,8 @@
1
1
  import React from 'react'
2
+ import barGraphTheme from '../barGraphTheme';
3
+ import Highcharts from "highcharts";
4
+ import HighchartsReact from "highcharts-react-official";
2
5
 
3
- import BarGraph from '../_bar_graph'
4
6
 
5
7
  const chartData = [{
6
8
  name: 'Installation',
@@ -19,19 +21,35 @@ const chartData = [{
19
21
  data: [1111, 677, 3245, 500, 200],
20
22
  }]
21
23
 
22
- const BarGraphDefault = (props) => (
23
- <div>
24
- <BarGraph
25
- axisTitle="Number of Employees"
26
- chartData={chartData}
27
- id="bar-default"
28
- subTitle="Source: thesolarfoundation.com"
29
- title="Solar Employment Growth by Sector, 2010-2016"
30
- xAxisCategories={['Jan', 'Feb', 'Mar', 'Apr', 'May']}
31
- yAxisMin={0}
32
- {...props}
33
- />
34
- </div>
35
- )
24
+ const chartOptions = {
25
+ series: chartData,
26
+ title: {
27
+ text: 'Solar Employment Growth by Sector, 2010-2016',
28
+ },
29
+ subtitle: {
30
+ text: 'Source: thesolarfoundation.com',
31
+ },
32
+ xAxis: {
33
+ categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May'],
34
+ },
35
+ yAxis: {
36
+ title: {
37
+ text: 'Number of Employees',
38
+ },
39
+ },
40
+ }
41
+
42
+ const BarGraphDefault = () => {
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
+ }
36
54
 
37
55
  export default BarGraphDefault
@@ -1,39 +1,69 @@
1
1
  import React from 'react'
2
+ import barGraphTheme from '../barGraphTheme';
3
+ import Highcharts from "highcharts";
4
+ import HighchartsReact from "highcharts-react-official";
2
5
 
3
- import BarGraph from '../_bar_graph'
4
6
 
5
7
  const chartData = [{
6
8
  name: 'Number of Installations',
7
9
  data: [1475, 200, 3000, 654, 656],
8
10
  }]
9
11
 
10
- const BarGraphDefault = (props) => (
12
+ const pixelHeightChartOptions = {
13
+ chart: {
14
+ height: "300"
15
+ },
16
+ series: chartData,
17
+ title: {
18
+ text: "Fixed Height (300px)",
19
+ },
20
+ xAxis: {
21
+ categories: ["Jan", "Feb", "Mar", "Apr", "May"],
22
+ },
23
+ yAxis: {
24
+ title: {
25
+ text: "Number of Employees",
26
+ },
27
+ },
28
+ };
29
+
30
+ const percentageHeightChartOptions = {
31
+ chart: {
32
+ height: "50%"
33
+ },
34
+ series: chartData,
35
+ title: {
36
+ text: "Percentage Height (50%)",
37
+ },
38
+ xAxis: {
39
+ categories: ["Jan", "Feb", "Mar", "Apr", "May"],
40
+ },
41
+ yAxis: {
42
+ title: {
43
+ text: "Number of Employees",
44
+ },
45
+ },
46
+ };
47
+
48
+ const pixelOptions = Highcharts.merge({}, barGraphTheme, pixelHeightChartOptions)
49
+
50
+ const percentageOptions = Highcharts.merge({}, barGraphTheme, percentageHeightChartOptions)
51
+
52
+ const BarGraphHeight = () => (
11
53
  <div>
12
- <BarGraph
13
- axisTitle="Number of Employees"
14
- chartData={chartData}
15
- height="300"
16
- id="bar-fixed-height"
17
- title="Fixed Height (300px)"
18
- xAxisCategories={['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']}
19
- yAxisMin={0}
20
- {...props}
21
- />
54
+ <HighchartsReact
55
+ highcharts={Highcharts}
56
+ options={pixelOptions}
57
+ />
22
58
 
23
59
  <br />
24
60
  <br />
25
61
 
26
- <BarGraph
27
- axisTitle="Number of Employees"
28
- chartData={chartData}
29
- height="50%"
30
- id="bar-percentage-height"
31
- title="Percentage Height (50%)"
32
- xAxisCategories={['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']}
33
- yAxisMin={0}
34
- {...props}
62
+ <HighchartsReact
63
+ highcharts={Highcharts}
64
+ options={percentageOptions}
35
65
  />
36
66
  </div>
37
67
  )
38
68
 
39
- export default BarGraphDefault
69
+ export default BarGraphHeight
@@ -0,0 +1,3 @@
1
+ By default, Highcharts have a height of 400px, but this can be customized. You can override the default by specifying either a percentage or a fixed pixel value.
2
+
3
+ Using a percentage maintains a consistent aspect ratio across different responsive sizes. For example, setting the height to 50% makes the chart’s height half of its width.
@@ -1,9 +1,10 @@
1
1
  import React from 'react'
2
+ import barGraphTheme from '../barGraphTheme';
3
+ import Highcharts from "highcharts";
4
+ import HighchartsReact from "highcharts-react-official";
2
5
 
3
- import BarGraph from '../_bar_graph'
4
6
 
5
-
6
- const barGraphOptions = {
7
+ const chartOptions = {
7
8
  chart: {
8
9
  type: 'bar'
9
10
  },
@@ -22,13 +23,8 @@ const barGraphOptions = {
22
23
  lineWidth: 0
23
24
  },
24
25
  yAxis: {
25
- min: 0,
26
26
  title: {
27
- text: 'Population (millions)',
28
- align: 'high'
29
- },
30
- labels: {
31
- overflow: 'justify'
27
+ text: '',
32
28
  },
33
29
  },
34
30
  tooltip: {
@@ -51,16 +47,16 @@ const barGraphOptions = {
51
47
  }, {
52
48
  name: 'Year 2018',
53
49
  data: [1276, 1007, 4561, 746]
54
- }]
50
+ }],
55
51
  }
56
52
 
57
- const BarGraphHorizontal = (props) => (
53
+ const options = Highcharts.merge({}, barGraphTheme, chartOptions)
54
+
55
+ const BarGraphHorizontal = () => (
58
56
  <div>
59
- <BarGraph
60
- customOptions={barGraphOptions}
61
- id="bar-horizontal"
62
- yAxisMin={0}
63
- {...props}
57
+ <HighchartsReact
58
+ highcharts={Highcharts}
59
+ options={options}
64
60
  />
65
61
  </div>
66
62
  )
@@ -1,24 +1,40 @@
1
1
  import React from 'react'
2
- import BarGraph from "../../pb_bar_graph/_bar_graph"
2
+ import barGraphTheme from '../barGraphTheme';
3
+ import Highcharts from "highcharts";
4
+ import HighchartsReact from "highcharts-react-official";
5
+
3
6
 
4
7
  const chartData = [{
5
8
  name: 'Number of Installations',
6
9
  data: [1475, 200, 3000, 654, 656],
7
10
  }]
8
11
 
9
- const BarGraphLegend = (props) => (
10
- <div>
11
- <BarGraph
12
- axisTitle="Number of Employees"
13
- chartData={chartData}
14
- id="bar-test-2"
15
- legend
16
- title="Bar Graph with Legend"
17
- xAxisCategories={['Jan', 'Feb', 'Mar', 'Apr', 'May']}
18
- yAxisMin={0}
19
- {...props}
20
- />
21
- </div>
22
- )
12
+ const chartOptions = {
13
+ series: chartData,
14
+ title: {
15
+ text: 'Bar Graph with Legend',
16
+ },
17
+ xAxis: {
18
+ categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May'],
19
+ },
20
+ yAxis: {
21
+ title: {
22
+ text: 'Number of Employees',
23
+ },
24
+ },
25
+ legend: { enabled: true },
26
+ }
23
27
 
28
+ const BarGraphLegend = () => {
29
+ const options = Highcharts.merge({}, barGraphTheme, chartOptions)
30
+
31
+ return (
32
+ <div>
33
+ <HighchartsReact
34
+ highcharts={Highcharts}
35
+ options={options}
36
+ />
37
+ </div>
38
+ )
39
+ }
24
40
  export default BarGraphLegend
@@ -1,25 +1,48 @@
1
1
  import React from 'react'
2
- import BarGraph from "../../pb_bar_graph/_bar_graph"
2
+ import barGraphTheme from '../barGraphTheme';
3
+ import Highcharts from "highcharts";
4
+ import HighchartsReact from "highcharts-react-official";
5
+
3
6
 
4
7
  const chartData = [{
5
8
  name: 'Number of Installations',
6
9
  data: [1475, 200, 3000, 654, 656],
7
10
  }]
8
11
 
9
- const BarGraphLegendNonClickable = (props) => (
10
- <div>
11
- <BarGraph
12
- axisTitle="Number of Employees"
13
- chartData={chartData}
14
- id="bar-test-3"
15
- legend
16
- title="Bar Graph with Legend Non Clickable"
17
- toggleLegendClick={false}
18
- xAxisCategories={['Jan', 'Feb', 'Mar', 'Apr', 'May']}
19
- yAxisMin={0}
20
- {...props}
21
- />
22
- </div>
23
- )
12
+ const chartOptions = {
13
+ title: {
14
+ text: 'Bar Graph with Legend Non Clickable',
15
+ },
16
+ xAxis: {
17
+ categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May'],
18
+ },
19
+ yAxis: {
20
+ title: {
21
+ text: 'Number of Employees',
22
+ },
23
+ },
24
+ legend: {
25
+ enabled: true,
26
+ events: {
27
+ itemClick: function () {
28
+ return false;
29
+ }
30
+ }
31
+ },
32
+ series: chartData
33
+ }
34
+
35
+ const BarGraphLegendNonClickable = () => {
36
+ const options = Highcharts.merge({}, barGraphTheme, chartOptions)
37
+
38
+ return (
39
+ <div>
40
+ <HighchartsReact
41
+ highcharts={Highcharts}
42
+ options={options}
43
+ />
44
+ </div>
45
+ )
46
+ }
24
47
 
25
48
  export default BarGraphLegendNonClickable