Skip to content

Commit

Permalink
Merge PR #43 from sarayumummidi/main
Browse files Browse the repository at this point in the history
Added Corner Radius Config Option for Bar Chart
  • Loading branch information
GeorgeBerdovskiy authored Apr 20, 2024
2 parents 3df5422 + e07afe0 commit 7eab149
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/views/_bar.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<div class="chart" style="border-left: <%= style['axes']['style'] %>; border-bottom: <%= style['axes']['style'] %>">
<div class="chart-elements">
<%- data.each do |object| %>
<div class="bar bar-chart-bar" style="width: <%= object[:width] %>%; background-color: <%= style['colors'][object[:color]] || object[:color] %>;">
<div class="bar bar-chart-bar" style="width: <%= object[:width] %>%; background-color: <%= style['colors'][object[:color]] || object[:color] %>; border-top-right-radius: <%= configuration[:corner_radius] %>; border-bottom-right-radius: <%= configuration[:corner_radius] %>;">
<p class="bar-title bar-chart-bar-title" style="font-family: <%= style['labels']['font'] %>; font-weight: <%= style['labels']['weight'] %>; color: <%= style['labels']['color'] %>"><%= object[:name] %></p>
<div class="tooltip">
<p style="color: <%= style['colors'][object[:color]] || object[:color] %>;"><%= object[:name] %></p>
Expand Down
2 changes: 2 additions & 0 deletions app/views/_styles.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,8 @@ h4.purechart {

margin-bottom: 32px;
position: relative;
border-top-right-radius: 5px;
border-bottom-right-radius: 5px;

cursor: pointer;
z-index: 1;
Expand Down
2 changes: 1 addition & 1 deletion lib/purechart/chart_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def lollipop_chart(data, configuration = { axes: { horizontal: "Value" } }, path
}
end

def bar_chart(data, configuration = { axes: { horizontal: "Value" } }, path="")
def bar_chart(data, configuration = { axes: { horizontal: "Value" }, corner_radius: "Value" }, path="")
# Set default configuration file path
default_config_path = File.join( File.dirname(__FILE__), 'styles/default.yml' )

Expand Down

0 comments on commit 7eab149

Please sign in to comment.