rails_charts icon indicating copy to clipboard operation
rails_charts copied to clipboard

Fix stacked bar chart

Open marcus-deans opened this issue 2 years ago • 1 comments
trafficstars

Allows stacked bar chart to stack as per ECharts instead of superimposing.

Consider

<%= stacked_bar_chart [
                                              { name: 'Pending', data: {'Jan 1' => 5, 'Jan 2' => 6, 'Jan 3' => 10}},
                                              { name: 'Done', data: {'Jan 1' => 6, 'Jan 2' => 4, 'Jan 3' => 1}}
                              ],
                              {
                                options: {
                                  title: {
                                    text: "Popular vs Unpopular"
                                  },
                                },
                                class: 'box',
                                vertical: true
                              } %>

yields image

With this change, the same code yields image

Not sure if it's meant to be extensible. I've tried to add stack: 'stack' in multiple places with the existing code, but it's unclear how to fix it. If this already exists properly, adding the explanation to the docs would be great

marcus-deans avatar Nov 07 '23 23:11 marcus-deans