playbook_ui 14.22.0.pre.alpha.PLAY2292advancedtablepinnedrowsloading8633 → 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.
- checksums.yaml +4 -4
- data/app/pb_kits/playbook/pb_advanced_table/Hooks/useTableState.ts +13 -77
- data/app/pb_kits/playbook/pb_advanced_table/docs/example.yml +7 -6
- data/app/pb_kits/playbook/pb_badge/_badge.scss +5 -6
- data/app/pb_kits/playbook/pb_bar_graph/barGraphTheme.ts +106 -0
- data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_colors.jsx +33 -15
- data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_default.jsx +33 -15
- data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_height.jsx +52 -22
- data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_height.md +3 -0
- data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_horizontal.jsx +12 -16
- data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_legend.jsx +31 -15
- data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_legend_non_clickable.jsx +39 -16
- data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_legend_position.jsx +86 -38
- data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_negative_numbers.jsx +32 -15
- data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_secondary_y_axis.jsx +72 -22
- data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_secondary_y_axis.md +1 -1
- data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_spline.jsx +31 -15
- data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_stacked.jsx +37 -16
- data/app/pb_kits/playbook/pb_bar_graph/docs/_description.md +1 -3
- data/app/pb_kits/playbook/pb_bar_graph/docs/example.yml +1 -3
- data/app/pb_kits/playbook/pb_bar_graph/docs/index.js +0 -2
- data/app/pb_kits/playbook/pb_body/docs/_body_truncate.jsx +3 -3
- data/app/pb_kits/playbook/pb_body/docs/_body_truncate_react.md +4 -0
- data/app/pb_kits/playbook/pb_circle_chart/circleChartTheme.ts +36 -1
- data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_block.jsx +71 -26
- data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_colors.jsx +29 -16
- data/app/pb_kits/playbook/pb_circle_chart/docs/{_circle_chart_colors.md → _circle_chart_colors_rails.md} +1 -1
- data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_colors_react.md +2 -0
- data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_custom_tooltip.jsx +28 -16
- data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_custom_tooltip.md +4 -2
- data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_default.jsx +23 -15
- data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_inner_sizes.jsx +81 -51
- data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_legend_position.jsx +103 -75
- data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_legend_position.md +3 -6
- data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_live_data.jsx +19 -13
- data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_rounded.jsx +30 -17
- data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_with_labels.jsx +34 -20
- data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_with_legend_kit.jsx +29 -20
- data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_with_title.jsx +28 -20
- data/app/pb_kits/playbook/pb_circle_chart/docs/_description.md +1 -0
- data/app/pb_kits/playbook/pb_circle_chart/docs/example.yml +0 -1
- data/app/pb_kits/playbook/pb_circle_chart/docs/index.js +0 -1
- data/app/pb_kits/playbook/pb_draggable/context/index.tsx +12 -4
- data/app/pb_kits/playbook/pb_draggable/context/types.ts +5 -2
- data/app/pb_kits/playbook/pb_phone_number_input/_phone_number_input.tsx +27 -17
- data/app/pb_kits/playbook/pb_title/docs/_title_truncate.jsx +3 -3
- data/app/pb_kits/playbook/pb_title/docs/_title_truncate_react.md +4 -0
- data/app/pb_kits/playbook/pb_tooltip/docs/_tooltip_click_open.html.erb +14 -0
- data/app/pb_kits/playbook/pb_tooltip/docs/_tooltip_click_open_rails.md +1 -0
- data/app/pb_kits/playbook/pb_tooltip/docs/example.yml +1 -0
- data/app/pb_kits/playbook/pb_tooltip/index.js +59 -36
- data/app/pb_kits/playbook/pb_tooltip/tooltip.rb +9 -2
- data/dist/chunks/_circle_chart-BZmlhBs2.js +1 -0
- data/dist/chunks/{_typeahead-B7FRYVtS.js → _typeahead-B1tu_vWi.js} +3 -3
- data/dist/chunks/{_weekday_stacked-B1tUFAcP.js → _weekday_stacked-CKk0dR5s.js} +2 -2
- data/dist/chunks/{lib-Carqm8Ip.js → lib-DYpq0k8j.js} +1 -1
- data/dist/chunks/{pb_form_validation-DqRmTS8m.js → pb_form_validation-BUOKwfvW.js} +1 -1
- data/dist/chunks/vendor.js +1 -1
- data/dist/menu.yml +68 -8
- 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 +19 -16
- data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_custom.jsx +0 -72
- data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_custom.md +0 -6
- data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_pb_styles.jsx +0 -64
- data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_pb_styles.md +0 -1
- data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_pb_styles.jsx +0 -38
- data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_pb_styles.md +0 -1
- /data/app/pb_kits/playbook/pb_body/docs/{_body_truncate.md → _body_truncate_rails.md} +0 -0
- /data/app/pb_kits/playbook/pb_title/docs/{_title_truncate.md → _title_truncate_rails.md} +0 -0
- /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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3672cfbb818cbb482ce3c2044ccdf0b85d99895ada5dd9b151e4296dd02560df
|
4
|
+
data.tar.gz: '028c8a45076c258ecb086df992ba825d618e3775ceffccbbba6fe56c0b8e936d'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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 =
|
69
|
+
const rowPinning = pinnedRows?.value ?? localRowPinning
|
70
70
|
const onRowPinningChange = pinnedRows?.onChange ?? setLocalRowPinning
|
71
71
|
|
72
72
|
// Virtualized data handling (chunked loading)
|
@@ -180,89 +180,25 @@ 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
|
-
// Synchronously clear pins when data changes to prevent table errors
|
193
|
-
if (!loading && dataHash !== prevDataHash) {
|
194
|
-
setPrevDataHash(dataHash);
|
195
|
-
|
196
|
-
const currentPins = pinnedRows?.value?.top ?? [];
|
197
|
-
if (currentPins.length > 0) {
|
198
|
-
try {
|
199
|
-
const currentData = virtualizedRows ? dataChunk : tableData;
|
200
|
-
const validPins = currentPins.filter(id =>
|
201
|
-
currentData.some(row => row.id === id)
|
202
|
-
);
|
203
|
-
|
204
|
-
if (validPins.length !== currentPins.length) {
|
205
|
-
onRowPinningChange({ top: validPins });
|
206
|
-
}
|
207
|
-
} catch (error) {
|
208
|
-
console.warn('Error validating pins on data change, clearing pins:', error);
|
209
|
-
onRowPinningChange({ top: [] });
|
210
|
-
}
|
211
|
-
}
|
212
|
-
}
|
213
|
-
|
214
183
|
// Handle row pinning changes
|
215
|
-
|
216
|
-
if (loading) return;
|
217
|
-
|
184
|
+
useEffect(() => {
|
218
185
|
const topPins = pinnedRows?.value?.top ?? [];
|
219
186
|
if (topPins.length === 0) {
|
220
187
|
onRowPinningChange({ top: [] });
|
221
188
|
return;
|
222
189
|
}
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
console.warn(`Pinned row with id ${id} not found in current dataset`);
|
232
|
-
return false;
|
233
|
-
}
|
234
|
-
});
|
235
|
-
|
236
|
-
if (validPinnedIds.length === 0) {
|
237
|
-
onRowPinningChange({ top: [] });
|
238
|
-
return;
|
239
|
-
}
|
240
|
-
|
241
|
-
const collectAllDescendantIds = (subs: Row<GenericObject>[]): string[] =>
|
242
|
-
subs.flatMap(r => [r.id, ...collectAllDescendantIds(r.subRows)]);
|
243
|
-
|
244
|
-
const allPinned: string[] = [];
|
245
|
-
|
246
|
-
validPinnedIds.forEach(id => {
|
247
|
-
const parent = rows.find(r => r.id === id && r.depth === 0);
|
248
|
-
if (parent) {
|
249
|
-
allPinned.push(parent.id, ...collectAllDescendantIds(parent.subRows));
|
250
|
-
}
|
251
|
-
});
|
252
|
-
|
253
|
-
const currentPins = pinnedRows?.value?.top ?? [];
|
254
|
-
const pinsChanged = allPinned.length !== currentPins.length ||
|
255
|
-
!allPinned.every(id => currentPins.includes(id));
|
256
|
-
|
257
|
-
if (pinsChanged) {
|
258
|
-
onRowPinningChange({ top: allPinned });
|
190
|
+
const rows = table.getRowModel().rows;
|
191
|
+
const collectAllDescendantIds = (subs: Row<GenericObject>[]): string[] =>
|
192
|
+
subs.flatMap(r => [r.id, ...collectAllDescendantIds(r.subRows)]);
|
193
|
+
const allPinned: string[] = [];
|
194
|
+
topPins.forEach(id => {
|
195
|
+
const parent = rows.find(r => r.id === id && r.depth === 0);
|
196
|
+
if (parent) {
|
197
|
+
allPinned.push(parent.id, ...collectAllDescendantIds(parent.subRows));
|
259
198
|
}
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
onRowPinningChange({ top: [] });
|
264
|
-
}
|
265
|
-
}, [table, pinnedRows?.value?.top?.join(','), loading]);
|
199
|
+
});
|
200
|
+
onRowPinningChange({ top: allPinned });
|
201
|
+
}, [table, pinnedRows?.value?.top?.join(',')]);
|
266
202
|
|
267
203
|
// Check if table has any sub-rows
|
268
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
|
-
$
|
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: $
|
35
|
-
min-height: $
|
36
|
-
min-width: $
|
37
|
-
border-radius: $
|
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
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
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
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
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
|
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
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
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
|
-
<
|
27
|
-
|
28
|
-
|
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
|
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: '
|
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
|
53
|
+
const options = Highcharts.merge({}, barGraphTheme, chartOptions)
|
54
|
+
|
55
|
+
const BarGraphHorizontal = () => (
|
58
56
|
<div>
|
59
|
-
<
|
60
|
-
|
61
|
-
|
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
|
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
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
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
|