<% data_51 = [{ name: 'Waiting for Calls', value: 41, }, { name: 'On Call', value: 49, }, { name: 'After call', value: 10, } ] %> <br><br> <%= pb_rails("circle_chart", props: { chart_data: data_51, id: "with-a-block-2", rounded: true, }) do %> <%= pb_rails('title', props: {text: "83", size: 1, tag: 'div'}) %> <% end %>
Custom data colors allow for color customization to match the needs of business requirements.
Pass the prop colors
and use desired values data-1 | data-2 | data-3 | data-4 | data-5 | data-6 | data-7 | data-8
in an array. Hex colors are also available eg: #CA0095
<% data = [{ name: 'Facebook', value: 2498, }, { name: 'YouTube', value: 2000, }, { name: 'WhatsApp', value: 2000, }, { name: 'Facebook Messenger', value: 1300, }, { name: 'WeChat', value: 1165, }, { name: 'Instagram', value: 1000, }, { name: 'Tik Tok', value: 800, }, ] %> <%= pb_rails("circle_chart", props: { style: "pie", chart_data: data, id: "with-labels-example", data_labels: true }) %>
align
Type: String | Values: left | center | right (defaults to center)
verticalAlign
Type: String | Values: top | middle | bottom (defaults middle)
layout
Type: String | Values: horizontal | vertical | proximate (defaults to horizontal)
x
Type: Number (defaults to 0)
y
Type: Number (defaults to 0)
layout
determines the position of the legend items
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.
x
offsets the legend relative to its horizontal alignmnet. Negative x moves it to the left, positive x moves it to the right
y
offsets the legend relative to its vertical alignmnet. Negative y moves it up, positive y moves it down.
<% data = [{ name: 'Waiting for Calls', value: 41, }, { name: 'On Call', value: 49, }, { name: 'After call', value: 10, } ] %> <% data_1 = [{ name: 'Bugs', value: 8, }, { name: 'Chores', value: 1, }, { name: 'Stories', value: 12, } ] %> <% data_2 = [{ name: 'Queued', value: 7, }, { name: 'In Progress', value: 6, }, { name: 'Validation', value: 3, }, { name: 'Done', value: 6, }, ] %> <%= pb_rails("title", props: {size: 4, text: "align | vertical_align", padding_top: "sm", padding_bottom: "sm"})%> <%= pb_rails("circle_chart", props: { style: "pie", chart_data: data, legend: true, id: "legend-position-circle", title: 'Alignment of Legend', align: 'right', vertical_align: 'top', padding_bottom: "sm", }) %> <%= pb_rails("title", props: {size: 4, text: "layout", padding_top: "sm", padding_bottom: "sm"})%> <%= pb_rails("circle_chart", props: { style: "pie", chart_data: data_1, legend: true, id: "legend-position-circle-1", title: 'Layout of Legend', layout: 'vertical', padding_top: "sm", padding_bottom: "sm", }) %> <%= pb_rails("title", props: {size: 4, text: "x | y", padding_top: "sm", padding_bottom: "sm"})%> <%= pb_rails("circle_chart", props: { style: "pie", chart_data: data_2, legend: true, title: 'Offset of Legend', id: "legend-position-circle-2", x: 100, y: 10, padding_top: "sm", }) %>
<% data_5 = [{ name: 'Facebook', value: 2498, }, { name: 'YouTube', value: 2000, }, { name: 'WhatsApp', value: 2000, }, { name: 'Facebook Messenger', value: 1300, }, { name: 'WeChat', value: 1165, }, { name: 'Instagram', value: 1000, }, { name: 'Tik Tok', value: 800, }, ] %> <%= pb_rails("circle_chart", props: { style: "pie", title: "Active Users on Social Media", chart_data: data_5, id: "with-caption-example", }) %>
<% data_1 = [{ name: 'Bugs', value: 8, }, { name: 'Chores', value: 1, }, { name: 'Stories', value: 12, } ] %> <% data_2 = [{ name: 'Queued', value: 7, }, { name: 'In Progress', value: 6, }, { name: 'Validation', value: 3, }, { name: 'Done', value: 6, }, ] %> <% data_3 = [{ name: '1 Point Tickets', value: 2, }, { name: '3 Point Tickets', value: 5, }, { name: '5 Point Tickets', value: 6, }, { name: '8 Point Tickets', value: 3, }, { name: '13 Point Tickets', value: 1, }, ] %> <% data_4 = [{ name: 'Facebook', value: 2498, }, { name: 'YouTube', value: 2000, }, { name: 'WhatsApp', value: 2000, }, { name: 'Facebook Messenger', value: 1300, }, { name: 'WeChat', value: 1165, }, { name: 'Instagram', value: 1000, }, { name: 'Tik Tok', value: 800, }, ] %> <%= pb_rails("circle_chart", props: { chart_data: data_1, id: "size-test-1", min_point_size: 2, max_point_size: 200, inner_size: "sm", z_min: 0, start_angle: 0, header_format: '', }) %> <%= pb_rails("circle_chart", props: { chart_data: data_2, id: "size-test-2", min_point_size: 2, max_point_size: 200, inner_size: "md", z_min: 0, start_angle: 0, header_format: '', }) %> <%= pb_rails("circle_chart", props: { chart_data: data_3, id: "size-test-3", min_point_size: 2, max_point_size: 200, inner_size: "lg", z_min: 0, start_angle: 0, header_format: '', }) %> <%= pb_rails("circle_chart", props: { chart_data: data_4, id: "size-test-4", min_point_size: 2, max_point_size: 200, inner_size: "none", z_min: 0, start_angle: 0, header_format: '', }) %>
A custom tooltip format can be specified. The desired format can be passed as a string
of custom HTML to the tooltipHtml
prop.
{point.name}
and {point.y}
are useful values that can be referenced for each point in the graph.
<% data = [{ name: 'Waiting for Calls', value: 41, }, { name: 'On Call', value: 49, }, { name: 'After call', value: 10, } ] %> <%= pb_rails("circle_chart", props: { chart_data: data, tooltip_html: "<p>Custom tooltip for {point.name} <br/>with value: {point.y}</p>", id: "default-test" }) %>
Props | Type | Values |
---|---|---|
max_width |
array
|
0%
xs
sm
md
lg
xl
xxl
0
none
100%
|
min_width |
array
|
0%
xs
sm
md
lg
xl
xxl
0
none
100%
|
z_index |
array
|
1
2
3
4
5
6
7
8
9
10
|
number_spacing |
array
|
tabular
|
shadow |
array
|
none
deep
deeper
deepest
|
line_height |
array
|
tightest
tighter
tight
normal
loose
looser
loosest
|
display |
array
|
block
inline_block
inline
flex
inline_flex
none
|
cursor |
array
|
auto
default
none
contextMenu
help
pointer
progress
wait
cell
crosshair
text
verticalText
alias
copy
move
noDrop
notAllowed
grab
grabbing
eResize
nResize
neResize
nwResize
sResize
seResize
swResize
wResize
ewResize
nsResize
neswResize
nwseResize
colResize
rowResize
allScroll
zoomIn
zoomOut
|
flex_direction |
array
|
row
column
rowReverse
columnReverse
|
flex_wrap |
array
|
wrap
nowrap
wrapReverse
|
justify_content |
array
|
start
end
center
spaceBetween
spaceAround
spaceEvenly
|
justify_self |
array
|
auto
start
end
center
stretch
|
align_items |
array
|
flexStart
flexEnd
start
end
center
baseline
stretch
|
align_content |
array
|
start
end
center
spaceBetween
spaceAround
spaceEvenly
|
align_self |
array
|
auto
start
end
center
stretch
baseline
|
flex |
array
|
auto
initial
0
1
2
3
4
5
6
7
8
9
10
11
12
none
|
flex_grow |
array
|
1
0
|
flex_shrink |
array
|
1
0
|
order |
array
|
1
2
3
4
5
6
7
8
9
10
11
12
|
position |
array
|
relative
absolute
fixed
sticky
|
hover |
array
|
|
border_radius |
array
|
none
xs
sm
md
lg
xl
rounded
|
text_align |
array
|
start
end
left
right
center
justify
justify-all
match-parent
|
overflow |
array
|
visible
hidden
scroll
auto
|
truncate |
array
|
1
2
3
4
5
|
left |
array
|
0
xxs
xs
sm
md
lg
xl
auto
initial
inherit
|
top |
array
|
0
xxs
xs
sm
md
lg
xl
auto
initial
inherit
|
right |
array
|
0
xxs
xs
sm
md
lg
xl
auto
initial
inherit
|
bottom |
array
|
0
xxs
xs
sm
md
lg
xl
auto
initial
inherit
|
overflow_x |
array
|
visible
hidden
scroll
auto
|
overflow_y |
array
|
visible
hidden
scroll
auto
|
margin |
array
|
none
xxs
xs
sm
md
lg
xl
|
margin_bottom |
array
|
none
xxs
xs
sm
md
lg
xl
|
margin_left |
array
|
none
xxs
xs
sm
md
lg
xl
|
margin_right |
array
|
none
xxs
xs
sm
md
lg
xl
|
margin_top |
array
|
none
xxs
xs
sm
md
lg
xl
|
margin_x |
array
|
none
xxs
xs
sm
md
lg
xl
|
margin_y |
array
|
none
xxs
xs
sm
md
lg
xl
|
padding |
array
|
none
xxs
xs
sm
md
lg
xl
|
padding_bottom |
array
|
none
xxs
xs
sm
md
lg
xl
|
padding_left |
array
|
none
xxs
xs
sm
md
lg
xl
|
padding_right |
array
|
none
xxs
xs
sm
md
lg
xl
|
padding_top |
array
|
none
xxs
xs
sm
md
lg
xl
|
padding_x |
array
|
none
xxs
xs
sm
md
lg
xl
|
padding_y |
array
|
none
xxs
xs
sm
md
lg
xl
|
classname |
string
|
|
dark |
boolean
|
|
id |
string
|
|
data |
hashprop
|
|
aria |
hashprop
|
|
html_options |
hashprop
|
|
children |
proc
|
Props | Type | Values | Default |
---|---|---|---|
vertical_align |
enum
|
top
middle
bottom
|
bottom
|
align |
enum
|
left
right
center
|
center
|
border_width |
numeric
|
||
chart_data |
array
|
||
custom_options |
string
|
||
style |
enum
|
pie
|
pie
|
data_labels |
boolean
|
false
|
|
min_point_size |
numeric
|
||
max_point_size |
numeric
|
||
inner_size |
enum
|
sm
md
lg
none
|
md
|
z_min |
numeric
|
||
start_angle |
numeric
|
||
data_label_html |
string
|
<div>{point.name}</div>
|
|
tooltip_html |
string
|
<span style="font-weight: bold; color:{point.color};">● </span>
{point.name}: <b>{point.y}
</b>
|
|
use_html |
boolean
|
false
|
|
legend |
boolean
|
false
|
|
title |
string
|
||
height |
string
|
||
rounded |
boolean
|
false
|
|
colors |
array
|
||
layout |
enum
|
horizontal
vertical
proximate
|
horizontal
|
x |
numeric
|
||
y |
numeric
|