Class | Gruff::Line |
In: |
lib/gruff/line.rb
|
Parent: | Gruff::Base |
Here‘s how to make a Line graph:
g = Gruff::Line.new g.title = "A Line Graph" g.data 'Fries', [20, 23, 19, 8] g.data 'Hamburgers', [50, 19, 99, 29] g.write("test/output/line.png")
There are also other options described below, such as baseline_value, baseline_color, hide_dots, and hide_lines.
baseline_color | [RW] | Color of the baseline |
baseline_value | [RW] | Draw a dashed line at the given value |
dot_radius | [RW] | |
hide_dots | [RW] | Hide parts of the graph to fit more datapoints, or for a different appearance. |
hide_lines | [RW] | Hide parts of the graph to fit more datapoints, or for a different appearance. |
line_width | [RW] | Dimensions of lines and dots; calculated based on dataset size if left unspecified |
Call with target pixel width of graph (800, 400, 300), and/or ‘false’ to omit lines (points only).
g = Gruff::Line.new(400) # 400px wide with lines g = Gruff::Line.new(400, false) # 400px wide, no lines (for backwards compatibility) g = Gruff::Line.new(false) # Defaults to 800px wide, no lines (for backwards compatibility)
The preferred way is to call hide_dots or hide_lines instead.