<% data1 = [ { name: 'Data Used', value: 32, } ]%> <%= pb_rails("gauge", props: { id: "gauge-units1", chart_data: data1, title: "Data Usage", suffix: "GB" }) %> <% data2 = [ { name: 'Sales to Date', value: 65, } ]%> <%= pb_rails("gauge", props: { id: "gauge-units2", chart_data: data2, title: "Sales Goal", prefix: "$", suffix: "k", }) %>
overflow
to hidden on the parent element when nesting gauges inside of a flex items to best respond to shrinking screens. <%= pb_rails("flex", props: {wrap: true, align: "center"}) do %> <%= pb_rails("flex/flex_item", props: {fixed_size: "400px", overflow: "hidden", shrink: true }) do %> <%= pb_rails("gauge", props: { id: "gauge-sizing4", chart_data: [{ name: "Point 1", value: 100 }], }) %> <% end %> <%= pb_rails("flex/flex_item", props: {fixed_size: "300px", overflow: "hidden", shrink: true }) do %> <%= pb_rails("gauge", props: { id: "gauge-sizing3", chart_data: [{ name: "Point 2", value: 75 }], }) %> <% end %> <%= pb_rails("flex/flex_item", props: {fixed_size: "200px", overflow: "hidden", shrink: true }) do %> <%= pb_rails("gauge", props: { id: "gauge-sizing2", chart_data: [{ name: "Point 3", value: 50 }], }) %> <% end %> <%= pb_rails("flex/flex_item", props: {fixed_size: "125px", overflow: "hidden", shrink: true }) do %> <%= pb_rails("gauge", props: { id: "gauge-sizing1", height: '100%', chart_data: [{ name: "Point 4", value: 25 }], }) %> <% end %> <% end %>
<%= pb_rails("gauge", props: { id: "gauge-height-px", chart_data: [{ name: "Pixels", value: 400 }], height: '400', title: "Fixed Height in Pixels", suffix: "px" }) %> <%= pb_rails("gauge", props: { id: "gauge-height-percent", chart_data: [{ name: "Percentage", value: 45 }], height: '45%', title: "Height as Percentage of Width", suffix: "%" }) %>
Custom data colors allow for color customization to match the needs of business requirements.
Pass the prop colors
and use ONE desired value 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
We are able to wrap our Gauge kits within multiple other Flex and Card components.
<%= pb_rails("flex", props: {wrap: true, padding: "xl", gap: "sm"}) do %> <%= pb_rails("flex/flex_item", props: {flex: 1, grow: true }) do %> <%= pb_rails("card", props: {max_width: "xs", padding: "md", }) do %> <%= pb_rails("title", props: {padding_bottom: "sm", size: 4, text: "Abandoned Calls" })%> <%= pb_rails("flex", props: {align: "stretch"}) do %> <%= pb_rails("flex", props: {margin_right: "sm", orientation: "column"}) do %> <%= pb_rails("body", props: {color: "light", padding_bottom: "sm",text: "Total Abandoned"}) %> <%= pb_rails("flex", props: {align: "baseline", padding_bottom: "sx"}) do %> <%= pb_rails("title", props: {size: 1, text: "39"})%> <%= pb_rails("title", props: {color: "light", size: 3, text: "calls"}) %> <% end %> <%= pb_rails("caption", props: {size: "xs", text: "of 390" }) %> <%end %> <%= pb_rails("section_separator", props: {align_self: "stretch", margin_right: "sm", orientation: "vertical" }) %> <%= pb_rails("flex", props: {orientation: "column", wrap: true}) do %> <%= pb_rails("body", props: {color: "light", text: "% Abandoned"}) %> <%= pb_rails("flex", props: {wrap: true}) do %> <%= pb_rails("flex/flex_item", props: {fixed_size: "150px", overflow: "hidden", shrink: true}) do %> <%= pb_rails("gauge", props: { chart_data: [{ name: "Name", value: 10 }], disable_animation: true, height: '150', id: "gauge-complex", suffix: "%" }) %> <% end %> <% end %> <% end %> <%end %> <% end %> <% end %> <% end %>
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
|
vertical_align |
array
|
baseline
super
top
middle
bottom
sub
text-top
text-bottom
|
min_height |
array
|
auto
xs
sm
md
lg
xl
xxl
xxxl
|
max_height |
array
|
auto
xs
sm
md
lg
xl
xxl
xxxl
|
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
|
|
group_hover |
boolean
|
|
id |
string
|
|
data |
hashprop
|
|
aria |
hashprop
|
|
html_options |
hashprop
|
|
children |
proc
|
Props | Type | Values | Default |
---|---|---|---|
height |
string
|
||
style |
enum
|
solidgauge
|
solidgauge
|
chart_data |
array
|
[{:name=>"Name", :value=>0}]
|
|
custom_options |
string
|
||
title |
string
|
||
prefix |
string
|
||
suffix |
string
|
||
tooltip_html |
string
|
<span style="font-weight: bold; color:{point.color};">●</span>
{point.name}: <b>{point.y}
</b>
|
|
full_circle |
boolean
|
false
|
|
show_labels |
boolean
|
false
|
|
disable_animation |
boolean
|
false
|
|
min |
numeric
|
0
|
|
max |
numeric
|
100
|
|
colors |
array
|