Pie Charts - Format Hover values #89
Unanswered
bweathers3
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
In my app I have a Pie chart (the code for which is below):
Currently it displays the percentage of the chart by section. Also currently when I hover over a section(piece of the pie) the chart displays the numeric value for the percentage.
I would like to maintain the percentage for the normal chart view but would like to have the numeric value as a US dollar amount when hovering over a section of the chart. Below the second section of code is the formatter I use for bar charts but I am unable to get the onHover effect desired.
Would anyone have a possible solution? Thank you very much!
The Pie chart code:
<div class="col-md-6 w-350"> <br> <h4 class="text-center">Top 5 Vendors</h4> <%= pie_chart([ {name: @top_five_vendor[0][:name], data: @top_five_vendor[0][:data]}, {name: @top_five_vendor[1][:name], data: @top_five_vendor[1][:data]}, {name: @top_five_vendor[2][:name], data: @top_five_vendor[2][:data]}, {name: @top_five_vendor[3][:name], data: @top_five_vendor[3][:data]}, {name: @top_five_vendor[4][:name], data: @top_five_vendor[4][:data]}, {name: @top_five_vendor[5][:name], data: @top_five_vendor[5][:data]} ], legend: "left", ) %> </div>
`
The previous formatting:
labels: { formatter: { function: { args: "val", body: "return '$' + parseFloat(val).toLocaleString();" } } }
Beta Was this translation helpful? Give feedback.
All reactions