playbook_ui 11.11.0 → 11.12.1.pre.alpha.charts1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (91) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/index.js +2 -1
  3. data/app/pb_kits/playbook/pb_bar_graph/_bar_graph.tsx +145 -0
  4. data/app/pb_kits/playbook/pb_bar_graph/bar_graph.rb +17 -1
  5. data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_legend_position.html.erb +62 -0
  6. data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_legend_position.jsx +86 -0
  7. data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_legend_position.md +17 -0
  8. data/app/pb_kits/playbook/pb_bar_graph/docs/example.yml +2 -0
  9. data/app/pb_kits/playbook/pb_bar_graph/docs/index.js +1 -0
  10. data/app/pb_kits/playbook/pb_button/_button.scss +6 -0
  11. data/app/pb_kits/playbook/pb_button/docs/_button_default.html.erb +4 -4
  12. data/app/pb_kits/playbook/pb_button/docs/_button_default.jsx +18 -17
  13. data/app/pb_kits/playbook/pb_circle_chart/ChartsTypes.ts +2 -0
  14. data/app/pb_kits/playbook/pb_circle_chart/_circle_chart.tsx +216 -0
  15. data/app/pb_kits/playbook/pb_circle_chart/circle_chart.html.erb +9 -21
  16. data/app/pb_kits/playbook/pb_circle_chart/circle_chart.rb +23 -47
  17. data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_legend_position.html.erb +86 -0
  18. data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_legend_position.jsx +114 -0
  19. data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_legend_position.md +17 -0
  20. data/app/pb_kits/playbook/pb_circle_chart/docs/example.yml +2 -0
  21. data/app/pb_kits/playbook/pb_circle_chart/docs/index.js +1 -0
  22. data/app/pb_kits/playbook/pb_dashboard/pbChartsColorsHelper.ts +16 -0
  23. data/app/pb_kits/playbook/pb_dashboard/{pbChartsDarkTheme.js → pbChartsDarkTheme.ts} +6 -21
  24. data/app/pb_kits/playbook/pb_dashboard/{pbChartsLightTheme.js → pbChartsLightTheme.ts} +6 -21
  25. data/app/pb_kits/playbook/pb_dashboard/themeTypes.ts +16 -0
  26. data/app/pb_kits/playbook/pb_date_picker/date_picker.test.js +50 -50
  27. data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_time.jsx +1 -0
  28. data/app/pb_kits/playbook/pb_date_picker/plugins/timeSelect.ts +89 -89
  29. data/app/pb_kits/playbook/pb_date_picker/sass_partials/_time_selection_styles.scss +15 -0
  30. data/app/pb_kits/playbook/pb_dialog/_dialog.scss +30 -1
  31. data/app/pb_kits/playbook/pb_dialog/dialog.html.erb +28 -0
  32. data/app/pb_kits/playbook/pb_dialog/dialog.rb +7 -35
  33. data/app/pb_kits/playbook/pb_dialog/dialogHelper.js +21 -0
  34. data/app/pb_kits/playbook/pb_dialog/dialog_body.html.erb +7 -0
  35. data/app/pb_kits/playbook/pb_dialog/dialog_body.rb +13 -0
  36. data/app/pb_kits/playbook/pb_dialog/dialog_footer.html.erb +13 -0
  37. data/app/pb_kits/playbook/pb_dialog/dialog_footer.rb +16 -0
  38. data/app/pb_kits/playbook/pb_dialog/dialog_header.html.erb +13 -0
  39. data/app/pb_kits/playbook/pb_dialog/dialog_header.rb +3 -20
  40. data/app/pb_kits/playbook/pb_dialog/docs/_dialog_compound_components.html.erb +12 -0
  41. data/app/pb_kits/playbook/pb_dialog/docs/_dialog_compound_components.md +3 -1
  42. data/app/pb_kits/playbook/pb_dialog/docs/_dialog_default.html.erb +11 -0
  43. data/app/pb_kits/playbook/pb_dialog/docs/_dialog_default.md +3 -0
  44. data/app/pb_kits/playbook/pb_dialog/docs/_dialog_sizes.html.erb +29 -0
  45. data/app/pb_kits/playbook/pb_dialog/docs/example.yml +3 -0
  46. data/app/pb_kits/playbook/pb_gauge/_gauge.scss +4 -0
  47. data/app/pb_kits/playbook/pb_gauge/_gauge.tsx +213 -0
  48. data/app/pb_kits/playbook/pb_gauge/docs/_gauge_complex.html.erb +1 -1
  49. data/app/pb_kits/playbook/pb_gauge/docs/_gauge_complex.jsx +8 -8
  50. data/app/pb_kits/playbook/pb_gauge/gauge.html.erb +1 -11
  51. data/app/pb_kits/playbook/pb_gauge/gauge.rb +3 -8
  52. data/app/pb_kits/playbook/pb_icon/_icon.tsx +3 -1
  53. data/app/pb_kits/playbook/pb_icon/icon.rb +8 -1
  54. data/app/pb_kits/playbook/pb_icon/icon.test.js +155 -0
  55. data/app/pb_kits/playbook/pb_legend/{_legend.jsx → _legend.tsx} +6 -6
  56. data/app/pb_kits/playbook/pb_legend/legend.test.js +29 -0
  57. data/app/pb_kits/playbook/pb_line_graph/_line_graph.tsx +148 -0
  58. data/app/pb_kits/playbook/pb_line_graph/docs/_line_graph_legend_position.html.erb +62 -0
  59. data/app/pb_kits/playbook/pb_line_graph/docs/_line_graph_legend_position.jsx +83 -0
  60. data/app/pb_kits/playbook/pb_line_graph/docs/_line_graph_legend_position.md +17 -0
  61. data/app/pb_kits/playbook/pb_line_graph/docs/example.yml +2 -0
  62. data/app/pb_kits/playbook/pb_line_graph/docs/index.js +1 -0
  63. data/app/pb_kits/playbook/pb_line_graph/line_graph.rb +17 -1
  64. data/app/pb_kits/playbook/pb_radio/_radio.scss +1 -1
  65. data/app/pb_kits/playbook/pb_title/_title.scss +5 -0
  66. data/app/pb_kits/playbook/pb_title/_title.tsx +4 -1
  67. data/app/pb_kits/playbook/pb_title/docs/{_title_light.html.erb → _title_default.html.erb} +3 -3
  68. data/app/pb_kits/playbook/pb_title/docs/{_title_light.jsx → _title_default.jsx} +14 -14
  69. data/app/pb_kits/playbook/pb_title/docs/{_title_light.md → _title_default.md} +0 -0
  70. data/app/pb_kits/playbook/pb_title/docs/_title_light_weight.html.erb +1 -0
  71. data/app/pb_kits/playbook/pb_title/docs/_title_light_weight.jsx +19 -0
  72. data/app/pb_kits/playbook/pb_title/docs/_title_light_weight.md +4 -0
  73. data/app/pb_kits/playbook/pb_title/docs/example.yml +4 -2
  74. data/app/pb_kits/playbook/pb_title/docs/index.js +2 -1
  75. data/app/pb_kits/playbook/pb_title/title.rb +6 -1
  76. data/app/pb_kits/playbook/pb_title/title.test.js +13 -0
  77. data/app/pb_kits/playbook/pb_treemap_chart/_treemap_chart.tsx +111 -0
  78. data/app/pb_kits/playbook/pb_treemap_chart/docs/_treemap_chart_tooltip.jsx +1 -1
  79. data/app/pb_kits/playbook/playbook-rails-react-bindings.js +4 -0
  80. data/app/pb_kits/playbook/playbook-rails.js +4 -4
  81. data/app/pb_kits/playbook/tokens/_titles.scss +10 -1
  82. data/app/pb_kits/playbook/tokens/_typography.scss +2 -2
  83. data/lib/playbook/version.rb +2 -2
  84. metadata +42 -17
  85. data/app/pb_kits/playbook/pb_bar_graph/_bar_graph.jsx +0 -91
  86. data/app/pb_kits/playbook/pb_circle_chart/_circle_chart.jsx +0 -136
  87. data/app/pb_kits/playbook/pb_dialog/_dialog.html.erb +0 -10
  88. data/app/pb_kits/playbook/pb_gauge/_gauge.jsx +0 -112
  89. data/app/pb_kits/playbook/pb_line_graph/_line_graph.jsx +0 -93
  90. data/app/pb_kits/playbook/pb_treemap_chart/_treemap_chart.jsx +0 -79
  91. data/app/pb_kits/playbook/plugins/pb_chart.js +0 -309
@@ -1,112 +0,0 @@
1
- /* @flow */
2
-
3
- import React, { useEffect, useRef } from 'react'
4
- import classnames from 'classnames'
5
- import Highcharts from 'highcharts'
6
-
7
- import { buildAriaProps, buildCss, buildDataProps } from '../utilities/props'
8
- import { globalProps } from '../utilities/globalProps'
9
- import pbChart from '../plugins/pb_chart'
10
-
11
- type GaugeProps = {
12
- aria: Object,
13
- className?: string,
14
- chartData?: array,
15
- dark?: Boolean,
16
- data?: Object,
17
- disableAnimation: boolean,
18
- fullCircle: boolean,
19
- height: string,
20
- id?: string,
21
- max: number,
22
- min: number,
23
- prefix: string,
24
- showLabels: boolean,
25
- style: string,
26
- suffix: string,
27
- title: string,
28
- tooltipHtml: string,
29
- colors: array,
30
- }
31
-
32
- const Gauge = (props: GaugeProps) => {
33
- const {
34
- aria = {},
35
- className,
36
- chartData = [{ name: 'Name', value: 0 }],
37
- dark = false,
38
- data = {},
39
- disableAnimation = false,
40
- fullCircle = false,
41
- height = null,
42
- id,
43
- max = 100,
44
- min = 0,
45
- prefix = '',
46
- showLabels = false,
47
- style = 'solidgauge',
48
- suffix = '',
49
- title = '',
50
- tooltipHtml = '<span style="font-weight: bold; color:{point.color};">●</span>{point.name}: ' + '<b>{point.y}</b>',
51
- colors = [],
52
- } = props
53
-
54
- const ariaProps = buildAriaProps(aria)
55
- const dataProps = buildDataProps(data)
56
-
57
- const css = buildCss({
58
- 'pb_gauge_kit': true,
59
- })
60
- // Runs first time component Renders
61
- useEffect(() => {
62
- const formattedChartData = chartData.map((obj) => {
63
- obj.y = obj.value
64
- delete obj.value
65
- return obj
66
- })
67
-
68
- new pbChart('.selector', {
69
- id: id,
70
- chartData: formattedChartData,
71
- circumference: fullCircle ? [0, 360] : [-100, 100],
72
- dark,
73
- disableAnimation: disableAnimation,
74
- height: height,
75
- min: min,
76
- max: max,
77
- prefix: prefix,
78
- title: title,
79
- suffix: suffix,
80
- showLabels: showLabels,
81
- style: style,
82
- tooltipHtml: tooltipHtml,
83
- type: 'gauge',
84
- colors: colors,
85
- })
86
- }, [])
87
-
88
- const componentDidMount = useRef(false)
89
- // Doesn't run the first time but runs every subsequent render
90
- useEffect(() => {
91
- if (componentDidMount.current) {
92
- Highcharts.charts.forEach((chart) => {
93
- if (chart && chart.renderTo.id === id) {
94
- chart.series[0].setData([chartData[0].value])
95
- chart.series[0].data[0].name = chartData[0].name
96
- }
97
- })
98
- } else {
99
- componentDidMount.current = true
100
- }
101
- }, [chartData])
102
- return (
103
- <div
104
- {...ariaProps}
105
- {...dataProps}
106
- className={classnames(css, globalProps(props), className)}
107
- id={id}
108
- />
109
- )
110
- }
111
-
112
- export default Gauge
@@ -1,93 +0,0 @@
1
- /* @flow */
2
-
3
- import React from 'react'
4
- import classnames from 'classnames'
5
-
6
- import { globalProps } from '../utilities/globalProps'
7
- import pbChart from '../plugins/pb_chart'
8
-
9
- type LineGraphProps = {
10
- axisTitle?: string,
11
- dark?: Boolean,
12
- xAxisCategories: array,
13
- yAxisMin: number,
14
- yAxisMax: number,
15
- className?: string,
16
- chartData: array<{
17
- name: string,
18
- data: array<number>,
19
- }>,
20
- gradient?: boolean,
21
- id: string,
22
- pointStart: number,
23
- subTitle?: string,
24
- title: string,
25
- type?: string,
26
- legend?: boolean,
27
- toggleLegendClick?: boolean,
28
- height?: string,
29
- colors: array,
30
- }
31
-
32
- export default class LineGraph extends React.Component<LineGraphProps> {
33
- static defaultProps = {
34
- className: 'pb_bar_graph',
35
- dark: false,
36
- gradient: false,
37
- type: 'line',
38
- legend: false,
39
- toggleLegendClick: true,
40
- }
41
-
42
- componentDidMount() {
43
- const {
44
- axisTitle,
45
- dark,
46
- xAxisCategories,
47
- yAxisMin,
48
- yAxisMax,
49
- className,
50
- chartData,
51
- id,
52
- pointStart,
53
- subTitle,
54
- title,
55
- type,
56
- legend,
57
- toggleLegendClick,
58
- height,
59
- colors = [],
60
- } = this.props
61
-
62
- new pbChart(`.${className}`, {
63
- axisTitle: axisTitle,
64
- chartData: chartData,
65
- colors: colors,
66
- dark,
67
- id: id,
68
- pointStart: pointStart,
69
- subtitle: subTitle,
70
- type,
71
- title: title,
72
- xAxisCategories: xAxisCategories,
73
- yAxisMin: yAxisMin,
74
- yAxisMax: yAxisMax,
75
- legend: legend,
76
- toggleLegendClick: toggleLegendClick,
77
- height: height,
78
- })
79
- }
80
-
81
- props: LineGraphProps
82
-
83
- render() {
84
- const { className, id } = this.props
85
-
86
- return (
87
- <div
88
- className={classnames(globalProps(this.props), className)}
89
- id={id}
90
- />
91
- )
92
- }
93
- }
@@ -1,79 +0,0 @@
1
- /* @flow */
2
-
3
- import React from 'react'
4
- import classnames from 'classnames'
5
-
6
- import { globalProps } from '../utilities/globalProps'
7
- import pbChart from '../plugins/pb_chart'
8
-
9
- type TreemapChartProps = {
10
- chartData: array<{
11
- name: string,
12
- parent?: string | number,
13
- value: number,
14
- color?: string,
15
- id?: string | number,
16
- }>,
17
- className?: string,
18
- colors: array,
19
- dark?: boolean,
20
- drillable: boolean,
21
- grouped: boolean,
22
- height?: string,
23
- id: number,
24
- title: string,
25
- tooltipHtml: string,
26
- type?: string,
27
- }
28
-
29
- export default class TreemapChart extends React.Component<TreemapChartProps> {
30
- static defaultProps = {
31
- className: 'pb_treemap_chart',
32
- dark: false,
33
- drillable: false,
34
- grouped: false,
35
- type: 'treemap',
36
- }
37
-
38
- componentDidMount() {
39
- const {
40
- chartData,
41
- className,
42
- colors = [],
43
- dark,
44
- drillable,
45
- grouped,
46
- height,
47
- id,
48
- title = "",
49
- tooltipHtml = '<span style="font-weight: bold; color:{point.color};">&#9679; </span>{point.name}: <b>{point.value}</b>',
50
- type,
51
- } = this.props
52
-
53
- new pbChart(`.${className}`, {
54
- chartData: chartData,
55
- colors: colors,
56
- dark,
57
- drillable,
58
- grouped,
59
- height: height,
60
- id: id,
61
- title: title,
62
- tooltipHtml,
63
- type,
64
- })
65
- }
66
-
67
- props: TreemapChartProps
68
-
69
- render() {
70
- const { className, id } = this.props
71
-
72
- return (
73
- <div
74
- className={classnames(globalProps(this.props), className)}
75
- id={id}
76
- />
77
- )
78
- }
79
- }
@@ -1,309 +0,0 @@
1
- import Highcharts from 'highcharts'
2
-
3
- import { highchartsTheme } from '../pb_dashboard/pbChartsLightTheme'
4
- import { highchartsDarkTheme } from '../pb_dashboard/pbChartsDarkTheme'
5
- import colors from '../tokens/exports/_colors.scss'
6
-
7
- import pie from 'highcharts/modules/variable-pie'
8
- import highchartsMore from 'highcharts/highcharts-more'
9
- import solidGauge from 'highcharts/modules/solid-gauge'
10
- import treemap from 'highcharts/modules/treemap'
11
-
12
- pie(Highcharts)
13
-
14
- // Map Data Color String Props to our SCSS Variables
15
-
16
- const mapColors = (array) => {
17
- const regex = /(data)\-[1-8]/ //eslint-disable-line
18
-
19
- const newArray = array.map((item) => {
20
- return regex.test(item)
21
- ? `${colors[`data_${item[item.length - 1]}`]}`
22
- : item
23
- })
24
- return newArray
25
- }
26
-
27
- // Adjust Circle Chart Block Kit Dimensions to Match the Chart for Centering
28
- const alignBlockElement = (event) => {
29
- const itemToMove = document.querySelector(`#wrapper-circle-chart-${event.target.renderTo.id} .pb-circle-chart-block`)
30
- const chartContainer = document.querySelector(`#${event.target.renderTo.id}`)
31
- if (itemToMove !== null) {
32
- itemToMove.style.height = `${event.target.chartHeight}px`
33
- itemToMove.style.width = `${event.target.chartWidth}px`;
34
- (chartContainer.firstChild).before(itemToMove)
35
- }
36
- }
37
-
38
- class pbChart {
39
- defaults = {
40
- callbackInitializeBefore: () => {},
41
- callbackInitializeAfter: () => {},
42
- callbackRefreshBefore: () => {},
43
- callbackRefreshAfter: () => {},
44
- callbackDestroyBefore: () => {},
45
- callbackDestroyAfter: () => {},
46
- property: 'Value',
47
- }
48
-
49
- extendDefaults(defaults, options) {
50
- for (const property in options) {
51
- if (Object.prototype.hasOwnProperty.call(options, property)) {
52
- defaults[property] = options[property]
53
- }
54
- }
55
- return defaults
56
- }
57
-
58
- constructor(element, options) {
59
- this.element = element
60
- this.options = options
61
- this.settings = this.extendDefaults(this.defaults, options)
62
-
63
- if (this.options.type == 'variablepie' || this.options.type == 'pie'){
64
- this.setupPieChart(options)
65
- } else if (this.options.type == 'gauge') {
66
- this.setupGauge(options)
67
- } else if (this.options.type == 'treemap') {
68
- this.setupTreemap(options)
69
- } else {
70
- this.setupChart(options)
71
- }
72
- }
73
-
74
- setupTheme() {
75
- this.options.dark ? Highcharts.setOptions(highchartsDarkTheme) : Highcharts.setOptions(highchartsTheme)
76
- }
77
-
78
- setupGauge(options) {
79
- highchartsMore(Highcharts)
80
- solidGauge(Highcharts)
81
- this.setupTheme()
82
-
83
- Highcharts.chart(this.defaults.id, {
84
- chart: {
85
- events: {
86
- load() {
87
- setTimeout(this.reflow.bind(this), 0)
88
- },
89
- },
90
- type: this.defaults.style,
91
- height: this.defaults.height,
92
- },
93
- title: {
94
- text: this.defaults.title,
95
- },
96
- yAxis: {
97
- min: this.defaults.min,
98
- max: this.defaults.max,
99
- lineWidth: 0,
100
- tickWidth: 0,
101
- minorTickInterval: null,
102
- tickAmount: 2,
103
- tickPositions: [this.defaults.min, this.defaults.max],
104
- labels: {
105
- y: 26,
106
- enabled: this.defaults.showLabels,
107
- },
108
- },
109
- credits: false,
110
- series: [
111
- {
112
- data: this.defaults.chartData,
113
- },
114
- ],
115
- pane: {
116
- center: ['50%', '50%'],
117
- size: '90%',
118
- startAngle: this.defaults.circumference[0],
119
- endAngle: this.defaults.circumference[1],
120
- background: {
121
- borderWidth: 20,
122
- innerRadius: '90%',
123
- outerRadius: '90%',
124
- shape: 'arc',
125
- className: 'gauge-pane',
126
- },
127
- },
128
- tooltip: {
129
- headerFormat: '',
130
- pointFormat: this.defaults.tooltipHtml,
131
- followPointer: true,
132
- },
133
- colors: options.colors !== undefined && options.colors.length > 0 ? mapColors(options.colors) : highchartsTheme.colors,
134
- plotOptions: {
135
- series: {
136
- animation: !this.defaults.disableAnimation,
137
- },
138
- solidgauge: {
139
- borderColor: options.colors !== undefined && options.colors.length === 1 ? mapColors(options.colors).join() : highchartsTheme.colors[0],
140
- dataLabels: {
141
- format: `<span class="prefix">${this.defaults.prefix}</span>` +
142
- '<span class="fix">{y:,f}</span>' +
143
- `<span class="suffix">${this.defaults.suffix}</span>`,
144
- } },
145
- },
146
- },
147
- )
148
- document.querySelectorAll('.gauge-pane').forEach((pane) => pane.setAttribute('stroke-linejoin', 'round'))
149
- if (document.querySelector('.prefix')) {
150
- document.querySelectorAll('.prefix').forEach((prefix) => prefix.setAttribute('y', '28'))
151
- document.querySelectorAll('.fix').forEach((fix) => fix.setAttribute('y', '38'))
152
- }
153
- }
154
-
155
- setupPieChart(options) {
156
- this.setupTheme()
157
- Highcharts.chart(this.defaults.id, {
158
- title: {
159
- text: this.defaults.title,
160
- },
161
- chart: {
162
- height: this.defaults.height,
163
- type: this.defaults.type,
164
- events: {
165
- render: (event) => alignBlockElement(event),
166
- redraw: (event) => alignBlockElement(event),
167
- },
168
- },
169
-
170
- plotOptions: {
171
- pie: {
172
- colors: options.colors.length > 0 ? mapColors(options.colors) : highchartsTheme.colors,
173
- dataLabels: {
174
- enabled: this.defaults.dataLabels,
175
- connectorShape: 'straight',
176
- connectorWidth: 3,
177
- format: this.defaults.dataLabelHtml,
178
- },
179
- showInLegend: this.defaults.showInLegend,
180
- },
181
- },
182
-
183
- tooltip: {
184
- headerFormat: this.defaults.headerFormat,
185
- pointFormat: this.defaults.tooltipHtml,
186
- useHTML: this.defaults.useHTML,
187
- },
188
- series: [{
189
- minPointSize: this.defaults.minPointSize,
190
- maxPointSize: this.defaults.maxPointSize,
191
- innerSize: options.borderWidth == 20 ? '100%' : this.defaults.innerSize,
192
- data: this.defaults.chartData,
193
- zMin: this.defaults.zMin,
194
- startAngle: this.defaults.startAngle,
195
- borderWidth: this.defaults.borderWidth,
196
- borderColor: options.borderWidth == 20 ? null : this.defaults.innerSize,
197
- }],
198
- credits: false,
199
- })
200
- }
201
-
202
- setupTreemap(options) {
203
- treemap(Highcharts)
204
- this.setupTheme()
205
- options.dark ? Highcharts.setOptions(highchartsDarkTheme) : Highcharts.setOptions(highchartsTheme)
206
-
207
- Highcharts.chart(this.defaults.id, {
208
- title: {
209
- text: this.defaults.title,
210
- },
211
- chart: {
212
- height: this.defaults.height,
213
- type: this.defaults.type,
214
- },
215
- credits: false,
216
- series: [{
217
- data: this.defaults.chartData,
218
- }],
219
- plotOptions: {
220
- treemap: {
221
- allowTraversingTree: this.defaults.drillable,
222
- colorByPoint: !this.defaults.grouped,
223
- colors: options.colors !== undefined && options.colors.length > 0 ? mapColors(options.colors) : highchartsTheme.colors,
224
- },
225
- },
226
- tooltip: {
227
- pointFormat: this.defaults.tooltipHtml,
228
- useHTML: true,
229
- },
230
- })
231
- }
232
-
233
- setupChart(options) {
234
- this.setupTheme()
235
- const configOptions = {
236
- title: {
237
- text: this.defaults.title,
238
- },
239
- chart: {
240
- height: this.defaults.height,
241
- type: this.defaults.type,
242
- },
243
- subtitle: {
244
- text: this.defaults.subtitle,
245
- },
246
- yAxis: {
247
- min: this.defaults.yAxisMin,
248
- max: this.defaults.yAxisMax,
249
- title: {
250
- text: this.defaults.axisTitle,
251
- },
252
- },
253
- xAxis: {
254
- categories: this.defaults.xAxisCategories,
255
- },
256
- legend: {
257
- enabled: this.defaults.legend,
258
- },
259
- colors: options.colors !== undefined && options.colors.length > 0 ? mapColors(options.colors) : highchartsTheme.colors,
260
- plotOptions: {
261
- series: {
262
- pointStart: this.defaults.pointStart,
263
- dataLabels: {
264
- enabled: false,
265
- },
266
- },
267
- },
268
- series: this.defaults.chartData,
269
- credits: false,
270
- }
271
-
272
- if (!this.defaults.toggleLegendClick) {
273
- configOptions.plotOptions.series.events = { legendItemClick: () => false }
274
- }
275
-
276
- Highcharts.chart(this.defaults.id, configOptions)
277
- }
278
-
279
- refresh(silent = false) {
280
- if (!silent) {
281
- this.settings.callbackRefreshBefore.call()
282
- }
283
-
284
- this.this.destroy(silent)
285
- this.this.initialize(silent)
286
- if (!silent) {
287
- this.settings.callbackRefreshAfter.call()
288
- }
289
- }
290
-
291
- destroy(silent = false) {
292
- if (!silent) {
293
- this.settings.callbackDestroyBefore.call()
294
- }
295
- if (!silent) {
296
- this.settings.callbackDestroyAfter.call()
297
- }
298
- }
299
-
300
- refreshSilently() {
301
- this.this.refresh(true)
302
- }
303
-
304
- destroySilently() {
305
- this.this.destroy(true)
306
- }
307
- }
308
-
309
- export default pbChart