Class: GoogleChart::VennDiagram
- Inherits:
-
Base
- Object
- Base
- GoogleChart::VennDiagram
- Includes:
- Color, DataArray, Fills, Legend
- Defined in:
- lib/google_chart/venn_diagram.rb
Constant Summary
Constant Summary
Constants included from Fills
Fills::FILL_KINDS, Fills::FILL_TYPES, Fills::FILL_TYPES_SOLID, Fills::FILL_TYPE_CODES
Instance Attribute Summary
Attributes inherited from Base
#encoding, #height, #title, #title_color, #title_font_size, #width
Instance Method Summary (collapse)
- - (Object) data(legend, data, color = nil)
-
- (VennDiagram) initialize(options = {})
constructor
A new instance of VennDiagram.
-
- (Object) intersections(*values)
Specify the intersections of the circles in the Venn Diagram.
Methods included from DataArray
Methods included from Fills
Methods included from Legend
Methods inherited from Base
inherited, #query_params, #size, #size=, #to_url
Constructor Details
- (VennDiagram) initialize(options = {})
A new instance of VennDiagram
11 12 13 14 15 16 |
# File 'lib/google_chart/venn_diagram.rb', line 11 def initialize(={}) @chart_type="v" @show_legend = false @intersections = [] super() end |
Instance Method Details
- (Object) data(legend, data, color = nil)
27 28 29 30 31 32 33 |
# File 'lib/google_chart/venn_diagram.rb', line 27 def data(legend, data, color = nil) raise ArgumentError.new("data should be an integer value") unless data.is_a?(Integer) raise ArgumentError.new("you can only insert upto 3 data points") if @data.size == 3 @data << data legend(legend) color(color) end |
- (Object) intersections(*values)
Specify the intersections of the circles in the Venn Diagram. See the Rdoc for class for sample
19 20 21 22 23 24 25 |
# File 'lib/google_chart/venn_diagram.rb', line 19 def intersections(*values) raise ArgumentError.new("Please intialise the data first before adding intersections") if @data.empty? raise ArgumentError.new("You can have at most three intersections") if values.size > 4 raise ArgumentError.new("You cannot have more intersections than data points") if values.size > (@data.size + 1) raise ArgumentError.new("all values must be integers") unless values.all? { |v| v.is_a?(Integer) } @intersections = values end |