Module: Anychart::XML

Defined in:
lib/pie.rb,
lib/line_bar.rb,
lib/column_bar.rb,
lib/xml_sections/legend.rb,
lib/anychart_xml_builder.rb,
lib/xml_sections/chart_title.rb,
lib/xml_sections/chart_background.rb

Defined Under Namespace

Modules: ColumnBar, LineBar, Pie

Class Method Summary collapse

Class Method Details

.chart_background(xml, p, options = {}) ⇒ Object



3
4
5
6
7
# File 'lib/xml_sections/chart_background.rb', line 3

def self.chart_background(xml,p,options={})      
  xml.chart_background(:enabled => "False") {
    xml.border(:enabled => "False", :color => "#7EAB3A", :opacity => "0.3") { }
  }
end

.chart_title(xml, p, opts = {}) ⇒ Object



5
6
7
8
9
10
11
# File 'lib/xml_sections/chart_title.rb', line 5

def self.chart_title(xml,p,opts={})
  if p[:chart][:title].present?
    xml.title(:enabled => "true", :padding => "10") {
      xml.text_ p[:chart][:title]
    }
  end # title
end

.legend(xml, p, options = {}) ⇒ Object



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
# File 'lib/xml_sections/legend.rb', line 21

def self.legend(xml,p,options={})      
  if p[:chart][:legend].present?
    
    position  = p[:chart][:legend][:position] || "Bottom"
    format    = p[:chart][:legend][:format] || "{%Icon} {%Name} ({%YValue}"
    title     = p[:chart][:legend][:title]  || "Legenda"
    align     = p[:chart][:legend][:align]  || "Near"
    
    xml.legend(:enabled => "true", :position => position, :align => align, :ignore_auto_item => "true") {
      xml.format format
      xml.template {}
      
      if p[:chart][:legend][:title].present?
        xml.title(:enabled => "true") {
          xml.text_ title
        }
      else
        xml.title(:enabled => "false") { }
      end
  
      xml.columns_separator(:enabled => "false") { }
      xml.background {
        xml.inside_margin(:left => "10", :right => "10") {}
      }
      xml.items {
        xml.item(:source => "Points")
      }
    }
  end # legend
  
end