Ruby on Rails
Tuesday, February 26, 2019
Hi,
I am trying to create a stacked column chart like [this](https://www.dropbox.com/s/db4tu7wsa5a9q7x/Screenshot%202019-02-26%20at%2010.00.27%20PM.png?dl=0) . But I am getting it like [this](https://www.dropbox.com/s/ze89lckd4fv64ky/Screenshot%202019-02-26%20at%2010.33.49%20PM.png?dl=0). Can anyone help me so that I can achieve the desired one. My code now is:
def project_cost_breakdown
# ....
@column_chart_data = [
{
name: "Budget & cost overrun",
data: [['Budget & cost overrun', 100], ['Budget & cost overrun', 300]]
},
{
name: "Total cost",
data: [['Total cost', 300]]
}
]
respond_to do |format|
format.html { render "project_cost_breakdown" }
end
end
And in view I do it like:
= column_chart @column_chart_data, stacked: true, title: 'Total cost vs. Budget'
I am using https://github.com/ankane/chartkick lib.
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CAKxHnE1QHDF5ag4mGgxk6X_9xO_6bWbxrWVdqXHRGdTGzK5U7g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment