playbook_ui 11.12.0 → 11.12.1.pre.alpha.charts1
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/index.js +0 -1
- data/app/pb_kits/playbook/pb_bar_graph/_bar_graph.tsx +145 -0
- data/app/pb_kits/playbook/pb_button/_button.scss +1 -1
- data/app/pb_kits/playbook/pb_circle_chart/ChartsTypes.ts +2 -0
- data/app/pb_kits/playbook/pb_circle_chart/_circle_chart.tsx +216 -0
- data/app/pb_kits/playbook/pb_circle_chart/circle_chart.html.erb +9 -21
- data/app/pb_kits/playbook/pb_circle_chart/circle_chart.rb +7 -47
- data/app/pb_kits/playbook/pb_dashboard/pbChartsColorsHelper.ts +16 -0
- data/app/pb_kits/playbook/pb_dashboard/{pbChartsDarkTheme.js → pbChartsDarkTheme.ts} +6 -21
- data/app/pb_kits/playbook/pb_dashboard/{pbChartsLightTheme.js → pbChartsLightTheme.ts} +6 -21
- data/app/pb_kits/playbook/pb_dashboard/themeTypes.ts +16 -0
- data/app/pb_kits/playbook/pb_gauge/_gauge.scss +4 -0
- data/app/pb_kits/playbook/pb_gauge/_gauge.tsx +213 -0
- data/app/pb_kits/playbook/pb_gauge/docs/_gauge_complex.html.erb +1 -1
- data/app/pb_kits/playbook/pb_gauge/docs/_gauge_complex.jsx +8 -8
- data/app/pb_kits/playbook/pb_gauge/gauge.html.erb +1 -11
- data/app/pb_kits/playbook/pb_gauge/gauge.rb +3 -8
- data/app/pb_kits/playbook/pb_line_graph/_line_graph.tsx +148 -0
- data/app/pb_kits/playbook/pb_treemap_chart/_treemap_chart.tsx +111 -0
- data/app/pb_kits/playbook/pb_treemap_chart/docs/_treemap_chart_tooltip.jsx +1 -1
- data/app/pb_kits/playbook/playbook-rails-react-bindings.js +4 -0
- data/app/pb_kits/playbook/playbook-rails.js +0 -4
- data/lib/playbook/version.rb +2 -2
- metadata +14 -12
- data/app/pb_kits/playbook/pb_bar_graph/_bar_graph.jsx +0 -111
- data/app/pb_kits/playbook/pb_circle_chart/_circle_chart.jsx +0 -151
- data/app/pb_kits/playbook/pb_gauge/_gauge.jsx +0 -112
- data/app/pb_kits/playbook/pb_line_graph/_line_graph.jsx +0 -113
- data/app/pb_kits/playbook/pb_treemap_chart/_treemap_chart.jsx +0 -79
- data/app/pb_kits/playbook/plugins/pb_chart.js +0 -322
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6ec7a56f6eea6ea55c21faa02b8a1beb8110460443353439aa5de7961024b182
|
4
|
+
data.tar.gz: 46bb11b6178da12a8e9dcdfde1af101e675283b1aa1776455e9708f98a16a21e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4b63642925e7f72674c589f226baa9192e76492c20bbd06a11a942c6d9b6399e55bb163959f827924f49ee2531ada84cff1ddc00b36cfee289cb08a31a927676
|
7
|
+
data.tar.gz: 696b8d6cbf319c7b0a92089b738033525cf07cfa674f723767410936d94df1f0b5d40c27596437407248dbd16b0c0592738d28f7a53818edc9af7080788b89c9
|
@@ -115,7 +115,6 @@ export { default as barGraphSettings } from './pb_bar_graph/barGraphSettings'
|
|
115
115
|
export { default as dashboardValueSettings } from './pb_dashboard_value/dashboardValueSettings'
|
116
116
|
|
117
117
|
// Other JS/Plugins
|
118
|
-
export { default as pbChart } from './plugins/pb_chart.js'
|
119
118
|
export { default as datePickerHelper } from './pb_date_picker/date_picker_helper'
|
120
119
|
export { default as PbPopover } from './pb_popover'
|
121
120
|
export { default as PbTable } from './pb_table'
|
@@ -0,0 +1,145 @@
|
|
1
|
+
import React, { useState, useEffect } from "react";
|
2
|
+
import { globalProps } from "../utilities/globalProps";
|
3
|
+
import { buildAriaProps, buildDataProps } from "../utilities/props";
|
4
|
+
|
5
|
+
import HighchartsReact from "highcharts-react-official";
|
6
|
+
import Highcharts from "highcharts";
|
7
|
+
import { highchartsTheme } from "../pb_dashboard/pbChartsLightTheme";
|
8
|
+
import { highchartsDarkTheme } from "../pb_dashboard/pbChartsDarkTheme";
|
9
|
+
import mapColors from "../pb_dashboard/pbChartsColorsHelper";
|
10
|
+
|
11
|
+
import classnames from "classnames";
|
12
|
+
|
13
|
+
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; data: number[] }[];
|
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 };
|
37
|
+
};
|
38
|
+
|
39
|
+
|
40
|
+
const BarGraph = ({
|
41
|
+
aria = {},
|
42
|
+
data = {},
|
43
|
+
align = "center",
|
44
|
+
axisTitle,
|
45
|
+
dark = false,
|
46
|
+
chartData,
|
47
|
+
className = "pb_bar_graph",
|
48
|
+
colors,
|
49
|
+
id,
|
50
|
+
pointStart,
|
51
|
+
subTitle,
|
52
|
+
type = "column",
|
53
|
+
title = "Title",
|
54
|
+
xAxisCategories,
|
55
|
+
yAxisMin,
|
56
|
+
yAxisMax,
|
57
|
+
legend = false,
|
58
|
+
toggleLegendClick = true,
|
59
|
+
height,
|
60
|
+
layout = "horizontal",
|
61
|
+
verticalAlign = "bottom",
|
62
|
+
x = 0,
|
63
|
+
y = 0,
|
64
|
+
...props
|
65
|
+
}: BarGraphProps) => {
|
66
|
+
const ariaProps = buildAriaProps(aria);
|
67
|
+
const dataProps = buildDataProps(data);
|
68
|
+
const setupTheme = () => {
|
69
|
+
dark
|
70
|
+
? Highcharts.setOptions(highchartsDarkTheme)
|
71
|
+
: Highcharts.setOptions(highchartsTheme);
|
72
|
+
};
|
73
|
+
setupTheme();
|
74
|
+
|
75
|
+
const staticOptions = {
|
76
|
+
title: {
|
77
|
+
text: title,
|
78
|
+
},
|
79
|
+
chart: {
|
80
|
+
height: height,
|
81
|
+
type: type,
|
82
|
+
},
|
83
|
+
subtitle: {
|
84
|
+
text: subTitle,
|
85
|
+
},
|
86
|
+
yAxis: {
|
87
|
+
min: yAxisMin,
|
88
|
+
max: yAxisMax,
|
89
|
+
title: {
|
90
|
+
text: axisTitle,
|
91
|
+
},
|
92
|
+
},
|
93
|
+
xAxis: {
|
94
|
+
categories: xAxisCategories,
|
95
|
+
},
|
96
|
+
legend: {
|
97
|
+
enabled: legend,
|
98
|
+
align: align,
|
99
|
+
verticalAlign: verticalAlign,
|
100
|
+
layout: layout,
|
101
|
+
x: x,
|
102
|
+
y: y,
|
103
|
+
},
|
104
|
+
colors:
|
105
|
+
colors !== undefined && colors.length > 0
|
106
|
+
? mapColors(colors)
|
107
|
+
: highchartsTheme.colors,
|
108
|
+
plotOptions: {
|
109
|
+
series: {
|
110
|
+
pointStart: pointStart,
|
111
|
+
events: {},
|
112
|
+
dataLabels: {
|
113
|
+
enabled: false,
|
114
|
+
},
|
115
|
+
},
|
116
|
+
},
|
117
|
+
series: chartData,
|
118
|
+
credits: false,
|
119
|
+
};
|
120
|
+
|
121
|
+
if (!toggleLegendClick) {
|
122
|
+
staticOptions.plotOptions.series.events = { legendItemClick: () => false };
|
123
|
+
}
|
124
|
+
|
125
|
+
const [options, setOptions] = useState({});
|
126
|
+
|
127
|
+
useEffect(() => {
|
128
|
+
setOptions({ ...staticOptions });
|
129
|
+
}, [chartData]);
|
130
|
+
|
131
|
+
return (
|
132
|
+
<HighchartsReact
|
133
|
+
containerProps={{
|
134
|
+
className: classnames(globalProps(props), className),
|
135
|
+
id: id,
|
136
|
+
...ariaProps,
|
137
|
+
...dataProps,
|
138
|
+
}}
|
139
|
+
highcharts={Highcharts}
|
140
|
+
options={options}
|
141
|
+
/>
|
142
|
+
);
|
143
|
+
};
|
144
|
+
|
145
|
+
export default BarGraph;
|
@@ -0,0 +1,216 @@
|
|
1
|
+
import React, { useEffect, useRef, useState } from "react";
|
2
|
+
import classnames from "classnames";
|
3
|
+
import HighchartsReact from "highcharts-react-official";
|
4
|
+
|
5
|
+
import Highcharts from "highcharts";
|
6
|
+
|
7
|
+
import { highchartsTheme } from "../pb_dashboard/pbChartsLightTheme";
|
8
|
+
import { highchartsDarkTheme } from "../pb_dashboard/pbChartsDarkTheme";
|
9
|
+
import mapColors from "../pb_dashboard/pbChartsColorsHelper";
|
10
|
+
import { globalProps } from "../utilities/globalProps";
|
11
|
+
import { buildAriaProps, buildDataProps } from "../utilities/props";
|
12
|
+
|
13
|
+
type CircleChartProps = {
|
14
|
+
align?: "left" | "right" | "center";
|
15
|
+
aria: { [key: string]: string };
|
16
|
+
chartData?: [];
|
17
|
+
children?: Node;
|
18
|
+
className?: string;
|
19
|
+
colors?: string[];
|
20
|
+
dark?: Boolean;
|
21
|
+
data?: Object;
|
22
|
+
dataLabelHtml?: string;
|
23
|
+
dataLabels?: boolean;
|
24
|
+
height?: string;
|
25
|
+
id?: string;
|
26
|
+
innerSize?: "sm" | "md" | "lg" | "none";
|
27
|
+
legend?: boolean;
|
28
|
+
maxPointSize?: number;
|
29
|
+
minPointSize?: number;
|
30
|
+
rounded?: boolean;
|
31
|
+
startAngle?: number;
|
32
|
+
style?: string;
|
33
|
+
title?: 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;
|
42
|
+
};
|
43
|
+
|
44
|
+
// Adjust Circle Chart Block Kit Dimensions to Match the Chart for Centering
|
45
|
+
const alignBlockElement = (event: any) => {
|
46
|
+
const itemToMove = document.querySelector(
|
47
|
+
`#wrapper-circle-chart-${event.target.renderTo.id} .pb-circle-chart-block`
|
48
|
+
) as HTMLElement;
|
49
|
+
const chartContainer = document.querySelector(`#${event.target.renderTo.id}`);
|
50
|
+
if (itemToMove !== null) {
|
51
|
+
itemToMove.style.height = `${event.target.chartHeight}px`;
|
52
|
+
itemToMove.style.width = `${event.target.chartWidth}px`;
|
53
|
+
chartContainer.firstChild.before(itemToMove);
|
54
|
+
}
|
55
|
+
};
|
56
|
+
|
57
|
+
const CircleChart = ({
|
58
|
+
align = "center",
|
59
|
+
aria = {},
|
60
|
+
rounded = false,
|
61
|
+
borderColor = rounded ? null : "",
|
62
|
+
borderWidth = rounded ? 20 : null,
|
63
|
+
chartData,
|
64
|
+
children,
|
65
|
+
className,
|
66
|
+
colors = [],
|
67
|
+
dark = false,
|
68
|
+
data = {},
|
69
|
+
dataLabelHtml = "<div>{point.name}</div>",
|
70
|
+
dataLabels = false,
|
71
|
+
height,
|
72
|
+
id,
|
73
|
+
innerSize = "md",
|
74
|
+
legend = false,
|
75
|
+
maxPointSize = null,
|
76
|
+
minPointSize = null,
|
77
|
+
startAngle = null,
|
78
|
+
style = "pie",
|
79
|
+
title,
|
80
|
+
useHtml = false,
|
81
|
+
zMin = null,
|
82
|
+
layout = "horizontal",
|
83
|
+
verticalAlign = "bottom",
|
84
|
+
x = 0,
|
85
|
+
y = 0,
|
86
|
+
...props
|
87
|
+
}: CircleChartProps) => {
|
88
|
+
const ariaProps = buildAriaProps(aria);
|
89
|
+
const dataProps = buildDataProps(data);
|
90
|
+
const setupTheme = () => {
|
91
|
+
dark
|
92
|
+
? Highcharts.setOptions(highchartsDarkTheme)
|
93
|
+
: Highcharts.setOptions(highchartsTheme);
|
94
|
+
};
|
95
|
+
setupTheme();
|
96
|
+
|
97
|
+
Highcharts.setOptions({
|
98
|
+
tooltip: {
|
99
|
+
headerFormat: null,
|
100
|
+
pointFormat:
|
101
|
+
'<span style="font-weight: bold; color:{point.color};">●</span>{point.name}: ' +
|
102
|
+
"<b>{point.y}</b>",
|
103
|
+
useHTML: useHtml,
|
104
|
+
},
|
105
|
+
});
|
106
|
+
|
107
|
+
const innerSizes = { sm: "35%", md: "50%", lg: "85%", none: "0%" };
|
108
|
+
const innerSizeFormat = (size: "sm" | "md" | "lg" | "none") =>
|
109
|
+
innerSizes[size];
|
110
|
+
|
111
|
+
const componentDidMount = useRef(false);
|
112
|
+
|
113
|
+
const [options, setOptions] = useState({});
|
114
|
+
|
115
|
+
useEffect(() => {
|
116
|
+
const formattedChartData = chartData.map((obj: any) => {
|
117
|
+
obj.y = obj.value;
|
118
|
+
delete obj.value;
|
119
|
+
return obj;
|
120
|
+
});
|
121
|
+
|
122
|
+
const staticOptions = {
|
123
|
+
title: {
|
124
|
+
text: title,
|
125
|
+
},
|
126
|
+
chart: {
|
127
|
+
height: height,
|
128
|
+
type: style,
|
129
|
+
events: {
|
130
|
+
render: (event: any) => alignBlockElement(event),
|
131
|
+
redraw: (event: any) => alignBlockElement(event),
|
132
|
+
},
|
133
|
+
},
|
134
|
+
|
135
|
+
legend: {
|
136
|
+
align: align,
|
137
|
+
verticalAlign: verticalAlign,
|
138
|
+
layout: layout,
|
139
|
+
x: x,
|
140
|
+
y: y,
|
141
|
+
},
|
142
|
+
plotOptions: {
|
143
|
+
pie: {
|
144
|
+
colors:
|
145
|
+
colors.length > 0 ? mapColors(colors) : highchartsTheme.colors,
|
146
|
+
dataLabels: {
|
147
|
+
enabled: dataLabels,
|
148
|
+
connectorShape: "straight",
|
149
|
+
connectorWidth: 3,
|
150
|
+
format: dataLabelHtml,
|
151
|
+
},
|
152
|
+
showInLegend: legend,
|
153
|
+
},
|
154
|
+
},
|
155
|
+
series: [
|
156
|
+
{
|
157
|
+
minPointSize: minPointSize,
|
158
|
+
maxPointSize: maxPointSize,
|
159
|
+
innerSize: borderWidth == 20 ? "100%" : innerSizeFormat(innerSize),
|
160
|
+
data: formattedChartData,
|
161
|
+
zMin: zMin,
|
162
|
+
startAngle: startAngle,
|
163
|
+
borderWidth: borderWidth,
|
164
|
+
borderColor: borderColor,
|
165
|
+
},
|
166
|
+
],
|
167
|
+
credits: false,
|
168
|
+
};
|
169
|
+
setOptions({ ...staticOptions });
|
170
|
+
if (componentDidMount.current) {
|
171
|
+
Highcharts.charts.forEach((chart: any) => {
|
172
|
+
if (chart && chart.renderTo.id === id) {
|
173
|
+
const updatedValueArray = chartData.map((obj: any) => {
|
174
|
+
return obj.value;
|
175
|
+
});
|
176
|
+
chart.series[0].setData(updatedValueArray);
|
177
|
+
}
|
178
|
+
});
|
179
|
+
} else {
|
180
|
+
componentDidMount.current = true;
|
181
|
+
}
|
182
|
+
}, [chartData]);
|
183
|
+
|
184
|
+
return (
|
185
|
+
<>
|
186
|
+
{children ? (
|
187
|
+
<div id={`wrapper-circle-chart-${id}`}>
|
188
|
+
<HighchartsReact
|
189
|
+
containerProps={{
|
190
|
+
className: classnames("pb_circle_chart", globalProps(props)),
|
191
|
+
id: id,
|
192
|
+
...ariaProps,
|
193
|
+
...dataProps,
|
194
|
+
}}
|
195
|
+
highcharts={Highcharts}
|
196
|
+
options={options}
|
197
|
+
/>
|
198
|
+
<div className="pb-circle-chart-block">{children}</div>
|
199
|
+
</div>
|
200
|
+
) : (
|
201
|
+
<HighchartsReact
|
202
|
+
containerProps={{
|
203
|
+
className: classnames("pb_circle_chart", globalProps(props)),
|
204
|
+
id: id,
|
205
|
+
...ariaProps,
|
206
|
+
...dataProps,
|
207
|
+
}}
|
208
|
+
highcharts={Highcharts}
|
209
|
+
options={options}
|
210
|
+
/>
|
211
|
+
)}
|
212
|
+
</>
|
213
|
+
);
|
214
|
+
};
|
215
|
+
|
216
|
+
export default CircleChart;
|
@@ -1,22 +1,10 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
<% content_for :pb_js do %>
|
8
|
-
<%= javascript_tag do %>
|
9
|
-
window.addEventListener('DOMContentLoaded', function() {
|
10
|
-
new pbChart('.selector', <%= object.chart_options %>)
|
11
|
-
|
12
|
-
});
|
13
|
-
<% end %>
|
14
|
-
<% end %>
|
15
|
-
<% end %>
|
16
|
-
|
17
|
-
<% if content.present? %>
|
18
|
-
<div class="pb-circle-chart-block">
|
19
|
-
<%= content %>
|
1
|
+
<% if content.present? %>
|
2
|
+
<div id=wrapper-circle-chart-<%= object.id %> >
|
3
|
+
<%= react_component('CircleChart', object.chart_options) %>
|
4
|
+
<div class="pb-circle-chart-block">
|
5
|
+
<%= content %>
|
6
|
+
</div>
|
20
7
|
</div>
|
21
|
-
|
22
|
-
|
8
|
+
<% else %>
|
9
|
+
<%= react_component('CircleChart', object.chart_options) %>
|
10
|
+
<% end %>
|
@@ -1,7 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
# rubocop:disable Style/HashLikeCase
|
4
|
-
|
5
3
|
module Playbook
|
6
4
|
module PbCircleChart
|
7
5
|
class CircleChart < Playbook::KitBase
|
@@ -13,7 +11,6 @@ module Playbook
|
|
13
11
|
prop :style, type: Playbook::Props::Enum,
|
14
12
|
values: %w[pie],
|
15
13
|
default: "pie"
|
16
|
-
|
17
14
|
prop :data_labels, type: Playbook::Props::Boolean, default: false
|
18
15
|
prop :min_point_size, type: Playbook::Props::Numeric
|
19
16
|
prop :max_point_size, type: Playbook::Props::Numeric
|
@@ -22,11 +19,8 @@ module Playbook
|
|
22
19
|
default: "md"
|
23
20
|
prop :z_min, type: Playbook::Props::Numeric
|
24
21
|
prop :start_angle, type: Playbook::Props::Numeric
|
25
|
-
prop :header_format
|
26
22
|
prop :data_label_html, default: "<div>{point.name}</div>"
|
27
|
-
prop :tooltip_html
|
28
|
-
{point.name}: ' + '<b>{point.y}
|
29
|
-
</b>'
|
23
|
+
prop :tooltip_html
|
30
24
|
prop :use_html, type: Playbook::Props::Boolean, default: false
|
31
25
|
prop :legend, type: Playbook::Props::Boolean, default: false
|
32
26
|
prop :title, default: ""
|
@@ -43,64 +37,32 @@ module Playbook
|
|
43
37
|
prop :x, type: Playbook::Props::Numeric
|
44
38
|
prop :y, type: Playbook::Props::Numeric
|
45
39
|
|
46
|
-
def chart_type
|
47
|
-
style == "variablepie" ? "variablepie" : "pie"
|
48
|
-
end
|
49
|
-
|
50
|
-
def chart_data_formatted
|
51
|
-
chart_data.map { |hash| hash[:y] = hash.delete :value }
|
52
|
-
chart_data
|
53
|
-
end
|
54
|
-
|
55
|
-
def inner_size_format
|
56
|
-
case inner_size
|
57
|
-
when "lg"
|
58
|
-
"85%"
|
59
|
-
when "sm"
|
60
|
-
"35%"
|
61
|
-
when "none"
|
62
|
-
"0%"
|
63
|
-
when "md"
|
64
|
-
"50%"
|
65
|
-
end
|
66
|
-
end
|
67
|
-
|
68
|
-
def rounded_border_width
|
69
|
-
rounded ? 20 : nil
|
70
|
-
end
|
71
|
-
|
72
|
-
def rounded_border_color
|
73
|
-
rounded == true ? "null" : nil
|
74
|
-
end
|
75
|
-
|
76
40
|
def chart_options
|
77
41
|
{
|
78
42
|
align: align,
|
79
43
|
id: id,
|
80
44
|
colors: colors,
|
81
|
-
|
82
|
-
borderWidth: rounded_border_width,
|
83
|
-
chartData: chart_data_formatted,
|
45
|
+
chartData: chart_data,
|
84
46
|
dark: dark ? "dark" : "",
|
85
47
|
title: title,
|
86
48
|
height: height,
|
87
|
-
type:
|
88
|
-
|
49
|
+
type: style,
|
50
|
+
legend: legend,
|
89
51
|
dataLabelHtml: data_label_html,
|
90
52
|
dataLabels: data_labels,
|
91
|
-
headerFormat: header_format,
|
92
53
|
tooltipHtml: tooltip_html,
|
93
54
|
useHTML: use_html,
|
94
55
|
minPointSize: min_point_size,
|
95
56
|
maxPointSize: max_point_size,
|
96
|
-
innerSize:
|
57
|
+
innerSize: inner_size,
|
97
58
|
zMin: z_min,
|
98
59
|
startAngle: start_angle,
|
60
|
+
rounded: rounded,
|
99
61
|
layout: layout,
|
100
62
|
verticalAlign: vertical_align,
|
101
63
|
x: x,
|
102
64
|
y: y,
|
103
|
-
}
|
65
|
+
}
|
104
66
|
end
|
105
67
|
|
106
68
|
def classname
|
@@ -109,5 +71,3 @@ module Playbook
|
|
109
71
|
end
|
110
72
|
end
|
111
73
|
end
|
112
|
-
|
113
|
-
# rubocop:enable Style/HashLikeCase
|
@@ -0,0 +1,16 @@
|
|
1
|
+
import colors from "../tokens/exports/_colors.scss";
|
2
|
+
|
3
|
+
|
4
|
+
// Map Data Color String Props to our SCSS Variables
|
5
|
+
const mapColors = (array: string[]) => {
|
6
|
+
const regex = /(data)\-[1-8]/; //eslint-disable-line
|
7
|
+
|
8
|
+
const newArray = array.map((item) => {
|
9
|
+
return regex.test(item)
|
10
|
+
? `${colors[`data_${item[item.length - 1]}`]}`
|
11
|
+
: item;
|
12
|
+
});
|
13
|
+
return newArray;
|
14
|
+
};
|
15
|
+
|
16
|
+
export default mapColors
|
@@ -1,9 +1,11 @@
|
|
1
1
|
import colors from '../tokens/exports/_colors.scss'
|
2
2
|
import typography from '../tokens/exports/_typography.scss'
|
3
3
|
|
4
|
+
import { ThemeProps } from './themeTypes'
|
5
|
+
|
4
6
|
import Highcharts from 'highcharts'
|
5
7
|
|
6
|
-
const highchartsDarkTheme = {
|
8
|
+
const highchartsDarkTheme: ThemeProps = {
|
7
9
|
lang: {
|
8
10
|
thousandsSep: ',',
|
9
11
|
},
|
@@ -150,26 +152,6 @@ const highchartsDarkTheme = {
|
|
150
152
|
},
|
151
153
|
threshold: null,
|
152
154
|
},
|
153
|
-
|
154
|
-
// GAUGE STYLES
|
155
|
-
solidgauge: {
|
156
|
-
borderColor: colors.primary,
|
157
|
-
borderWidth: 20,
|
158
|
-
radius: 90,
|
159
|
-
innerRadius: '90%',
|
160
|
-
dataLabels: {
|
161
|
-
borderWidth: 0,
|
162
|
-
color: colors.text_dk_default,
|
163
|
-
enabled: true,
|
164
|
-
style: {
|
165
|
-
fontFamily: typography.font_family_base,
|
166
|
-
fontWeight: typography.regular,
|
167
|
-
fontSize: typography.heading_2,
|
168
|
-
},
|
169
|
-
y: -26,
|
170
|
-
},
|
171
|
-
},
|
172
|
-
|
173
155
|
// PIE STYLES
|
174
156
|
pie: {
|
175
157
|
colors: [
|
@@ -247,6 +229,9 @@ const highchartsDarkTheme = {
|
|
247
229
|
}
|
248
230
|
},
|
249
231
|
},
|
232
|
+
credits: {
|
233
|
+
enabled: false
|
234
|
+
},
|
250
235
|
}
|
251
236
|
|
252
237
|
export { highchartsDarkTheme }
|
@@ -1,9 +1,11 @@
|
|
1
1
|
import colors from '../tokens/exports/_colors.scss'
|
2
2
|
import typography from '../tokens/exports/_typography.scss'
|
3
3
|
|
4
|
+
import { ThemeProps } from './themeTypes'
|
5
|
+
|
4
6
|
import Highcharts from 'highcharts'
|
5
7
|
|
6
|
-
const highchartsTheme = {
|
8
|
+
const highchartsTheme: ThemeProps = {
|
7
9
|
lang: {
|
8
10
|
thousandsSep: ',',
|
9
11
|
},
|
@@ -150,26 +152,6 @@ const highchartsTheme = {
|
|
150
152
|
},
|
151
153
|
threshold: null,
|
152
154
|
},
|
153
|
-
|
154
|
-
// GAUGE STYLES
|
155
|
-
solidgauge: {
|
156
|
-
borderColor: colors.primary,
|
157
|
-
borderWidth: 20,
|
158
|
-
radius: 90,
|
159
|
-
innerRadius: '90%',
|
160
|
-
dataLabels: {
|
161
|
-
borderWidth: 0,
|
162
|
-
color: colors.text_lt_default,
|
163
|
-
enabled: true,
|
164
|
-
style: {
|
165
|
-
fontFamily: typography.font_family_base,
|
166
|
-
fontWeight: typography.regular,
|
167
|
-
fontSize: typography.heading_2,
|
168
|
-
},
|
169
|
-
y: -26,
|
170
|
-
},
|
171
|
-
},
|
172
|
-
|
173
155
|
// PIE STYLES
|
174
156
|
pie: {
|
175
157
|
colors: [
|
@@ -247,6 +229,9 @@ const highchartsTheme = {
|
|
247
229
|
}
|
248
230
|
},
|
249
231
|
},
|
232
|
+
credits: {
|
233
|
+
enabled: false
|
234
|
+
},
|
250
235
|
}
|
251
236
|
|
252
237
|
export { highchartsTheme }
|
@@ -0,0 +1,16 @@
|
|
1
|
+
export type ThemeProps = {
|
2
|
+
lang?: {[key: string]: string}
|
3
|
+
credits?: {[key: string]: boolean}
|
4
|
+
colors?: string[]
|
5
|
+
chart?: {[key: string]: any}
|
6
|
+
title?: {[key: string]: string | {}}
|
7
|
+
subtitle?: {[key: string]: string | {};}
|
8
|
+
xAxis?: {[key: string]: any;}
|
9
|
+
yAxis?: {[key: string]: any;}
|
10
|
+
legend?: {[key: string]: string | {};}
|
11
|
+
labels?: {[key: string]: {};}
|
12
|
+
tooltip?: {[key: string]: any;}
|
13
|
+
pane?: {[key: string]: {};}
|
14
|
+
plotOptions?: {[key: string]: any;}
|
15
|
+
colorKey?: string
|
16
|
+
}
|