playbook_ui 13.12.0.pre.alpha.play1051highchartstest1567 → 13.12.0.pre.alpha.play1051testhighcharts1574

Sign up to get free protection for your applications and to get access to all the features.
@@ -3,257 +3,259 @@ import typography from '../tokens/exports/_typography.scss'
3
3
 
4
4
  import { ThemeProps } from './themeTypes'
5
5
 
6
- import Highcharts from 'highcharts'
6
+ //import Highcharts from 'highcharts'
7
7
 
8
8
  const pbButtonHoverColor = '#004ebb'
9
- const highchartsTheme: ThemeProps = {
10
- lang: {
11
- thousandsSep: ',',
12
- },
13
- colors: [
14
- colors.data_1,
15
- colors.data_2,
16
- colors.data_3,
17
- colors.data_4,
18
- colors.data_5,
19
- colors.data_6,
20
- colors.data_7,
21
- ],
22
- chart: {
23
- borderWidth: 0,
24
- borderRadius: 0,
25
- plotBackgroundColor: null,
26
- plotShadow: false,
27
- plotBorderWidth: 0,
28
- },
29
- title: {
30
- style: {
31
- color: colors.text_lt_default,
32
- fontFamily: typography.font_family_base,
33
- fontWeight: typography.regular,
34
- fontSize: typography.heading_3,
9
+ function highchartsTheme(highcharts: any): ThemeProps {
10
+ return {
11
+ lang: {
12
+ thousandsSep: ',',
35
13
  },
36
- },
37
- subtitle: {
38
- style: {
39
- fontFamily: typography.font_family_base,
40
- color: colors.text_lt_light,
41
- fontWeight: typography.regular,
42
- fontSize: typography.text_base,
43
- },
44
- },
45
- xAxis: {
46
- gridLineWidth: 0,
47
- lineColor: colors.border_light,
48
- tickColor: colors.border_light,
49
- labels: {
50
- style: {
51
- fontFamily: typography.font_family_base,
52
- color: colors.text_lt_lighter,
53
- fontWeight: typography.bold,
54
- fontSize: typography.text_smaller,
55
- },
14
+ colors: [
15
+ colors.data_1,
16
+ colors.data_2,
17
+ colors.data_3,
18
+ colors.data_4,
19
+ colors.data_5,
20
+ colors.data_6,
21
+ colors.data_7,
22
+ ],
23
+ chart: {
24
+ borderWidth: 0,
25
+ borderRadius: 0,
26
+ plotBackgroundColor: null,
27
+ plotShadow: false,
28
+ plotBorderWidth: 0,
56
29
  },
57
30
  title: {
58
31
  style: {
59
32
  color: colors.text_lt_default,
60
33
  fontFamily: typography.font_family_base,
61
34
  fontWeight: typography.regular,
62
- fontSize: typography.heading_4,
35
+ fontSize: typography.heading_3,
63
36
  },
64
37
  },
65
- },
66
- yAxis: {
67
- alternateGridColor: null,
68
- minorTickInterval: null,
69
- gridLineColor: colors.border_light,
70
- minorGridLineColor: colors.border_light,
71
- lineWidth: 0,
72
- tickWidth: 0,
73
- labels: {
38
+ subtitle: {
74
39
  style: {
75
40
  fontFamily: typography.font_family_base,
76
- color: colors.text_lt_lighter,
77
- fontWeight: typography.bold,
78
- fontSize: typography.text_smaller,
41
+ color: colors.text_lt_light,
42
+ fontWeight: typography.regular,
43
+ fontSize: typography.text_base,
79
44
  },
80
45
  },
81
- title: {
82
- style: {
83
- fontFamily: typography.font_family_base,
84
- color: colors.text_lt_lighter,
85
- fontWeight: typography.bold,
86
- fontSize: typography.text_smaller,
46
+ xAxis: {
47
+ gridLineWidth: 0,
48
+ lineColor: colors.border_light,
49
+ tickColor: colors.border_light,
50
+ labels: {
51
+ style: {
52
+ fontFamily: typography.font_family_base,
53
+ color: colors.text_lt_lighter,
54
+ fontWeight: typography.bold,
55
+ fontSize: typography.text_smaller,
56
+ },
87
57
  },
88
- },
89
- },
90
- legend: {
91
- layout: 'horizontal',
92
- align: 'center',
93
- verticalAlign: 'bottom',
94
- itemStyle: {
95
- fontFamily: typography.font_family_base,
96
- color: colors.text_lt_light,
97
- fontWeight: typography.regular,
98
- fontSize: typography.text_smaller,
99
- },
100
- itemHoverStyle: {
101
- color: colors.text_lt_default,
102
- },
103
- itemHiddenStyle: {
104
- color: colors.text_lt_lighter,
105
- },
106
- },
107
- labels: {
108
- style: {
109
- color: colors.primary,
110
- },
111
- },
112
- tooltip: {
113
- backgroundColor: {
114
- linearGradient: { x1: 0, y1: 0, x2: 0, y2: 1 },
115
- stops: [
116
- [0, colors.bg_dark],
117
- [1, colors.bg_dark],
118
- ],
119
- },
120
- shadow: false,
121
- borderWidth: 0,
122
- borderRadius: 10,
123
- style: {
124
- fontFamily: typography.font_family_base,
125
- color: colors.text_dk_default,
126
- fontWeight: typography.regular,
127
- fontSize: typography.text_smaller,
128
- },
129
- },
130
- // specific to gauge
131
- // unfilled gauge color
132
- pane: {
133
- background: {
134
- borderColor: colors.border_light,
135
- },
136
- },
137
-
138
- plotOptions: {
139
- series: {
140
- type: 'area',
141
- nullColor: colors.text_lt_lighter,
142
- fillColor: {
143
- linearGradient: {
144
- x1: 0,
145
- y1: 0,
146
- x2: 0,
147
- y2: 1,
58
+ title: {
59
+ style: {
60
+ color: colors.text_lt_default,
61
+ fontFamily: typography.font_family_base,
62
+ fontWeight: typography.regular,
63
+ fontSize: typography.heading_4,
148
64
  },
149
- stops: [
150
- [0, Highcharts.getOptions().colors[0]],
151
- [1, 'white'],
152
- ],
153
65
  },
154
- threshold: null,
155
66
  },
156
- // PIE STYLES
157
- pie: {
158
- colors: [
159
- colors.data_1,
160
- colors.data_2,
161
- colors.data_3,
162
- colors.data_4,
163
- colors.data_5,
164
- colors.data_6,
165
- colors.data_7,
166
- ],
167
- dataLabels: {
67
+ yAxis: {
68
+ alternateGridColor: null,
69
+ minorTickInterval: null,
70
+ gridLineColor: colors.border_light,
71
+ minorGridLineColor: colors.border_light,
72
+ lineWidth: 0,
73
+ tickWidth: 0,
74
+ labels: {
168
75
  style: {
169
76
  fontFamily: typography.font_family_base,
77
+ color: colors.text_lt_lighter,
78
+ fontWeight: typography.bold,
79
+ fontSize: typography.text_smaller,
80
+ },
81
+ },
82
+ title: {
83
+ style: {
84
+ fontFamily: typography.font_family_base,
85
+ color: colors.text_lt_lighter,
86
+ fontWeight: typography.bold,
170
87
  fontSize: typography.text_smaller,
171
- color: colors.text_lt_light,
172
- fontWeight: typography.regular,
173
88
  },
174
89
  },
175
90
  },
176
-
177
- // LINE CHART STYLES
178
- line: {
179
- dataLabels: {
180
- color: '#CCC',
91
+ legend: {
92
+ layout: 'horizontal',
93
+ align: 'center',
94
+ verticalAlign: 'bottom',
95
+ itemStyle: {
96
+ fontFamily: typography.font_family_base,
97
+ color: colors.text_lt_light,
98
+ fontWeight: typography.regular,
99
+ fontSize: typography.text_smaller,
181
100
  },
182
- marker: {
183
- lineColor: '#333',
101
+ itemHoverStyle: {
102
+ color: colors.text_lt_default,
184
103
  },
185
- area: {
186
- shadow: false,
187
- states: {
188
- hover: {
189
- lineWidth: 1,
190
- },
191
- },
192
- threshold: null,
104
+ itemHiddenStyle: {
105
+ color: colors.text_lt_lighter,
106
+ },
107
+ },
108
+ labels: {
109
+ style: {
110
+ color: colors.primary,
111
+ },
112
+ },
113
+ tooltip: {
114
+ backgroundColor: {
115
+ linearGradient: { x1: 0, y1: 0, x2: 0, y2: 1 },
116
+ stops: [
117
+ [0, colors.bg_dark],
118
+ [1, colors.bg_dark],
119
+ ],
120
+ },
121
+ shadow: false,
122
+ borderWidth: 0,
123
+ borderRadius: 10,
124
+ style: {
125
+ fontFamily: typography.font_family_base,
126
+ color: colors.text_dk_default,
127
+ fontWeight: typography.regular,
128
+ fontSize: typography.text_smaller,
129
+ },
130
+ },
131
+ // specific to gauge
132
+ // unfilled gauge color
133
+ pane: {
134
+ background: {
135
+ borderColor: colors.border_light,
193
136
  },
194
137
  },
195
138
 
196
- //TREEMAP CHART STYLES
197
- treemap: {
198
- layoutAlgorithm: "squarified",
199
- allowTraversingTree: false,
200
- animationLimit: 1000,
201
- colors: [
202
- colors.data_1,
203
- colors.data_2,
204
- colors.data_3,
205
- colors.data_4,
206
- colors.data_5,
207
- colors.data_6,
208
- colors.data_7,
209
- colors.data_8,
210
- ],
211
- colorByPoint: true,
212
- dataLabels: {
213
- enabled: true,
214
- style: {
215
- fontFamily: typography.font_family_base,
216
- fontWeight: typography.bold,
217
- fontSize: typography.heading_4,
139
+ plotOptions: {
140
+ series: {
141
+ type: 'area',
142
+ nullColor: colors.text_lt_lighter,
143
+ fillColor: {
144
+ linearGradient: {
145
+ x1: 0,
146
+ y1: 0,
147
+ x2: 0,
148
+ y2: 1,
149
+ },
150
+ stops: [
151
+ [0, highcharts.getOptions().colors[0]],
152
+ [1, 'white'],
153
+ ],
218
154
  },
155
+ threshold: null,
219
156
  },
220
- levels: [
221
- {
222
- level: 1,
223
- dataLabels: {
224
- enabled: false,
157
+ // PIE STYLES
158
+ pie: {
159
+ colors: [
160
+ colors.data_1,
161
+ colors.data_2,
162
+ colors.data_3,
163
+ colors.data_4,
164
+ colors.data_5,
165
+ colors.data_6,
166
+ colors.data_7,
167
+ ],
168
+ dataLabels: {
169
+ style: {
170
+ fontFamily: typography.font_family_base,
171
+ fontSize: typography.text_smaller,
172
+ color: colors.text_lt_light,
173
+ fontWeight: typography.regular,
225
174
  },
226
175
  },
227
- ],
228
- traverseUpButton: {
229
- position: { y: -50 },
230
- text: '< Back',
231
- theme: {
232
- r: 4,
176
+ },
177
+
178
+ // LINE CHART STYLES
179
+ line: {
180
+ dataLabels: {
181
+ color: '#CCC',
182
+ },
183
+ marker: {
184
+ lineColor: '#333',
185
+ },
186
+ area: {
187
+ shadow: false,
233
188
  states: {
234
189
  hover: {
235
- style: {
236
- fill: pbButtonHoverColor,
237
- },
190
+ lineWidth: 1,
238
191
  },
239
192
  },
193
+ threshold: null,
194
+ },
195
+ },
196
+
197
+ //TREEMAP CHART STYLES
198
+ treemap: {
199
+ layoutAlgorithm: "squarified",
200
+ allowTraversingTree: false,
201
+ animationLimit: 1000,
202
+ colors: [
203
+ colors.data_1,
204
+ colors.data_2,
205
+ colors.data_3,
206
+ colors.data_4,
207
+ colors.data_5,
208
+ colors.data_6,
209
+ colors.data_7,
210
+ colors.data_8,
211
+ ],
212
+ colorByPoint: true,
213
+ dataLabels: {
214
+ enabled: true,
240
215
  style: {
241
- fill: colors.royal,
242
- color: colors.white,
243
- fontSize: `${typography.text_small}`,
216
+ fontFamily: typography.font_family_base,
244
217
  fontWeight: typography.bold,
245
- fontFamily: `${typography.font_family_base}`,
218
+ fontSize: typography.heading_4,
219
+ },
220
+ },
221
+ levels: [
222
+ {
223
+ level: 1,
224
+ dataLabels: {
225
+ enabled: false,
226
+ },
227
+ },
228
+ ],
229
+ traverseUpButton: {
230
+ position: { y: -50 },
231
+ text: '< Back',
232
+ theme: {
233
+ r: 4,
234
+ states: {
235
+ hover: {
236
+ style: {
237
+ fill: pbButtonHoverColor,
238
+ },
239
+ },
240
+ },
241
+ style: {
242
+ fill: colors.royal,
243
+ color: colors.white,
244
+ fontSize: `${typography.text_small}`,
245
+ fontWeight: typography.bold,
246
+ fontFamily: `${typography.font_family_base}`,
247
+ },
248
+ stroke: colors.royal,
249
+ height: 24,
250
+ width: 90,
246
251
  },
247
- stroke: colors.royal,
248
- height: 24,
249
- width: 90,
250
252
  },
251
253
  },
252
254
  },
253
- },
254
- credits: {
255
- enabled: false
256
- },
255
+ credits: {
256
+ enabled: false
257
+ },
258
+ }
257
259
  }
258
260
 
259
261
  export { highchartsTheme }
@@ -17,7 +17,7 @@ type GaugeProps = {
17
17
  aria: { [key: string]: string },
18
18
  className?: string,
19
19
  chartData?: { name: string, value: number[] | number }[],
20
- dark?: boolean,
20
+ dark?: Boolean,
21
21
  data?: { [key: string]: string },
22
22
  disableAnimation?: boolean,
23
23
  fullCircle?: boolean,
@@ -54,7 +54,7 @@ const Gauge = ({
54
54
  suffix = "",
55
55
  title = "",
56
56
  tooltipHtml = '<span style="font-weight: bold; color:{point.color};">●</span>{point.name}: ' +
57
- "<b>{point.y}</b>",
57
+ "<b>{point.y}</b>",
58
58
  colors = [],
59
59
  minorTickInterval = null,
60
60
  circumference = fullCircle ? [0, 360] : [-100, 100],
@@ -125,7 +125,7 @@ const Gauge = ({
125
125
  colors:
126
126
  colors !== undefined && colors.length > 0
127
127
  ? mapColors(colors)
128
- : highchartsTheme.colors,
128
+ : highchartsTheme(window.Highcharts).colors,
129
129
  plotOptions: {
130
130
  series: {
131
131
  animation: !disableAnimation,
@@ -134,7 +134,7 @@ const Gauge = ({
134
134
  borderColor:
135
135
  colors !== undefined && colors.length === 1
136
136
  ? mapColors(colors).join()
137
- : highchartsTheme.colors[0],
137
+ : highchartsTheme(window.Highcharts).colors[0],
138
138
  borderWidth: 20,
139
139
  radius: 90,
140
140
  innerRadius: "90%",
@@ -162,7 +162,7 @@ const Gauge = ({
162
162
  const interval = setInterval(() => {
163
163
  if (window.Highcharts) {
164
164
  clearInterval(interval)
165
-
165
+
166
166
  const gaugeInterval = setInterval(() => {
167
167
  if (document.querySelector(".prefix")) {
168
168
  clearInterval(gaugeInterval)
@@ -177,11 +177,11 @@ const Gauge = ({
177
177
 
178
178
  dark
179
179
  ? window.Highcharts.setOptions(highchartsDarkTheme(window.Highcharts))
180
- : window.Highcharts.setOptions(highchartsTheme)
181
-
180
+ : window.Highcharts.setOptions(highchartsTheme(window.Highcharts))
181
+
182
182
  highchartsMore(window.Highcharts);
183
183
  solidGauge(window.Highcharts);
184
-
184
+
185
185
  //set tooltip directly to prevent being overriden by window.Highcharts defaults
186
186
  window.Highcharts.setOptions({
187
187
  tooltip: {
@@ -12,7 +12,7 @@ import mapColors from "../pb_dashboard/pbChartsColorsHelper";
12
12
  type LineGraphProps = {
13
13
  align?: "left" | "right" | "center",
14
14
  axisTitle?: string,
15
- dark?: boolean,
15
+ dark?: Boolean,
16
16
  xAxisCategories: [],
17
17
  yAxisMin: number,
18
18
  yAxisMax: number,
@@ -101,7 +101,7 @@ const LineGraph = ({
101
101
  colors:
102
102
  colors !== undefined && colors.length > 0
103
103
  ? mapColors(colors)
104
- : highchartsTheme.colors,
104
+ : highchartsTheme(window.Highcharts).colors,
105
105
  plotOptions: {
106
106
  series: {
107
107
  pointStart: pointStart,
@@ -130,7 +130,7 @@ const LineGraph = ({
130
130
  clearInterval(interval)
131
131
  dark
132
132
  ? window.Highcharts.setOptions(highchartsDarkTheme(window.Highcharts))
133
- : window.Highcharts.setOptions(highchartsTheme)
133
+ : window.Highcharts.setOptions(highchartsTheme(window.Highcharts))
134
134
  setIsHighchartsLoaded(true)
135
135
  }
136
136
  }, 0)