highcharts-js-rails icon indicating copy to clipboard operation
highcharts-js-rails copied to clipboard

No option for stacking

Open thoran opened this issue 12 years ago • 1 comments

I tried the following...

chart.plotOptions(series: {stacking: 'percent'})

which of course doesn't work, since I note that there is no built-in way to handle stacking, so I tried the following:

class Highcharts class PlotOptions class PlotType < Base

  def initialize(opts = {})
    @suboptions = {
      :dataLabels => 'Labels',
      :dial => 'Base',
      :events => 'PlotOptions::PlotType::Events',
      :marker => 'PlotOptions::PlotType::Marker',
      :pivot => 'Base',
      :point => 'Point',
      :states => 'PlotOptions::PlotType::States',
      :stacking => 'Base'
    }
    super
  end

end

end end

Of course Base wants a Hash.

I also tried creating a custom class and setting the class constant string above to 'Stacking':

class Highcharts class Stacking < Base

def initialize(opts = {})
  @default = :percent
  super
end

end end

This sort-of works, but it renders as a 'normal' stacking and isn't settable.

If I want to do a quick hack by dropping in a new class definition or definitions, can you suggest how to go about it?

Otherwise, adding stacking to this library would be good.

thoran avatar Jan 31 '13 02:01 thoran

This is probably more like it...

class Highcharts class PlotOptions class PlotType < Base

  def initialize(opts = {})
    @options = {
      :stacking => opts[:stacking]
    }
    @suboptions = {
      :dataLabels => 'Labels',
      :dial => 'Base',
      :events => 'PlotOptions::PlotType::Events',
      :marker => 'PlotOptions::PlotType::Marker',
      :pivot => 'Base',
      :point => 'Point',
      :states => 'PlotOptions::PlotType::States',
    }
    super
  end

end

end end

Please patch with the above if it seems to be what you'd expect this to look like in order to have this functionality.

Thanks again!

thoran avatar Jan 31 '13 02:01 thoran