dvandersluis / amcharts.rb

Ruby/Rails wrapper for Amcharts
MIT License
12 stars 9 forks source link

Responsive charts #9

Open sergey-koba-mobidev opened 7 years ago

sergey-koba-mobidev commented 7 years ago

Hi, first wanted to thank you for really great library! Nice work!

Is there a mapping for enabling responsive charts? Something like

c.responsive do |r|
  r.enabled = true
end

Was not able to find. I have to always specify the dimensions.

Thank you in advance!

dvandersluis commented 7 years ago

There isn't right now, because that didn't exist when I wrote the mapping. Can you link to the documentation for responsive?

The best way to get this in here would be to contribute a PR if you're so inclined :smile:

As a workaround (I haven't tried this, so all this is off the top of my head), you can try making the chart responsive after it has been initialized (charts are serialized into the AmCharts.RB.Charts collection where the key is the ID of the container), or by using a listener (event documentation). Note that in both of these cases you may have to call chart.validateNow() to make the change take effect.

sergey-koba-mobidev commented 7 years ago

Thx for answer! Here is a link: https://www.amcharts.com/kbase/making-charts-responsive/ Will make PR if there will be a time opportunity!