Parent

Methods

Class Index

Quicksearch

Ziya::Charts::Base

The mother ship of all charts. This abstract class figures out how to generate the correct xml to render the chart on the client side. It handles loading the look and feel via associated stylesheets. In order to customize the chart look and feel, you must create a theme directory in your application public/charts/themes dir. And reference it via the #add method using the :theme directive.

Public Instance Methods

add( *args ) click to toggle source

Add chart components to a given chart.

The args must contain certain keys for the chart to be displayed correctly.

Directives

  • :axis_category_text — Array of strings representing the x/y axis ticks dependending on the chart type. This value is required. In an x/y axis chart setup the category is the x axis unless the chart is a bar chart.
  • :axis_category_label — Array of strings representing the x axis labels. This is supported only for Scatter and Bubble charts. This value is optional. Specify nil for no label change.
  • :series — Specifies the series name and chart data points as an array. The series name will be used to display chart legends. You must have at least one of these tag defined. The data values may be specified as a straight up array of strings or numbers but also as an array of hash representing the data points and their attributes such as note, label, tooltip, effect, etc..
  • :axis_value_label — Array of strings representing the ticks on the x/y axis depending on the chart type. This is symmetrical to the axis_category_label tag for the opposite chart axis. Specify nil for no label change.
  • :user_data:: — Used to make user data available to the ERB templates in the chart stylesheet yaml file. You must specify a key symbol and an ad-hoc value. The key will be used with the @options hash to access the user data.
  • :composites — Embeds multiple charts within the given chart via the draw image component. You must specify a hash of chart_id/url pairs.
  • :chart_types — Specify the chart types per series. This option should only be used with Mixed Charts !!
  • :theme — Specify the use of a given named theme. The named theme must reside in a directory named equaly under your application public/charts/themes.

Examples

Setup the category axis to with 3 ticks namely 2004, 2005, 2006

  my_chart.add( :axis_category_text, ['2004', '2005', '2006'] )

Plain old series with integer data points

  my_chart.add( :series, "series A", [ 10, 20, 30] )

Specifying custom series labels. You may specify the following attributes in the data point hash : :note, :label, :tooltip and effects such as :shadow, :glow, etc...

  my_chart.add( :series, "series A", [ { :value => 10, :label => 'l1' }, { :value => 20, :label => 'l2' } ] )

     # File lib/ziya/charts/base.rb, line 167
167:     def add( *args )
168:       # TODO Validation categories = series, series = labels, etc...
169:       directive = args.shift
170:       case directive
171:         # BOZO !! Idea - could use a formatter object to specificy how you want to format this series
172:         when :axis_category_text
173:           categories = args.first.is_a?(Array) ? args.shift : []
174:           raise ArgumentError, "Must specify an array of categories" if categories.empty?
175:           # don't side effect the passed in categs
176:           categs = categories.clone
177:           categs.insert( 0, nil )
178:           @options[directive] = categs
179:         # BOZO !! Need to constrain this only scatter and bubble support this !!
180:         when :axis_category_label
181:           labels = args.first.is_a?(Array) ? args.shift : []
182:           raise ArgumentError, "Must specify an array of category labels" if labels.empty?
183:           @options[directive] = labels          
184:         when :composites
185:           composites = args.first.is_a?(Hash) ? args.shift: []
186:           raise ArgumentError, "Must specify a hash of id => url pairs for the composite chart(s)" if composites.empty?
187:           @options[directive] = composites
188:         when :axis_value_label
189:           values = args.first.is_a?(Array) ? args.shift : []
190:           raise ArgumentError, "Must specify an array of values" if values.empty?
191:           @options[directive] = values
192:         when :series
193:           series = {}
194:           legend = args.first.is_a?(String) ? args.shift : ""
195:           if args.first.is_a?( Array )
196:             points = args.shift || []
197:             raise ArgumentError, "Must specify an array of data points" if points.empty?
198:             # don't side effect the passed in series
199:             pts = points.clone
200:             pts.insert( 0, legend )
201:             series[:points] = pts
202:           else
203:             raise ArgumentError, "Must specify an array of data points"
204:           end
205:           url = args.shift          
206:           series[:url] = url if url
207:           @series_desc << series
208:         when :user_data
209:           key = args.first.is_a?(Symbol) ? args.shift : ""
210:           raise ArgumentError, "Must specify a key" if key.to_s.empty?
211:           value = args.shift
212:           # raise ArgumentError, "Must specify a value" if value.empty?
213:           @options[key] = value
214:         when :styles
215:           styles = args.first.is_a?(String) ? args.shift : ""
216:           raise ArgumentError, "Must specify a set of styles" if styles.to_s.empty?          
217:           @options[directive] = styles   
218:         when :chart_types
219:           types = args.first.is_a?(Array) ? args.shift : []
220:           raise ArgumentError, "Must specify a set of chart types" if types.to_s.empty?          
221:           @options[directive] = types                        
222:         when :theme
223:           theme = args.first.is_a?(String) ? args.shift : ""
224:           raise ArgumentError, "Must specify a theme name" if theme.to_s.empty?          
225:           @theme = "#{Ziya.themes_dir}/#{theme}"
226:         when :mode
227:           @render_mode = args.first.is_a?(Integer) ? args.shift : -1
228:           raise ArgumentError, "Must specify a valid generation mode" if @render_mode == -1          
229:         else raise ArgumentError, "Invalid directive must be one of " + 
230:                                  ":axis_category_text, :axis_value, :series, :user_data"
231:       end 
232:     end
to_s( options={} ) click to toggle source

spews the graph specification to a string

:partial:You can specify this option to only update parts of the charts that have actually changed. This is useful for live update and link update where you may not need to redraw the whole chart.

     # File lib/ziya/charts/base.rb, line 238
238:     def to_s( options={} )
239:       @partial = options[:partial] || false
240:       @xml     = Builder::XmlMarkup.new
241:       # Forces utf8 encoding on xml stream
242:       @xml.instruct! :xml, :version => "1.0", :encoding => "UTF-8"
243:       @xml.chart do
244:         @xml.license( @license ) unless @license.nil?
245:         if render_parents?
246:           if @type
247:             @xml.chart_type( @type )              
248:           elsif @options[:chart_types].is_a? Array and ! @options[:chart_types].empty?
249:             @xml.chart_type do   
250:               @options[:chart_types].each { |type| @xml.string( type ) }   
251:             end
252:           end
253:         end
254:         setup_lnf
255:         setup_series
256:       end
257:       @xml.to_s.gsub( /<to_s\/>/, '' )
258:     end
Also aliased as: to_xml
to_xml( options={} ) click to toggle source

Alias for #to_s

secsequence

--- SEC00017

seccomment

--- ""

method_list

--- 
- methods: 
  - visibility: public
    aref: M000102
    name: add
    sourcecode: "     <span class=\"ruby-comment cmt\"># File lib/ziya/charts/base.rb, line 167</span>\n\
      167:     <span class=\"ruby-keyword kw\">def</span> <span class=\"ruby-identifier\">add</span>( <span class=\"ruby-operator\">*</span><span class=\"ruby-identifier\">args</span> )\n\
      168:       <span class=\"ruby-comment cmt\"># TODO Validation categories = series, series = labels, etc...</span>\n\
      169:       <span class=\"ruby-identifier\">directive</span> = <span class=\"ruby-identifier\">args</span>.<span class=\"ruby-identifier\">shift</span>\n\
      170:       <span class=\"ruby-keyword kw\">case</span> <span class=\"ruby-identifier\">directive</span>\n\
      171:         <span class=\"ruby-comment cmt\"># BOZO !! Idea - could use a formatter object to specificy how you want to format this series</span>\n\
      172:         <span class=\"ruby-keyword kw\">when</span> <span class=\"ruby-identifier\">:axis_category_text</span>\n\
      173:           <span class=\"ruby-identifier\">categories</span> = <span class=\"ruby-identifier\">args</span>.<span class=\"ruby-identifier\">first</span>.<span class=\"ruby-identifier\">is_a?</span>(<span class=\"ruby-constant\">Array</span>) <span class=\"ruby-operator\">?</span> <span class=\"ruby-identifier\">args</span>.<span class=\"ruby-identifier\">shift</span> <span class=\"ruby-operator\">:</span> []\n\
      174:           <span class=\"ruby-identifier\">raise</span> <span class=\"ruby-constant\">ArgumentError</span>, <span class=\"ruby-value str\">&quot;Must specify an array of categories&quot;</span> <span class=\"ruby-keyword kw\">if</span> <span class=\"ruby-identifier\">categories</span>.<span class=\"ruby-identifier\">empty?</span>\n\
      175:           <span class=\"ruby-comment cmt\"># don't side effect the passed in categs</span>\n\
      176:           <span class=\"ruby-identifier\">categs</span> = <span class=\"ruby-identifier\">categories</span>.<span class=\"ruby-identifier\">clone</span>\n\
      177:           <span class=\"ruby-identifier\">categs</span>.<span class=\"ruby-identifier\">insert</span>( <span class=\"ruby-value\">0</span>, <span class=\"ruby-keyword kw\">nil</span> )\n\
      178:           <span class=\"ruby-ivar\">@options</span>[<span class=\"ruby-identifier\">directive</span>] = <span class=\"ruby-identifier\">categs</span>\n\
      179:         <span class=\"ruby-comment cmt\"># BOZO !! Need to constrain this only scatter and bubble support this !!</span>\n\
      180:         <span class=\"ruby-keyword kw\">when</span> <span class=\"ruby-identifier\">:axis_category_label</span>\n\
      181:           <span class=\"ruby-identifier\">labels</span> = <span class=\"ruby-identifier\">args</span>.<span class=\"ruby-identifier\">first</span>.<span class=\"ruby-identifier\">is_a?</span>(<span class=\"ruby-constant\">Array</span>) <span class=\"ruby-operator\">?</span> <span class=\"ruby-identifier\">args</span>.<span class=\"ruby-identifier\">shift</span> <span class=\"ruby-operator\">:</span> []\n\
      182:           <span class=\"ruby-identifier\">raise</span> <span class=\"ruby-constant\">ArgumentError</span>, <span class=\"ruby-value str\">&quot;Must specify an array of category labels&quot;</span> <span class=\"ruby-keyword kw\">if</span> <span class=\"ruby-identifier\">labels</span>.<span class=\"ruby-identifier\">empty?</span>\n\
      183:           <span class=\"ruby-ivar\">@options</span>[<span class=\"ruby-identifier\">directive</span>] = <span class=\"ruby-identifier\">labels</span>          \n\
      184:         <span class=\"ruby-keyword kw\">when</span> <span class=\"ruby-identifier\">:composites</span>\n\
      185:           <span class=\"ruby-identifier\">composites</span> = <span class=\"ruby-identifier\">args</span>.<span class=\"ruby-identifier\">first</span>.<span class=\"ruby-identifier\">is_a?</span>(<span class=\"ruby-constant\">Hash</span>) <span class=\"ruby-operator\">?</span> <span class=\"ruby-identifier\">args</span>.<span class=\"ruby-identifier\">shift</span><span class=\"ruby-operator\">:</span> []\n\
      186:           <span class=\"ruby-identifier\">raise</span> <span class=\"ruby-constant\">ArgumentError</span>, <span class=\"ruby-value str\">&quot;Must specify a hash of id =&gt; url pairs for the composite chart(s)&quot;</span> <span class=\"ruby-keyword kw\">if</span> <span class=\"ruby-identifier\">composites</span>.<span class=\"ruby-identifier\">empty?</span>\n\
      187:           <span class=\"ruby-ivar\">@options</span>[<span class=\"ruby-identifier\">directive</span>] = <span class=\"ruby-identifier\">composites</span>\n\
      188:         <span class=\"ruby-keyword kw\">when</span> <span class=\"ruby-identifier\">:axis_value_label</span>\n\
      189:           <span class=\"ruby-identifier\">values</span> = <span class=\"ruby-identifier\">args</span>.<span class=\"ruby-identifier\">first</span>.<span class=\"ruby-identifier\">is_a?</span>(<span class=\"ruby-constant\">Array</span>) <span class=\"ruby-operator\">?</span> <span class=\"ruby-identifier\">args</span>.<span class=\"ruby-identifier\">shift</span> <span class=\"ruby-operator\">:</span> []\n\
      190:           <span class=\"ruby-identifier\">raise</span> <span class=\"ruby-constant\">ArgumentError</span>, <span class=\"ruby-value str\">&quot;Must specify an array of values&quot;</span> <span class=\"ruby-keyword kw\">if</span> <span class=\"ruby-identifier\">values</span>.<span class=\"ruby-identifier\">empty?</span>\n\
      191:           <span class=\"ruby-ivar\">@options</span>[<span class=\"ruby-identifier\">directive</span>] = <span class=\"ruby-identifier\">values</span>\n\
      192:         <span class=\"ruby-keyword kw\">when</span> <span class=\"ruby-identifier\">:series</span>\n\
      193:           <span class=\"ruby-identifier\">series</span> = {}\n\
      194:           <span class=\"ruby-identifier\">legend</span> = <span class=\"ruby-identifier\">args</span>.<span class=\"ruby-identifier\">first</span>.<span class=\"ruby-identifier\">is_a?</span>(<span class=\"ruby-constant\">String</span>) <span class=\"ruby-operator\">?</span> <span class=\"ruby-identifier\">args</span>.<span class=\"ruby-identifier\">shift</span> <span class=\"ruby-operator\">:</span> <span class=\"ruby-value str\">&quot;&quot;</span>\n\
      195:           <span class=\"ruby-keyword kw\">if</span> <span class=\"ruby-identifier\">args</span>.<span class=\"ruby-identifier\">first</span>.<span class=\"ruby-identifier\">is_a?</span>( <span class=\"ruby-constant\">Array</span> )\n\
      196:             <span class=\"ruby-identifier\">points</span> = <span class=\"ruby-identifier\">args</span>.<span class=\"ruby-identifier\">shift</span> <span class=\"ruby-operator\">||</span> []\n\
      197:             <span class=\"ruby-identifier\">raise</span> <span class=\"ruby-constant\">ArgumentError</span>, <span class=\"ruby-value str\">&quot;Must specify an array of data points&quot;</span> <span class=\"ruby-keyword kw\">if</span> <span class=\"ruby-identifier\">points</span>.<span class=\"ruby-identifier\">empty?</span>\n\
      198:             <span class=\"ruby-comment cmt\"># don't side effect the passed in series</span>\n\
      199:             <span class=\"ruby-identifier\">pts</span> = <span class=\"ruby-identifier\">points</span>.<span class=\"ruby-identifier\">clone</span>\n\
      200:             <span class=\"ruby-identifier\">pts</span>.<span class=\"ruby-identifier\">insert</span>( <span class=\"ruby-value\">0</span>, <span class=\"ruby-identifier\">legend</span> )\n\
      201:             <span class=\"ruby-identifier\">series</span>[<span class=\"ruby-identifier\">:points</span>] = <span class=\"ruby-identifier\">pts</span>\n\
      202:           <span class=\"ruby-keyword kw\">else</span>\n\
      203:             <span class=\"ruby-identifier\">raise</span> <span class=\"ruby-constant\">ArgumentError</span>, <span class=\"ruby-value str\">&quot;Must specify an array of data points&quot;</span>\n\
      204:           <span class=\"ruby-keyword kw\">end</span>\n\
      205:           <span class=\"ruby-identifier\">url</span> = <span class=\"ruby-identifier\">args</span>.<span class=\"ruby-identifier\">shift</span>          \n\
      206:           <span class=\"ruby-identifier\">series</span>[<span class=\"ruby-identifier\">:url</span>] = <span class=\"ruby-identifier\">url</span> <span class=\"ruby-keyword kw\">if</span> <span class=\"ruby-identifier\">url</span>\n\
      207:           <span class=\"ruby-ivar\">@series_desc</span> <span class=\"ruby-operator\">&lt;&lt;</span> <span class=\"ruby-identifier\">series</span>\n\
      208:         <span class=\"ruby-keyword kw\">when</span> <span class=\"ruby-identifier\">:user_data</span>\n\
      209:           <span class=\"ruby-identifier\">key</span> = <span class=\"ruby-identifier\">args</span>.<span class=\"ruby-identifier\">first</span>.<span class=\"ruby-identifier\">is_a?</span>(<span class=\"ruby-constant\">Symbol</span>) <span class=\"ruby-operator\">?</span> <span class=\"ruby-identifier\">args</span>.<span class=\"ruby-identifier\">shift</span> <span class=\"ruby-operator\">:</span> <span class=\"ruby-value str\">&quot;&quot;</span>\n\
      210:           <span class=\"ruby-identifier\">raise</span> <span class=\"ruby-constant\">ArgumentError</span>, <span class=\"ruby-value str\">&quot;Must specify a key&quot;</span> <span class=\"ruby-keyword kw\">if</span> <span class=\"ruby-identifier\">key</span>.<span class=\"ruby-identifier\">to_s</span>.<span class=\"ruby-identifier\">empty?</span>\n\
      211:           <span class=\"ruby-identifier\">value</span> = <span class=\"ruby-identifier\">args</span>.<span class=\"ruby-identifier\">shift</span>\n\
      212:           <span class=\"ruby-comment cmt\"># raise ArgumentError, &quot;Must specify a value&quot; if value.empty?</span>\n\
      213:           <span class=\"ruby-ivar\">@options</span>[<span class=\"ruby-identifier\">key</span>] = <span class=\"ruby-identifier\">value</span>\n\
      214:         <span class=\"ruby-keyword kw\">when</span> <span class=\"ruby-identifier\">:styles</span>\n\
      215:           <span class=\"ruby-identifier\">styles</span> = <span class=\"ruby-identifier\">args</span>.<span class=\"ruby-identifier\">first</span>.<span class=\"ruby-identifier\">is_a?</span>(<span class=\"ruby-constant\">String</span>) <span class=\"ruby-operator\">?</span> <span class=\"ruby-identifier\">args</span>.<span class=\"ruby-identifier\">shift</span> <span class=\"ruby-operator\">:</span> <span class=\"ruby-value str\">&quot;&quot;</span>\n\
      216:           <span class=\"ruby-identifier\">raise</span> <span class=\"ruby-constant\">ArgumentError</span>, <span class=\"ruby-value str\">&quot;Must specify a set of styles&quot;</span> <span class=\"ruby-keyword kw\">if</span> <span class=\"ruby-identifier\">styles</span>.<span class=\"ruby-identifier\">to_s</span>.<span class=\"ruby-identifier\">empty?</span>          \n\
      217:           <span class=\"ruby-ivar\">@options</span>[<span class=\"ruby-identifier\">directive</span>] = <span class=\"ruby-identifier\">styles</span>   \n\
      218:         <span class=\"ruby-keyword kw\">when</span> <span class=\"ruby-identifier\">:chart_types</span>\n\
      219:           <span class=\"ruby-identifier\">types</span> = <span class=\"ruby-identifier\">args</span>.<span class=\"ruby-identifier\">first</span>.<span class=\"ruby-identifier\">is_a?</span>(<span class=\"ruby-constant\">Array</span>) <span class=\"ruby-operator\">?</span> <span class=\"ruby-identifier\">args</span>.<span class=\"ruby-identifier\">shift</span> <span class=\"ruby-operator\">:</span> []\n\
      220:           <span class=\"ruby-identifier\">raise</span> <span class=\"ruby-constant\">ArgumentError</span>, <span class=\"ruby-value str\">&quot;Must specify a set of chart types&quot;</span> <span class=\"ruby-keyword kw\">if</span> <span class=\"ruby-identifier\">types</span>.<span class=\"ruby-identifier\">to_s</span>.<span class=\"ruby-identifier\">empty?</span>          \n\
      221:           <span class=\"ruby-ivar\">@options</span>[<span class=\"ruby-identifier\">directive</span>] = <span class=\"ruby-identifier\">types</span>                        \n\
      222:         <span class=\"ruby-keyword kw\">when</span> <span class=\"ruby-identifier\">:theme</span>\n\
      223:           <span class=\"ruby-identifier\">theme</span> = <span class=\"ruby-identifier\">args</span>.<span class=\"ruby-identifier\">first</span>.<span class=\"ruby-identifier\">is_a?</span>(<span class=\"ruby-constant\">String</span>) <span class=\"ruby-operator\">?</span> <span class=\"ruby-identifier\">args</span>.<span class=\"ruby-identifier\">shift</span> <span class=\"ruby-operator\">:</span> <span class=\"ruby-value str\">&quot;&quot;</span>\n\
      224:           <span class=\"ruby-identifier\">raise</span> <span class=\"ruby-constant\">ArgumentError</span>, <span class=\"ruby-value str\">&quot;Must specify a theme name&quot;</span> <span class=\"ruby-keyword kw\">if</span> <span class=\"ruby-identifier\">theme</span>.<span class=\"ruby-identifier\">to_s</span>.<span class=\"ruby-identifier\">empty?</span>          \n\
      225:           <span class=\"ruby-ivar\">@theme</span> = <span class=\"ruby-node\">&quot;#{Ziya.themes_dir}/#{theme}&quot;</span>\n\
      226:         <span class=\"ruby-keyword kw\">when</span> <span class=\"ruby-identifier\">:mode</span>\n\
      227:           <span class=\"ruby-ivar\">@render_mode</span> = <span class=\"ruby-identifier\">args</span>.<span class=\"ruby-identifier\">first</span>.<span class=\"ruby-identifier\">is_a?</span>(<span class=\"ruby-constant\">Integer</span>) <span class=\"ruby-operator\">?</span> <span class=\"ruby-identifier\">args</span>.<span class=\"ruby-identifier\">shift</span> <span class=\"ruby-operator\">:</span> <span class=\"ruby-value\">-1</span>\n\
      228:           <span class=\"ruby-identifier\">raise</span> <span class=\"ruby-constant\">ArgumentError</span>, <span class=\"ruby-value str\">&quot;Must specify a valid generation mode&quot;</span> <span class=\"ruby-keyword kw\">if</span> <span class=\"ruby-ivar\">@render_mode</span> <span class=\"ruby-operator\">==</span> <span class=\"ruby-value\">-1</span>          \n\
      229:         <span class=\"ruby-keyword kw\">else</span> <span class=\"ruby-identifier\">raise</span> <span class=\"ruby-constant\">ArgumentError</span>, <span class=\"ruby-value str\">&quot;Invalid directive must be one of &quot;</span> <span class=\"ruby-operator\">+</span> \n\
      230:                                  <span class=\"ruby-value str\">&quot;:axis_category_text, :axis_value, :series, :user_data&quot;</span>\n\
      231:       <span class=\"ruby-keyword kw\">end</span> \n\
      232:     <span class=\"ruby-keyword kw\">end</span>"
    m_desc: |-
      <p>
      Add chart components to a given chart.
      </p>
      <p>
      The <tt>args</tt> must contain certain keys for the chart to be displayed
      correctly.
      </p>
      <h3>Directives</h3>
      <ul>
      <li><tt>:axis_category_text</tt> &#8212; Array of strings representing the x/y
      axis ticks dependending on the chart type. This value is required. In an
      x/y axis chart setup the category is the x axis unless the chart is a bar
      chart.
      
      </li>
      <li><tt>:axis_category_label</tt> &#8212; Array of strings representing the x
      axis labels. This is supported only for <a href="Scatter.html">Scatter</a>
      and <a href="Bubble.html">Bubble</a> charts. This value is optional.
      Specify nil for no label change.
      
      </li>
      <li><tt>:series</tt> &#8212; Specifies the series name and chart data points as
      an array. The series name will be used to display chart legends. You must
      have at least one of these tag defined. The data values may be specified as
      a straight up array of strings or numbers but also as an array of hash
      representing the data points and their attributes such as note, label,
      tooltip, effect, etc..
      
      </li>
      <li><tt>:axis_value_label</tt> &#8212; Array of strings representing the ticks
      on the x/y axis depending on the chart type. This is symmetrical to the
      <tt>axis_category_label</tt> tag for the opposite chart axis. Specify nil
      for no label change.
      
      </li>
      <li><tt>:user_data</tt>:: &#8212; Used to make user data available to the ERB
      templates in the chart stylesheet yaml file. You must specify a key symbol
      and an ad-hoc value. The key will be used with the @options hash to access
      the user data.
      
      </li>
      <li><tt>:composites</tt> &#8212; Embeds multiple charts within the given chart
      via the draw image component. You must specify a hash of chart_id/url
      pairs.
      
      </li>
      <li><tt>:chart_types</tt> &#8212; Specify the chart types per series. This
      option should only be used with <a href="Mixed.html">Mixed</a> <a
      href="../Charts.html">Charts</a> !!
      
      </li>
      <li><tt>:theme</tt> &#8212; Specify the use of a given named theme. The named
      theme must reside in a directory named equaly under your application
      public/charts/themes.
      
      </li>
      </ul>
      <h3>Examples</h3>
      <p>
      Setup the category axis to with 3 ticks namely 2004, 2005, 2006
      </p>
      <pre>
        my_chart.add( :axis_category_text, ['2004', '2005', '2006'] )
      </pre>
      <p>
      Plain old series with integer data points
      </p>
      <pre>
        my_chart.add( :series, &quot;series A&quot;, [ 10, 20, 30] )
      </pre>
      <p>
      Specifying custom series labels. You may specify the following attributes
      in the data point hash : :note, :label, :tooltip and effects such as
      :shadow, :glow, etc...
      </p>
      <pre>
        my_chart.add( :series, &quot;series A&quot;, [ { :value =&gt; 10, :label =&gt; 'l1' }, { :value =&gt; 20, :label =&gt; 'l2' } ] )
      </pre>
    params: ( *args )
  - visibility: public
    aref: M000103
    name: to_s
    sourcecode: "     <span class=\"ruby-comment cmt\"># File lib/ziya/charts/base.rb, line 238</span>\n\
      238:     <span class=\"ruby-keyword kw\">def</span> <span class=\"ruby-identifier\">to_s</span>( <span class=\"ruby-identifier\">options</span>={} )\n\
      239:       <span class=\"ruby-ivar\">@partial</span> = <span class=\"ruby-identifier\">options</span>[<span class=\"ruby-identifier\">:partial</span>] <span class=\"ruby-operator\">||</span> <span class=\"ruby-keyword kw\">false</span>\n\
      240:       <span class=\"ruby-ivar\">@xml</span>     = <span class=\"ruby-constant\">Builder</span><span class=\"ruby-operator\">::</span><span class=\"ruby-constant\">XmlMarkup</span>.<span class=\"ruby-identifier\">new</span>\n\
      241:       <span class=\"ruby-comment cmt\"># Forces utf8 encoding on xml stream</span>\n\
      242:       <span class=\"ruby-ivar\">@xml</span>.<span class=\"ruby-identifier\">instruct!</span> <span class=\"ruby-identifier\">:xml</span>, <span class=\"ruby-identifier\">:version</span> =<span class=\"ruby-operator\">&gt;</span> <span class=\"ruby-value str\">&quot;1.0&quot;</span>, <span class=\"ruby-identifier\">:encoding</span> =<span class=\"ruby-operator\">&gt;</span> <span class=\"ruby-value str\">&quot;UTF-8&quot;</span>\n\
      243:       <span class=\"ruby-ivar\">@xml</span>.<span class=\"ruby-identifier\">chart</span> <span class=\"ruby-keyword kw\">do</span>\n\
      244:         <span class=\"ruby-ivar\">@xml</span>.<span class=\"ruby-identifier\">license</span>( <span class=\"ruby-ivar\">@license</span> ) <span class=\"ruby-keyword kw\">unless</span> <span class=\"ruby-ivar\">@license</span>.<span class=\"ruby-identifier\">nil?</span>\n\
      245:         <span class=\"ruby-keyword kw\">if</span> <span class=\"ruby-identifier\">render_parents?</span>\n\
      246:           <span class=\"ruby-keyword kw\">if</span> <span class=\"ruby-ivar\">@type</span>\n\
      247:             <span class=\"ruby-ivar\">@xml</span>.<span class=\"ruby-identifier\">chart_type</span>( <span class=\"ruby-ivar\">@type</span> )              \n\
      248:           <span class=\"ruby-keyword kw\">elsif</span> <span class=\"ruby-ivar\">@options</span>[<span class=\"ruby-identifier\">:chart_types</span>].<span class=\"ruby-identifier\">is_a?</span> <span class=\"ruby-constant\">Array</span> <span class=\"ruby-keyword kw\">and</span> <span class=\"ruby-operator\">!</span> <span class=\"ruby-ivar\">@options</span>[<span class=\"ruby-identifier\">:chart_types</span>].<span class=\"ruby-identifier\">empty?</span>\n\
      249:             <span class=\"ruby-ivar\">@xml</span>.<span class=\"ruby-identifier\">chart_type</span> <span class=\"ruby-keyword kw\">do</span>   \n\
      250:               <span class=\"ruby-ivar\">@options</span>[<span class=\"ruby-identifier\">:chart_types</span>].<span class=\"ruby-identifier\">each</span> { <span class=\"ruby-operator\">|</span><span class=\"ruby-identifier\">type</span><span class=\"ruby-operator\">|</span> <span class=\"ruby-ivar\">@xml</span>.<span class=\"ruby-identifier\">string</span>( <span class=\"ruby-identifier\">type</span> ) }   \n\
      251:             <span class=\"ruby-keyword kw\">end</span>\n\
      252:           <span class=\"ruby-keyword kw\">end</span>\n\
      253:         <span class=\"ruby-keyword kw\">end</span>\n\
      254:         <span class=\"ruby-identifier\">setup_lnf</span>\n\
      255:         <span class=\"ruby-identifier\">setup_series</span>\n\
      256:       <span class=\"ruby-keyword kw\">end</span>\n\
      257:       <span class=\"ruby-ivar\">@xml</span>.<span class=\"ruby-identifier\">to_s</span>.<span class=\"ruby-identifier\">gsub</span>( <span class=\"ruby-regexp re\">/&lt;to_s\\/&gt;/</span>, <span class=\"ruby-value str\">''</span> )\n\
      258:     <span class=\"ruby-keyword kw\">end</span>"
    aka: 
    - aref: Base.html#M000104
      name: to_xml
    m_desc: |-
      <p>
      spews the graph specification to a string
      </p>
      <table>
      <tr><td valign="top"><tt>:partial</tt>:</td><td>You can specify this option to only update parts of the charts that have
      actually changed. This is useful for live update and link update where you
      may not need to redraw the whole chart.
      
      </td></tr>
      </table>
    params: ( options={} )
  - visibility: public
    aref: M000104
    name: to_xml
    m_desc: |-
      <p>
      Alias for <a href="Base.html#M000103">#to_s</a>
      </p>
    params: ( options={} )
  category: Instance
  type: Public

sectitle

--- 

[Validate]

Generated with the Darkfish Rdoc Generator.