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
@@ -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
- <div id="wrapper-circle-chart-<%= object.id %>">
2
- <%= content_tag(:div, "",
3
- aria: object.aria,
4
- id: object.id,
5
- data: object.data,
6
- class: object.classname) do %>
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
- <% end %>
22
- </div>
8
+ <% else %>
9
+ <%= react_component('CircleChart', object.chart_options) %>
10
+ <% end %>
@@ -1,16 +1,16 @@
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
6
+ prop :align, type: Playbook::Props::Enum,
7
+ values: %w[left right center],
8
+ default: "center"
8
9
  prop :chart_data, type: Playbook::Props::Array,
9
10
  default: []
10
11
  prop :style, type: Playbook::Props::Enum,
11
12
  values: %w[pie],
12
13
  default: "pie"
13
-
14
14
  prop :data_labels, type: Playbook::Props::Boolean, default: false
15
15
  prop :min_point_size, type: Playbook::Props::Numeric
16
16
  prop :max_point_size, type: Playbook::Props::Numeric
@@ -19,11 +19,8 @@ module Playbook
19
19
  default: "md"
20
20
  prop :z_min, type: Playbook::Props::Numeric
21
21
  prop :start_angle, type: Playbook::Props::Numeric
22
- prop :header_format
23
22
  prop :data_label_html, default: "<div>{point.name}</div>"
24
- prop :tooltip_html, default: '<span style="font-weight: bold; color:{point.color};">●</span>
25
- {point.name}: ' + '<b>{point.y}
26
- </b>'
23
+ prop :tooltip_html
27
24
  prop :use_html, type: Playbook::Props::Boolean, default: false
28
25
  prop :legend, type: Playbook::Props::Boolean, default: false
29
26
  prop :title, default: ""
@@ -31,60 +28,41 @@ module Playbook
31
28
  prop :rounded, type: Playbook::Props::Boolean, default: false
32
29
  prop :colors, type: Playbook::Props::Array,
33
30
  default: []
34
-
35
- def chart_type
36
- style == "variablepie" ? "variablepie" : "pie"
37
- end
38
-
39
- def chart_data_formatted
40
- chart_data.map { |hash| hash[:y] = hash.delete :value }
41
- chart_data
42
- end
43
-
44
- def inner_size_format
45
- case inner_size
46
- when "lg"
47
- "85%"
48
- when "sm"
49
- "35%"
50
- when "none"
51
- "0%"
52
- when "md"
53
- "50%"
54
- end
55
- end
56
-
57
- def rounded_border_width
58
- rounded ? 20 : nil
59
- end
60
-
61
- def rounded_border_color
62
- rounded == true ? "null" : nil
63
- end
31
+ prop :layout, type: Playbook::Props::Enum,
32
+ values: %w[horizontal vertical proximate],
33
+ default: "horizontal"
34
+ prop :vertical_align, type: Playbook::Props::Enum,
35
+ values: %w[top middle bottom],
36
+ default: "bottom"
37
+ prop :x, type: Playbook::Props::Numeric
38
+ prop :y, type: Playbook::Props::Numeric
64
39
 
65
40
  def chart_options
66
41
  {
42
+ align: align,
67
43
  id: id,
68
44
  colors: colors,
69
- borderColor: rounded_border_color,
70
- borderWidth: rounded_border_width,
71
- chartData: chart_data_formatted,
45
+ chartData: chart_data,
72
46
  dark: dark ? "dark" : "",
73
47
  title: title,
74
48
  height: height,
75
- type: chart_type,
76
- showInLegend: legend,
49
+ type: style,
50
+ legend: legend,
77
51
  dataLabelHtml: data_label_html,
78
52
  dataLabels: data_labels,
79
- headerFormat: header_format,
80
53
  tooltipHtml: tooltip_html,
81
54
  useHTML: use_html,
82
55
  minPointSize: min_point_size,
83
56
  maxPointSize: max_point_size,
84
- innerSize: inner_size_format,
57
+ innerSize: inner_size,
85
58
  zMin: z_min,
86
59
  startAngle: start_angle,
87
- }.to_json.html_safe
60
+ rounded: rounded,
61
+ layout: layout,
62
+ verticalAlign: vertical_align,
63
+ x: x,
64
+ y: y,
65
+ }
88
66
  end
89
67
 
90
68
  def classname
@@ -93,5 +71,3 @@ module Playbook
93
71
  end
94
72
  end
95
73
  end
96
-
97
- # rubocop:enable Style/HashLikeCase
@@ -0,0 +1,86 @@
1
+ <% data = [{
2
+ name: 'Waiting for Calls',
3
+ value: 41,
4
+ },
5
+ {
6
+ name: 'On Call',
7
+ value: 49,
8
+ },
9
+ {
10
+ name: 'After call',
11
+ value: 10,
12
+ }
13
+ ] %>
14
+
15
+ <% data_1 = [{
16
+ name: 'Bugs',
17
+ value: 8,
18
+ },
19
+ {
20
+ name: 'Chores',
21
+ value: 1,
22
+ },
23
+ {
24
+ name: 'Stories',
25
+ value: 12,
26
+ }
27
+ ] %>
28
+
29
+ <% data_2 = [{
30
+ name: 'Queued',
31
+ value: 7,
32
+ },
33
+ {
34
+ name: 'In Progress',
35
+ value: 6,
36
+
37
+ },
38
+ {
39
+ name: 'Validation',
40
+ value: 3,
41
+ },
42
+ {
43
+ name: 'Done',
44
+ value: 6,
45
+ },
46
+ ] %>
47
+
48
+
49
+ <%= pb_rails("title", props: {size: 4, text: "align | vertical_align", padding_top: "sm", padding_bottom: "sm"})%>
50
+
51
+ <%= pb_rails("circle_chart", props: {
52
+ style: "pie",
53
+ chart_data: data,
54
+ legend: true,
55
+ id: "legend-position-circle",
56
+ title: 'Alignment of Legend',
57
+ align: 'right',
58
+ vertical_align: 'top',
59
+ padding_bottom: "sm",
60
+ }) %>
61
+
62
+ <%= pb_rails("title", props: {size: 4, text: "layout", padding_top: "sm", padding_bottom: "sm"})%>
63
+
64
+ <%= pb_rails("circle_chart", props: {
65
+ style: "pie",
66
+ chart_data: data_1,
67
+ legend: true,
68
+ id: "legend-position-circle-1",
69
+ title: 'Layout of Legend',
70
+ layout: 'vertical',
71
+ padding_top: "sm",
72
+ padding_bottom: "sm",
73
+ }) %>
74
+
75
+ <%= pb_rails("title", props: {size: 4, text: "x | y", padding_top: "sm", padding_bottom: "sm"})%>
76
+
77
+ <%= pb_rails("circle_chart", props: {
78
+ style: "pie",
79
+ chart_data: data_2,
80
+ legend: true,
81
+ title: 'Offset of Legend',
82
+ id: "legend-position-circle-2",
83
+ x: 100,
84
+ y: 10,
85
+ padding_top: "sm",
86
+ }) %>
@@ -0,0 +1,114 @@
1
+ import React from 'react'
2
+
3
+ import CircleChart from '../_circle_chart'
4
+
5
+ import {Title} from '../..'
6
+
7
+ const data = [
8
+ {
9
+ name: 'Waiting for Calls',
10
+ value: 41,
11
+ },
12
+ {
13
+ name: 'On Call',
14
+ value: 49,
15
+ },
16
+ {
17
+ name: 'After call',
18
+ value: 10,
19
+ },
20
+ ]
21
+
22
+ const dataFirst = [{
23
+ name: 'Bugs',
24
+ value: 8,
25
+
26
+ },
27
+ {
28
+ name: 'Chores',
29
+ value: 1,
30
+
31
+ },
32
+ {
33
+ name: 'Stories',
34
+ value: 12,
35
+ },
36
+ ]
37
+
38
+ const dataSecond = [
39
+ {
40
+ name: 'Queued',
41
+ value: 7,
42
+ },
43
+ {
44
+ name: 'In Progress',
45
+ value: 6,
46
+ },
47
+ {
48
+ name: 'Validation',
49
+ value: 3,
50
+ },
51
+ {
52
+ name: 'Done',
53
+ value: 6,
54
+ },
55
+ ]
56
+
57
+
58
+ const CircleChartLegendPosition = (props) => (
59
+ <div>
60
+ <Title
61
+ paddingBottom="sm"
62
+ paddingTop="sm"
63
+ size={4}
64
+ tag="h4"
65
+ text="align | verticalAlign"
66
+ />
67
+ <CircleChart
68
+ align='right'
69
+ chartData={data}
70
+ id="legend-position-circle"
71
+ legend
72
+ paddingBottom="sm"
73
+ title="Alignment of Legend"
74
+ verticalAlign="top"
75
+ {...props}
76
+ />
77
+ <Title
78
+ paddingBottom="sm"
79
+ paddingTop="sm"
80
+ size={4}
81
+ tag="h4"
82
+ text="layout"
83
+ />
84
+ <CircleChart
85
+ chartData={dataFirst}
86
+ id="legend-position-circle-1"
87
+ layout="vertical"
88
+ legend
89
+ paddingBottom="sm"
90
+ paddingTop="sm"
91
+ title="Layout of Legend"
92
+ {...props}
93
+ />
94
+ <Title
95
+ paddingBottom="sm"
96
+ paddingTop="sm"
97
+ size={4}
98
+ tag="h4"
99
+ text="x | y"
100
+ />
101
+ <CircleChart
102
+ chartData={dataSecond}
103
+ id="legend-position-circle-2"
104
+ layout="vertical"
105
+ legend
106
+ title="Offset of Legend"
107
+ x={100}
108
+ y={10}
109
+ {...props}
110
+ />
111
+ </div>
112
+ )
113
+
114
+ export default CircleChartLegendPosition
@@ -0,0 +1,17 @@
1
+ ##### Prop
2
+
3
+ `align` **Type**: String | **Values**: left | center | right (defaults to center)
4
+ `verticalAlign` **Type**: String | **Values**: top | middle | bottom (defaults middle)
5
+ `layout` **Type**: String | **Values**: horizontal | vertical | proximate (defaults to horizontal)
6
+ `x` **Type**: Number (defaults to 0)
7
+ `y` **Type**: Number (defaults to 0)
8
+
9
+ -
10
+
11
+ - `layout` determines the position of the legend items
12
+ `layout: proximate` will place the legend items as close as possible to the graphs they're representing. It will also determine whether to place the legend above/below or on the side of the plot area, if the legend is in a corner.
13
+
14
+ - `x` offsets the legend relative to its horizontal alignmnet. Negative x moves it to the left, positive x moves it to the right
15
+
16
+
17
+ - `y` offsets the legend relative to its vertical alignmnet. Negative y moves it up, positive y moves it down.
@@ -7,6 +7,7 @@ examples:
7
7
  - circle_chart_colors: Color Overrides
8
8
  - circle_chart_with_labels: Data Labels
9
9
  - circle_chart_with_legend_kit: Legend
10
+ - circle_chart_legend_position: Legend Position
10
11
  - circle_chart_with_title: Title
11
12
  - circle_chart_inner_sizes: Inner Circle Size Options
12
13
 
@@ -18,6 +19,7 @@ examples:
18
19
  - circle_chart_colors: Color Overrides
19
20
  - circle_chart_with_labels: Data Labels
20
21
  - circle_chart_with_legend_kit: Legend
22
+ - circle_chart_legend_position: Legend Position
21
23
  - circle_chart_with_title: Title
22
24
  - circle_chart_inner_sizes: Inner Circle Size Options
23
25
 
@@ -5,5 +5,6 @@ export { default as CircleChartBlock } from './_circle_chart_block.jsx'
5
5
  export { default as CircleChartColors } from './_circle_chart_colors.jsx'
6
6
  export { default as CircleChartWithLabels } from './_circle_chart_with_labels.jsx'
7
7
  export { default as CircleChartWithLegendKit } from './_circle_chart_with_legend_kit.jsx'
8
+ export { default as CircleChartLegendPosition } from './_circle_chart_legend_position.jsx'
8
9
  export { default as CircleChartWithTitle } from './_circle_chart_with_title.jsx'
9
10
  export { default as CircleChartInnerSizes } from './_circle_chart_inner_sizes.jsx'
@@ -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 }