Yelizaveta-Omelchenko / google-charts-on-rails

Automatically exported from code.google.com/p/google-charts-on-rails
MIT License
0 stars 0 forks source link

added support of default background transparency [patch] #10

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
i admit, this could be better, but i just needed it to default to
transparent. it should probably take an argument for chf as a hash or
something, but i didn't have the need for it.

here is the patch

*** google_chart.rb 2008-05-27 02:18:13.000000000 -1000
--- vendor/plugins/google_charts_on_rails/lib/google_chart.rb   2008-05-27
02:10:19.000000000 -1000
***************
*** 7,12 ****
--- 7,13 ----
    DATA_VAR = 'chd'.freeze
    LABELS_VAR = 'chl'.freeze
    COLORS_VAR = 'chco'.freeze
+   BACKGROUND_VAR = 'chf'.freeze
    BAR_WIDTH_SPACING_VAR = 'chbh'.freeze
    TYPE_VAR_VALUES = {
      :line => 'lc',
***************
*** 25,30 ****
--- 26,32 ----
    SIZE_MATCHING_REGEX = /([0-9]+)x([0-9]+)/i.freeze
    DEFAULT_HEIGHT = 200
    DEFAULT_WIDTH = 200
+   DEFAULT_BACKGROUND = "bg,s,00000000"
    def self.method_missing(method, *args)
      #TODO make it thread safe by creating a separate class, presently it
could be bad
      protect_from_deep_stack do
***************
*** 76,81 ****
--- 78,84 ----
      params[DATA_VAR] = encode_data
      params[LABELS_VAR] = join_labels if (@labels && @show_labels)
      params[COLORS_VAR] = join(@colors) if (@colors)
+     params[BACKGROUND_VAR] = DEFAULT_BACKGROUND

      chart_params = []
      params.each_pair do |key, value|
***************

have a great day

Original issue reported on code.google.com by dra...@gmail.com on 27 May 2008 at 12:22