New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Association in charts and pie chart theme #34
Comments
This should work if names are unique. EmployeeDepartment.joins(:states).group("employee_departments.name").count Make sure class EmployeeDepartment
has_many :tickets
has_many :states, through: :tickets
end An alternative approach is: EmployeeDepartment.all.map{|dept| dept.states.count } The examples use Google Charts, which is why the theme is different. |
Tickets.rb Employee_department.rb State.rb i will add has_many states through tickets into my employee_department.rb , is there anything else need to be modified ? |
No, that should be it. Try out the two examples above to see if they work. |
I tried one of them ,the pie chart is showing the number of tickets for each department |
Sounds like you want the number of distinct states. Try the second solution. |
First thanks alot for this gem i have been trying for more than a month to create a dynamic gem but i always fail, but its easier with your gem thanks alot <3 .
Second I have Ticket model belongs_to employee_department and belongs_to state , i would like to show on pie chart the count of states (in state model i have :name attribute ) for each employee_department ( :name attribute ).
Third I used pie chart with one model it looks different from the one you have in the example ( your pie chart example shows with percentage and small squares ), how you change its theme ?
Note: I have
<%= javascript_include_tag "/assets/highcharts.js", "chartkick" %>
thanks again for this gem 👍
The text was updated successfully, but these errors were encountered: