playbook_ui 13.12.0.pre.alpha.PLAY880cardkithighlightzindex1655 → 13.12.0.pre.alpha.PLAY1051removinghighchartsdependency1551
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_bar_graph/_bar_graph.tsx +36 -32
- data/app/pb_kits/playbook/pb_card/_card_mixin.scss +1 -0
- data/app/pb_kits/playbook/pb_circle_chart/_circle_chart.tsx +67 -63
- data/app/pb_kits/playbook/pb_gauge/_gauge.tsx +57 -46
- data/app/pb_kits/playbook/pb_line_graph/_line_graph.tsx +39 -34
- data/app/pb_kits/playbook/pb_multiple_users/docs/example.yml +0 -6
- data/app/pb_kits/playbook/pb_multiple_users_stacked/docs/example.yml +0 -6
- data/app/pb_kits/playbook/pb_text_input/docs/example.yml +0 -7
- data/app/pb_kits/playbook/pb_toggle/docs/example.yml +0 -4
- data/app/pb_kits/playbook/pb_treemap_chart/_treemap_chart.tsx +33 -28
- data/dist/playbook-rails.js +7 -7
- data/lib/playbook/version.rb +1 -1
- metadata +2 -18
- data/app/pb_kits/playbook/pb_multiple_users/docs/_multiple_users_default_swift.md +0 -11
- data/app/pb_kits/playbook/pb_multiple_users/docs/_multiple_users_props_swift.md +0 -7
- data/app/pb_kits/playbook/pb_multiple_users/docs/_multiple_users_reverse_swift.md +0 -13
- data/app/pb_kits/playbook/pb_multiple_users/docs/_multiple_users_size_swift.md +0 -11
- data/app/pb_kits/playbook/pb_multiple_users_stacked/docs/_multiple_users_stacked_default_swift.md +0 -15
- data/app/pb_kits/playbook/pb_multiple_users_stacked/docs/_multiple_users_stacked_props_swift.md +0 -5
- data/app/pb_kits/playbook/pb_multiple_users_stacked/docs/_multiple_users_stacked_small_swift.md +0 -15
- data/app/pb_kits/playbook/pb_multiple_users_stacked/docs/_multiple_users_stacked_xsmall_swift.md +0 -15
- data/app/pb_kits/playbook/pb_text_input/docs/_text_input_add_on_swift.md +0 -35
- data/app/pb_kits/playbook/pb_text_input/docs/_text_input_default_swift.md +0 -29
- data/app/pb_kits/playbook/pb_text_input/docs/_text_input_disabled_swift.md +0 -13
- data/app/pb_kits/playbook/pb_text_input/docs/_text_input_error_swift.md +0 -24
- data/app/pb_kits/playbook/pb_text_input/docs/_text_input_props_swift.md +0 -13
- data/app/pb_kits/playbook/pb_toggle/docs/_toggle_default_swift.md +0 -11
- data/app/pb_kits/playbook/pb_toggle/docs/_toggle_name_swift.md +0 -10
- data/app/pb_kits/playbook/pb_toggle/docs/_toggle_props_swift.md +0 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4a59ab1213c1c17a6ab6bfa775d7ac7edf06972be95d950e479f16b8cafc4216
|
4
|
+
data.tar.gz: cb50f83ac242358db6b9e951ba8d7fa7bfee32ff78c02eef0b0829ed5e97a0d7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 53af5b80de72a1f40570fd93a05f1a5282d9c79cfa04b007ecfc7e04ee31bfaa27d2202467edaf02ca50ea05173faccc0fb5b2207e16cf936957eaf8bd4b3338
|
7
|
+
data.tar.gz: 287e8051ab76bba6451b8c76ba3df6d95d1d7cfd4f4de33ae82b5745345294903e40fd74510c1b740b40395d6193f5c2c24c285980b116873a381917fdd146f7
|
@@ -3,7 +3,6 @@ import { globalProps } from "../utilities/globalProps";
|
|
3
3
|
import { buildAriaProps, buildDataProps } from "../utilities/props";
|
4
4
|
|
5
5
|
import HighchartsReact from "highcharts-react-official";
|
6
|
-
import Highcharts from "highcharts";
|
7
6
|
import { highchartsTheme } from "../pb_dashboard/pbChartsLightTheme";
|
8
7
|
import { highchartsDarkTheme } from "../pb_dashboard/pbChartsDarkTheme";
|
9
8
|
import mapColors from "../pb_dashboard/pbChartsColorsHelper";
|
@@ -11,32 +10,31 @@ import mapColors from "../pb_dashboard/pbChartsColorsHelper";
|
|
11
10
|
import classnames from "classnames";
|
12
11
|
|
13
12
|
type BarGraphProps = {
|
14
|
-
align?: "left" | "right" | "center"
|
15
|
-
axisTitle: string
|
16
|
-
dark?: boolean
|
17
|
-
xAxisCategories: []
|
18
|
-
yAxisMin: number
|
19
|
-
yAxisMax: number
|
20
|
-
chartData: { name: string
|
21
|
-
className?: string
|
22
|
-
id: any
|
23
|
-
pointStart: number | any
|
24
|
-
subTitle?: string
|
25
|
-
title: string
|
26
|
-
type?: string
|
27
|
-
legend?: boolean
|
28
|
-
toggleLegendClick?: boolean
|
29
|
-
height?: string
|
30
|
-
colors: string[]
|
31
|
-
layout?: "horizontal" | "vertical" | "proximate"
|
32
|
-
verticalAlign?: "top" | "middle" | "bottom"
|
33
|
-
x?: number
|
34
|
-
y?: number
|
35
|
-
aria?: { [key: string]: string }
|
36
|
-
data?: { [key: string]: string }
|
13
|
+
align?: "left" | "right" | "center",
|
14
|
+
axisTitle: string,
|
15
|
+
dark?: boolean,
|
16
|
+
xAxisCategories: [],
|
17
|
+
yAxisMin: number,
|
18
|
+
yAxisMax: number,
|
19
|
+
chartData: { name: string, data: number[] }[],
|
20
|
+
className?: string,
|
21
|
+
id: any,
|
22
|
+
pointStart: number | any,
|
23
|
+
subTitle?: string,
|
24
|
+
title: string,
|
25
|
+
type?: string,
|
26
|
+
legend?: boolean,
|
27
|
+
toggleLegendClick?: boolean,
|
28
|
+
height?: string,
|
29
|
+
colors: string[],
|
30
|
+
layout?: "horizontal" | "vertical" | "proximate",
|
31
|
+
verticalAlign?: "top" | "middle" | "bottom",
|
32
|
+
x?: number,
|
33
|
+
y?: number,
|
34
|
+
aria?: { [key: string]: string },
|
35
|
+
data?: { [key: string]: string },
|
37
36
|
};
|
38
37
|
|
39
|
-
|
40
38
|
const BarGraph = ({
|
41
39
|
aria = {},
|
42
40
|
data = {},
|
@@ -65,12 +63,6 @@ const BarGraph = ({
|
|
65
63
|
}: BarGraphProps): React.ReactElement => {
|
66
64
|
const ariaProps = buildAriaProps(aria);
|
67
65
|
const dataProps = buildDataProps(data);
|
68
|
-
const setupTheme = () => {
|
69
|
-
dark
|
70
|
-
? Highcharts.setOptions(highchartsDarkTheme)
|
71
|
-
: Highcharts.setOptions(highchartsTheme);
|
72
|
-
};
|
73
|
-
setupTheme();
|
74
66
|
|
75
67
|
const staticOptions = {
|
76
68
|
title: {
|
@@ -123,12 +115,24 @@ const BarGraph = ({
|
|
123
115
|
}
|
124
116
|
|
125
117
|
const [options, setOptions] = useState({});
|
118
|
+
const [isHighchartsLoaded, setIsHighchartsLoaded] = useState(false)
|
126
119
|
|
127
120
|
useEffect(() => {
|
128
121
|
setOptions({ ...staticOptions });
|
122
|
+
|
123
|
+
const interval = setInterval(() => {
|
124
|
+
if (window.Highcharts) {
|
125
|
+
clearInterval(interval)
|
126
|
+
dark
|
127
|
+
? window.Highcharts.setOptions(highchartsDarkTheme)
|
128
|
+
: window.Highcharts.setOptions(highchartsTheme)
|
129
|
+
setIsHighchartsLoaded(true)
|
130
|
+
}
|
131
|
+
}, 0)
|
129
132
|
}, [chartData]);
|
130
133
|
|
131
134
|
return (
|
135
|
+
isHighchartsLoaded &&
|
132
136
|
<HighchartsReact
|
133
137
|
containerProps={{
|
134
138
|
className: classnames(globalProps(props), className),
|
@@ -136,7 +140,7 @@ const BarGraph = ({
|
|
136
140
|
...ariaProps,
|
137
141
|
...dataProps,
|
138
142
|
}}
|
139
|
-
highcharts={Highcharts}
|
143
|
+
highcharts={window.Highcharts}
|
140
144
|
options={options}
|
141
145
|
/>
|
142
146
|
);
|
@@ -3,8 +3,6 @@ import classnames from "classnames";
|
|
3
3
|
import HighchartsReact from "highcharts-react-official";
|
4
4
|
import highchartsMore from "highcharts/highcharts-more";
|
5
5
|
|
6
|
-
import Highcharts from "highcharts";
|
7
|
-
|
8
6
|
import { highchartsTheme } from "../pb_dashboard/pbChartsLightTheme";
|
9
7
|
import { highchartsDarkTheme } from "../pb_dashboard/pbChartsDarkTheme";
|
10
8
|
import mapColors from "../pb_dashboard/pbChartsColorsHelper";
|
@@ -12,35 +10,35 @@ import { globalProps } from "../utilities/globalProps";
|
|
12
10
|
import { buildAriaProps, buildDataProps } from "../utilities/props";
|
13
11
|
|
14
12
|
type CircleChartProps = {
|
15
|
-
align?: "left" | "right" | "center"
|
16
|
-
aria: { [key: string]: string }
|
17
|
-
chartData?: []
|
18
|
-
children?: Node
|
19
|
-
className?: string
|
20
|
-
colors?: string[]
|
21
|
-
dark?: Boolean
|
22
|
-
data?: Object
|
23
|
-
dataLabelHtml?: string
|
24
|
-
dataLabels?: boolean
|
25
|
-
height?: string
|
26
|
-
id?: string
|
27
|
-
innerSize?: "sm" | "md" | "lg" | "none"
|
28
|
-
legend?: boolean
|
29
|
-
maxPointSize?: number
|
30
|
-
minPointSize?: number
|
31
|
-
rounded?: boolean
|
32
|
-
startAngle?: number
|
33
|
-
style?: string
|
34
|
-
title?: string
|
35
|
-
tooltipHtml: string
|
36
|
-
useHtml?: boolean
|
37
|
-
zMin?: number
|
38
|
-
layout?: "horizontal" | "vertical" | "proximate"
|
39
|
-
verticalAlign?: "top" | "middle" | "bottom"
|
40
|
-
x?: number
|
41
|
-
y?: number
|
42
|
-
borderColor?: string
|
43
|
-
borderWidth?: number
|
13
|
+
align?: "left" | "right" | "center",
|
14
|
+
aria: { [key: string]: string },
|
15
|
+
chartData?: [],
|
16
|
+
children?: Node,
|
17
|
+
className?: string,
|
18
|
+
colors?: string[],
|
19
|
+
dark?: Boolean,
|
20
|
+
data?: Object,
|
21
|
+
dataLabelHtml?: string,
|
22
|
+
dataLabels?: boolean,
|
23
|
+
height?: string,
|
24
|
+
id?: string,
|
25
|
+
innerSize?: "sm" | "md" | "lg" | "none",
|
26
|
+
legend?: boolean,
|
27
|
+
maxPointSize?: number,
|
28
|
+
minPointSize?: number,
|
29
|
+
rounded?: boolean,
|
30
|
+
startAngle?: number,
|
31
|
+
style?: string,
|
32
|
+
title?: string,
|
33
|
+
tooltipHtml: string,
|
34
|
+
useHtml?: boolean,
|
35
|
+
zMin?: number,
|
36
|
+
layout?: "horizontal" | "vertical" | "proximate",
|
37
|
+
verticalAlign?: "top" | "middle" | "bottom",
|
38
|
+
x?: number,
|
39
|
+
y?: number,
|
40
|
+
borderColor?: string,
|
41
|
+
borderWidth?: number,
|
44
42
|
};
|
45
43
|
|
46
44
|
// Adjust Circle Chart Block Kit Dimensions to Match the Chart for Centering
|
@@ -90,29 +88,11 @@ const CircleChart = ({
|
|
90
88
|
}: CircleChartProps) => {
|
91
89
|
const ariaProps = buildAriaProps(aria);
|
92
90
|
const dataProps = buildDataProps(data);
|
93
|
-
highchartsMore(Highcharts);
|
94
|
-
|
95
|
-
const setupTheme = () => {
|
96
|
-
dark
|
97
|
-
? Highcharts.setOptions(highchartsDarkTheme)
|
98
|
-
: Highcharts.setOptions(highchartsTheme);
|
99
|
-
};
|
100
|
-
setupTheme();
|
101
|
-
|
102
|
-
Highcharts.setOptions({
|
103
|
-
tooltip: {
|
104
|
-
headerFormat: null,
|
105
|
-
pointFormat: tooltipHtml ? tooltipHtml : '<span style="font-weight: bold; color:{point.color};">●</span>{point.name}: ' + "<b>{point.y}</b>",
|
106
|
-
useHTML: useHtml,
|
107
|
-
},
|
108
|
-
});
|
109
|
-
|
110
91
|
const innerSizes = { sm: "35%", md: "50%", lg: "85%", none: "0%" };
|
111
|
-
const innerSizeFormat = (size: "sm" | "md" | "lg" | "none") =>
|
112
|
-
innerSizes[size];
|
113
|
-
|
92
|
+
const innerSizeFormat = (size: "sm" | "md" | "lg" | "none") => innerSizes[size];
|
114
93
|
|
115
94
|
const [options, setOptions] = useState({});
|
95
|
+
const [isHighchartsLoaded, setIsHighchartsLoaded] = useState(false);
|
116
96
|
|
117
97
|
useEffect(() => {
|
118
98
|
const formattedChartData = chartData.map((obj: any) => {
|
@@ -169,26 +149,50 @@ const CircleChart = ({
|
|
169
149
|
credits: false,
|
170
150
|
};
|
171
151
|
setOptions({ ...staticOptions });
|
172
|
-
}, [chartData]);
|
173
152
|
|
153
|
+
const interval = setInterval(() => {
|
154
|
+
if (window.Highcharts) {
|
155
|
+
clearInterval(interval)
|
156
|
+
dark
|
157
|
+
? window.Highcharts.setOptions(highchartsDarkTheme)
|
158
|
+
: window.Highcharts.setOptions(highchartsTheme)
|
159
|
+
|
160
|
+
highchartsMore(window.Highcharts);
|
161
|
+
|
162
|
+
window.Highcharts.setOptions({
|
163
|
+
tooltip: {
|
164
|
+
headerFormat: null,
|
165
|
+
pointFormat: tooltipHtml ? tooltipHtml : '<span style="font-weight: bold; color:{point.color};">●</span>{point.name}: ' + "<b>{point.y}</b>",
|
166
|
+
useHTML: useHtml,
|
167
|
+
},
|
168
|
+
});
|
169
|
+
|
170
|
+
setIsHighchartsLoaded(true)
|
171
|
+
}
|
172
|
+
}, 0)
|
173
|
+
}, [chartData]);
|
174
174
|
|
175
175
|
return (
|
176
176
|
<>
|
177
177
|
{children ? (
|
178
178
|
<div id={`wrapper-circle-chart-${id}`}>
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
179
|
+
{
|
180
|
+
isHighchartsLoaded &&
|
181
|
+
<HighchartsReact
|
182
|
+
containerProps={{
|
183
|
+
className: classnames("pb_circle_chart", globalProps(props)),
|
184
|
+
id: id,
|
185
|
+
...ariaProps,
|
186
|
+
...dataProps,
|
187
|
+
}}
|
188
|
+
highcharts={window.Highcharts}
|
189
|
+
options={options}
|
190
|
+
/>
|
191
|
+
}
|
189
192
|
<div className="pb-circle-chart-block">{children}</div>
|
190
193
|
</div>
|
191
194
|
) : (
|
195
|
+
isHighchartsLoaded &&
|
192
196
|
<HighchartsReact
|
193
197
|
containerProps={{
|
194
198
|
className: classnames("pb_circle_chart", globalProps(props)),
|
@@ -196,7 +200,7 @@ const CircleChart = ({
|
|
196
200
|
...ariaProps,
|
197
201
|
...dataProps,
|
198
202
|
}}
|
199
|
-
highcharts={Highcharts}
|
203
|
+
highcharts={window.Highcharts}
|
200
204
|
options={options}
|
201
205
|
/>
|
202
206
|
)}
|
@@ -1,7 +1,6 @@
|
|
1
1
|
import React, { useState, useEffect } from "react";
|
2
2
|
import classnames from "classnames";
|
3
3
|
import HighchartsReact from "highcharts-react-official";
|
4
|
-
import Highcharts from "highcharts";
|
5
4
|
import { highchartsTheme } from "../pb_dashboard/pbChartsLightTheme";
|
6
5
|
import { highchartsDarkTheme } from "../pb_dashboard/pbChartsDarkTheme";
|
7
6
|
import mapColors from "../pb_dashboard/pbChartsColorsHelper";
|
@@ -14,26 +13,26 @@ import { buildAriaProps, buildCss, buildDataProps } from "../utilities/props";
|
|
14
13
|
import { globalProps } from "../utilities/globalProps";
|
15
14
|
|
16
15
|
type GaugeProps = {
|
17
|
-
aria: { [key: string]: string }
|
18
|
-
className?: string
|
19
|
-
chartData?: { name: string
|
20
|
-
dark?: Boolean
|
21
|
-
data?: { [key: string]: string }
|
22
|
-
disableAnimation?: boolean
|
23
|
-
fullCircle?: boolean
|
24
|
-
height?: string
|
25
|
-
id?: string
|
26
|
-
max?: number
|
27
|
-
min?: number
|
28
|
-
prefix?: string
|
29
|
-
showLabels?: boolean
|
30
|
-
style?: string
|
31
|
-
suffix?: string
|
32
|
-
title?: string
|
33
|
-
tooltipHtml?: string
|
34
|
-
colors: string[]
|
35
|
-
minorTickInterval: any
|
36
|
-
circumference: number[]
|
16
|
+
aria: { [key: string]: string },
|
17
|
+
className?: string,
|
18
|
+
chartData?: { name: string, value: number[] | number }[],
|
19
|
+
dark?: Boolean,
|
20
|
+
data?: { [key: string]: string },
|
21
|
+
disableAnimation?: boolean,
|
22
|
+
fullCircle?: boolean,
|
23
|
+
height?: string,
|
24
|
+
id?: string,
|
25
|
+
max?: number,
|
26
|
+
min?: number,
|
27
|
+
prefix?: string,
|
28
|
+
showLabels?: boolean,
|
29
|
+
style?: string,
|
30
|
+
suffix?: string,
|
31
|
+
title?: string,
|
32
|
+
tooltipHtml?: string,
|
33
|
+
colors: string[],
|
34
|
+
minorTickInterval: any,
|
35
|
+
circumference: number[],
|
37
36
|
};
|
38
37
|
|
39
38
|
const Gauge = ({
|
@@ -62,28 +61,13 @@ const Gauge = ({
|
|
62
61
|
}: GaugeProps) => {
|
63
62
|
const ariaProps = buildAriaProps(aria);
|
64
63
|
const dataProps = buildDataProps(data);
|
65
|
-
highchartsMore(Highcharts);
|
66
|
-
solidGauge(Highcharts);
|
67
|
-
const setupTheme = () => {
|
68
|
-
dark
|
69
|
-
? Highcharts.setOptions(highchartsDarkTheme)
|
70
|
-
: Highcharts.setOptions(highchartsTheme);
|
71
|
-
};
|
72
|
-
setupTheme();
|
73
|
-
|
74
|
-
//set tooltip directly to prevent being overriden by Highcharts defaults
|
75
|
-
Highcharts.setOptions({
|
76
|
-
tooltip: {
|
77
|
-
pointFormat: tooltipHtml,
|
78
|
-
followPointer: true,
|
79
|
-
},
|
80
|
-
});
|
81
64
|
|
82
65
|
const css = buildCss({
|
83
66
|
pb_gauge_kit: true,
|
84
67
|
});
|
85
68
|
|
86
69
|
const [options, setOptions] = useState({});
|
70
|
+
const [isHighchartsLoaded, setIsHighchartsLoaded] = useState(false);
|
87
71
|
|
88
72
|
useEffect(() => {
|
89
73
|
const formattedChartData = chartData.map((obj: any) => {
|
@@ -174,18 +158,45 @@ const Gauge = ({
|
|
174
158
|
|
175
159
|
setOptions({ ...staticOptions });
|
176
160
|
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
161
|
+
const interval = setInterval(() => {
|
162
|
+
if (window.Highcharts) {
|
163
|
+
clearInterval(interval)
|
164
|
+
|
165
|
+
const gaugeInterval = setInterval(() => {
|
166
|
+
if (document.querySelector(".prefix")) {
|
167
|
+
clearInterval(gaugeInterval)
|
168
|
+
document.querySelectorAll(".prefix").forEach((prefix) => {
|
169
|
+
prefix.setAttribute("y", "28");
|
170
|
+
});
|
171
|
+
document
|
172
|
+
.querySelectorAll(".fix")
|
173
|
+
.forEach((fix) => fix.setAttribute("y", "38"));
|
174
|
+
}
|
175
|
+
}, 0)
|
176
|
+
|
177
|
+
dark
|
178
|
+
? window.Highcharts.setOptions(highchartsDarkTheme)
|
179
|
+
: window.Highcharts.setOptions(highchartsTheme)
|
180
|
+
|
181
|
+
highchartsMore(window.Highcharts);
|
182
|
+
solidGauge(window.Highcharts);
|
183
|
+
|
184
|
+
//set tooltip directly to prevent being overriden by window.Highcharts defaults
|
185
|
+
window.Highcharts.setOptions({
|
186
|
+
tooltip: {
|
187
|
+
pointFormat: tooltipHtml,
|
188
|
+
followPointer: true,
|
189
|
+
},
|
190
|
+
});
|
191
|
+
|
192
|
+
setIsHighchartsLoaded(true)
|
193
|
+
}
|
194
|
+
}, 0)
|
185
195
|
|
186
196
|
}, [chartData]);
|
187
197
|
|
188
198
|
return (
|
199
|
+
isHighchartsLoaded &&
|
189
200
|
<HighchartsReact
|
190
201
|
containerProps={{
|
191
202
|
className: classnames(css, globalProps(props)),
|
@@ -193,7 +204,7 @@ const Gauge = ({
|
|
193
204
|
...ariaProps,
|
194
205
|
...dataProps,
|
195
206
|
}}
|
196
|
-
highcharts={Highcharts}
|
207
|
+
highcharts={window.Highcharts}
|
197
208
|
options={options}
|
198
209
|
/>
|
199
210
|
);
|
@@ -4,39 +4,38 @@ import { globalProps } from "../utilities/globalProps";
|
|
4
4
|
import { buildAriaProps, buildDataProps } from "../utilities/props";
|
5
5
|
|
6
6
|
import HighchartsReact from "highcharts-react-official";
|
7
|
-
import Highcharts from "highcharts";
|
8
7
|
import { highchartsTheme } from "../pb_dashboard/pbChartsLightTheme";
|
9
8
|
import { highchartsDarkTheme } from "../pb_dashboard/pbChartsDarkTheme";
|
10
9
|
import mapColors from "../pb_dashboard/pbChartsColorsHelper";
|
11
10
|
|
12
11
|
type LineGraphProps = {
|
13
|
-
align?: "left" | "right" | "center"
|
14
|
-
axisTitle?: string
|
15
|
-
dark?: Boolean
|
16
|
-
xAxisCategories: []
|
17
|
-
yAxisMin: number
|
18
|
-
yAxisMax: number
|
19
|
-
className?: string
|
12
|
+
align?: "left" | "right" | "center",
|
13
|
+
axisTitle?: string,
|
14
|
+
dark?: Boolean,
|
15
|
+
xAxisCategories: [],
|
16
|
+
yAxisMin: number,
|
17
|
+
yAxisMax: number,
|
18
|
+
className?: string,
|
20
19
|
chartData: {
|
21
|
-
name: string
|
22
|
-
data: number[]
|
23
|
-
}[]
|
24
|
-
gradient?: boolean
|
25
|
-
id: string
|
26
|
-
pointStart: number
|
27
|
-
subTitle?: string
|
28
|
-
title: string
|
29
|
-
type?: string
|
30
|
-
legend?: boolean
|
31
|
-
toggleLegendClick?: boolean
|
32
|
-
height?: string
|
33
|
-
colors: string[]
|
34
|
-
layout?: "horizontal" | "vertical" | "proximate"
|
35
|
-
verticalAlign?: "top" | "middle" | "bottom"
|
36
|
-
x?: number
|
37
|
-
y?: number
|
38
|
-
aria?: { [key: string]: string }
|
39
|
-
data?: { [key: string]: string }
|
20
|
+
name: string,
|
21
|
+
data: number[],
|
22
|
+
}[],
|
23
|
+
gradient?: boolean,
|
24
|
+
id: string,
|
25
|
+
pointStart: number,
|
26
|
+
subTitle?: string,
|
27
|
+
title: string,
|
28
|
+
type?: string,
|
29
|
+
legend?: boolean,
|
30
|
+
toggleLegendClick?: boolean,
|
31
|
+
height?: string,
|
32
|
+
colors: string[],
|
33
|
+
layout?: "horizontal" | "vertical" | "proximate",
|
34
|
+
verticalAlign?: "top" | "middle" | "bottom",
|
35
|
+
x?: number,
|
36
|
+
y?: number,
|
37
|
+
aria?: { [key: string]: string },
|
38
|
+
data?: { [key: string]: string },
|
40
39
|
};
|
41
40
|
|
42
41
|
const LineGraph = ({
|
@@ -68,12 +67,6 @@ const LineGraph = ({
|
|
68
67
|
}: LineGraphProps) => {
|
69
68
|
const ariaProps = buildAriaProps(aria);
|
70
69
|
const dataProps = buildDataProps(data);
|
71
|
-
const setupTheme = () => {
|
72
|
-
dark
|
73
|
-
? Highcharts.setOptions(highchartsDarkTheme)
|
74
|
-
: Highcharts.setOptions(highchartsTheme);
|
75
|
-
};
|
76
|
-
setupTheme();
|
77
70
|
|
78
71
|
const staticOptions = {
|
79
72
|
title: {
|
@@ -126,12 +119,24 @@ const LineGraph = ({
|
|
126
119
|
}
|
127
120
|
|
128
121
|
const [options, setOptions] = useState({});
|
122
|
+
const [isHighchartsLoaded, setIsHighchartsLoaded] = useState(false);
|
129
123
|
|
130
124
|
useEffect(() => {
|
131
125
|
setOptions({ ...staticOptions });
|
126
|
+
|
127
|
+
const interval = setInterval(() => {
|
128
|
+
if (window.Highcharts) {
|
129
|
+
clearInterval(interval)
|
130
|
+
dark
|
131
|
+
? window.Highcharts.setOptions(highchartsDarkTheme)
|
132
|
+
: window.Highcharts.setOptions(highchartsTheme)
|
133
|
+
setIsHighchartsLoaded(true)
|
134
|
+
}
|
135
|
+
}, 0)
|
132
136
|
}, [chartData]);
|
133
137
|
|
134
138
|
return (
|
139
|
+
isHighchartsLoaded &&
|
135
140
|
<HighchartsReact
|
136
141
|
containerProps={{
|
137
142
|
className: classnames(globalProps(props), className),
|
@@ -139,7 +144,7 @@ const LineGraph = ({
|
|
139
144
|
...ariaProps,
|
140
145
|
...dataProps,
|
141
146
|
}}
|
142
|
-
highcharts={Highcharts}
|
147
|
+
highcharts={window.Highcharts}
|
143
148
|
options={options}
|
144
149
|
/>
|
145
150
|
);
|
@@ -10,9 +10,3 @@ examples:
|
|
10
10
|
- multiple_users_default: Default
|
11
11
|
- multiple_users_reverse: Reverse
|
12
12
|
- multiple_users_size: Size
|
13
|
-
|
14
|
-
swift:
|
15
|
-
- multiple_users_default_swift: Default
|
16
|
-
- multiple_users_reverse_swift: Reverse
|
17
|
-
- multiple_users_size_swift: Small
|
18
|
-
- multiple_users_props_swift: ""
|
@@ -6,9 +6,3 @@ examples:
|
|
6
6
|
|
7
7
|
react:
|
8
8
|
- multiple_users_stacked_default: Default
|
9
|
-
|
10
|
-
swift:
|
11
|
-
- multiple_users_stacked_default_swift: Default
|
12
|
-
- multiple_users_stacked_small_swift: Small
|
13
|
-
- multiple_users_stacked_xsmall_swift: xSmall
|
14
|
-
- multiple_users_stacked_props_swift: ""
|
@@ -16,10 +16,3 @@ examples:
|
|
16
16
|
- text_input_add_on: Add On
|
17
17
|
- text_input_inline: Inline
|
18
18
|
- text_input_no_label: No Label
|
19
|
-
|
20
|
-
swift:
|
21
|
-
- text_input_default_swift: Default
|
22
|
-
- text_input_error_swift: With Error
|
23
|
-
- text_input_disabled_swift: Disabled
|
24
|
-
- text_input_add_on_swift: Add On
|
25
|
-
- text_input_props_swift: ""
|