Module: Rorschart::GoogleChart::Options

Included in:
Helper
Defined in:
lib/rorschart/google_chart_options.rb

Instance Method Summary collapse

Instance Method Details

#chart_options(klass_symbol) ⇒ Object



58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# File 'lib/rorschart/google_chart_options.rb', line 58

def chart_options(klass_symbol)
  {
    "Table" => {
      cssClassNames: {
        tableRow: 'table_row',
        headerRow: 'header_row',
        headerCell: 'header_cel'
      }
    },
    "AreaChart" => {
      isStacked: true,
    },
    "PieChart" => {
      legend: {
        alignment: "start",
        position: "right"
      }
    }
  }[klass_symbol] || {}
end

#default_optionsObject



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/rorschart/google_chart_options.rb', line 5

def default_options
  {
    fontName: "'Helvetica Neue', Helvetica, Arial, sans-serif",
    pointSize: 8,
    lineWidth: 3,
    chartArea: {
      width: '100%',
      height: '70%'
    },
    titlePosition: 'out',
    axisTitlesPosition: 'in',
    legend: {
      textStyle: {
        fontSize: 12,
        color: "#444"
      },
      alignment: "end",
      position: "top"
    },
    curveType: "function",
    hAxis: {
      textStyle: {
        color: "#666",
        fontSize: 12
      },
      gridlines: {
        color: "transparent"
      },
      baselineColor: "#ccc",
      viewWindow: {}
    },
      vAxis: {
      textStyle: {
        color: "#666",
        fontSize: 12
      },
      textPosition: 'in',
      baselineColor: "#ccc",
      viewWindow: {}
    },
      tooltip: {
      textStyle: {
        color: "#666",
        fontSize: 12
      }
    },
    #A nice Color Scheme from http://www.colourlovers.com/palettes/top
    colors: ['#00A0B0', '#6A4A3C', '#CC333F', '#EB6841', '#EDC951'],
    # colors: ['#F8FCC1', '#CC0C39', '#E6781E', '#C8CF02', '#1693A7'],
    allowHtml: true
  }
end