Module: GoogleChart::Axis
- Included in:
- BarChart, LineChart, LineXYChart, RadarChart, ScatterPlot, SparklineChart
- Defined in:
- lib/google_chart/modules/axis.rb
Overview
This module is used as a mixin for providing axis
Defined Under Namespace
Classes: Axis
Constant Summary
- AXIS_TYPE_MAPPING =
{ :top => "t", :bottom => "x", :left => "y", :right => "r" }
- ALIGNMENT_MAPPING =
{ :center => 0, :left => -1, :right => -1}
Instance Method Summary (collapse)
Instance Method Details
- (Object) axis(type, options = {}) {|axis| ... }
10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/google_chart/modules/axis.rb', line 10 def axis(type, ={}) @axes ||= [] raise ArgumentError.new("Axis type must be :top, :bottom, :left or :right") unless AXIS_TYPE_MAPPING.keys.include?(type) axis = Axis.new axis.type = type .each { |k,v| axis.send("#{k}=",v) } yield axis if block_given? validate_axis(axis) @axes << axis end |