dvandersluis / amcharts.rb

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

AmCharts images in asset pipeline #3

Open allenwyma opened 10 years ago

allenwyma commented 10 years ago

Images are processed with a fingerprint, but somehow they are being linked against the unfingerprinted version.

dvandersluis commented 10 years ago

Do you have an example of this? Assuming you're talking about the digested version of the assets (ie. /assets/amcharts/loading-2f99a7ca7730e98eb35460cce0ae3cec.gif vs `/assets/amcharts/loading.gif'), it is working as far as I can see.

allenwyma commented 10 years ago

Yes, they upload AND are stamped, but the problem is that the javascript is trying to load in loading.git and NOT /assets/amcharts/loading-2f99a7ca7730e98eb35460cce0ae3cec.gif so the pictures don't come in.

dvandersluis commented 10 years ago

Which image are you having trouble with? Something built into AmCharts (like the zoom icon or scrollbar toggles)? Or something you're adding yourself?

allenwyma commented 10 years ago

Yes. the ones built in to the chart, of course. It seems the JavaScript is still trying to look for the image WITHOUT the fingerprint, which of course it cannot find.

dvandersluis commented 10 years ago

Yeah the reason for this is that the AmCharts js is setting up which files to use, and doesn't know about Rails or the asset pipeline :smile:

AmCharts.rb should probably override these images with asset paths, but doesn't right now. In the meantime, you can override the properties yourself (ie. zoomOutButtonImage for a serial chart). Feel free to contribute a pull request if you want to tackle having AmCharts.rb take care of this.

(Note: some of the icons seem to be hardcoded into the amcharts JS for whatever reason, for instance dragIcon.gif for scrollbar handles)

maxpark-jd commented 7 years ago

Hi, I was looking for a solution for zoomOutButtonImage issue. Can you explain more in detail on how to override its property, please? @dvandersluis

dvandersluis commented 7 years ago

@maxpark-jd Something like this should work:

chart = AmCharts::Chart::Serial.new(data) do |c|
  c.zoom_out_button_image = '#{asset_url(...)}'
end
maxpark-jd commented 7 years ago

thanks a lot @dvandersluis !

srghma commented 6 years ago

Can I exclude only amchart.rb images from config.assets.precompile?