Chartkick Stacked column help

15 views
Skip to first unread message

Arup Rakshit

unread,
Feb 26, 2019, 1:47:09 PM2/26/19
to rubyonra...@googlegroups.com
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'

Reply all
Reply to author
Forward
0 new messages