gruff 0.3.7 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +2 -1
- data/.travis.yml +6 -0
- data/Gemfile +2 -8
- data/History.txt +76 -0
- data/MIT-LICENSE +3 -2
- data/README.md +96 -6
- data/RELEASE.md +92 -0
- data/Rakefile +203 -23
- data/gruff.gemspec +13 -10
- data/lib/gruff.rb +8 -7
- data/lib/gruff/accumulator_bar.rb +4 -13
- data/lib/gruff/area.rb +6 -13
- data/lib/gruff/bar.rb +24 -3
- data/lib/gruff/bar_conversion.rb +31 -31
- data/lib/gruff/base.rb +310 -267
- data/lib/gruff/bezier.rb +46 -0
- data/lib/gruff/bullet.rb +3 -1
- data/lib/gruff/dot.rb +56 -44
- data/lib/gruff/line.rb +83 -69
- data/lib/gruff/net.rb +7 -9
- data/lib/gruff/pie.rb +2 -4
- data/lib/gruff/scatter.rb +25 -29
- data/lib/gruff/side_bar.rb +54 -37
- data/lib/gruff/side_stacked_bar.rb +25 -5
- data/lib/gruff/spider.rb +22 -21
- data/lib/gruff/themes.rb +102 -0
- data/lib/gruff/version.rb +1 -1
- data/test/gruff_test_case.rb +68 -38
- data/test/image_compare.rb +58 -0
- data/test/output/accum_bar.png +0 -0
- data/test/output/area_keynote.png +0 -0
- data/test/output/area_keynote_small.png +0 -0
- data/test/output/area_many.png +0 -0
- data/test/output/area_many_areas_small.png +0 -0
- data/test/output/area_tiny.png +0 -0
- data/test/output/area_wide.png +0 -0
- data/test/output/bar2_wrapped_legend_16_400.png +0 -0
- data/test/output/bar2_wrapped_legend_16_800.png +0 -0
- data/test/output/bar2_wrapped_legend_30_400.png +0 -0
- data/test/output/bar2_wrapped_legend_30_800.png +0 -0
- data/test/output/bar2_wrapped_legend_4_400.png +0 -0
- data/test/output/bar2_wrapped_legend_4_800.png +0 -0
- data/test/output/bar2_wrapped_legend__400.png +0 -0
- data/test/output/bar2_wrapped_legend__800.png +0 -0
- data/test/output/bar_background_gradient_bottom_top.png +0 -0
- data/test/output/bar_background_gradient_left_right.png +0 -0
- data/test/output/bar_background_gradient_right_left.png +0 -0
- data/test/output/bar_background_gradient_top_bottom.png +0 -0
- data/test/output/bar_background_gradient_topleft_bottomright.png +0 -0
- data/test/output/bar_background_gradient_topright_bottomleft.png +0 -0
- data/test/output/bar_formatted_numbers.png +0 -0
- data/test/output/bar_keynote.png +0 -0
- data/test/output/bar_keynote_small.png +0 -0
- data/test/output/bar_long_legend_text.png +0 -0
- data/test/output/bar_manual_colors.png +0 -0
- data/test/output/bar_marker_shadow.png +0 -0
- data/test/output/bar_nearly_zero_max_10.png +0 -0
- data/test/output/bar_no_legend.png +0 -0
- data/test/output/bar_no_line_markers.png +0 -0
- data/test/output/bar_no_title.png +0 -0
- data/test/output/bar_no_title_or_legend.png +0 -0
- data/test/output/bar_odeo.png +0 -0
- data/test/output/bar_one_value.png +0 -0
- data/test/output/bar_pos_neg.png +0 -0
- data/test/output/bar_rails_keynote.png +0 -0
- data/test/output/bar_set_absolute_trunc.png +0 -0
- data/test/output/bar_set_label_stagger_height.png +0 -0
- data/test/output/bar_set_legend_box_size_lg.png +0 -0
- data/test/output/bar_set_legend_box_size_sm.png +0 -0
- data/test/output/bar_set_marker.png +0 -0
- data/test/output/bar_set_trailing_dots_trunc.png +0 -0
- data/test/output/bar_spacing_full.png +0 -0
- data/test/output/bar_spacing_half.png +0 -0
- data/test/output/bar_spacing_none.png +0 -0
- data/test/output/bar_tall_graph.png +0 -0
- data/test/output/bar_tall_graph_small.png +0 -0
- data/test/output/bar_themed.png +0 -0
- data/test/output/bar_title_margin.png +0 -0
- data/test/output/bar_value_labels.png +0 -0
- data/test/output/bar_wide_graph.png +0 -0
- data/test/output/bar_wide_graph_small.png +0 -0
- data/test/output/bar_wrapped_legend_16_400.png +0 -0
- data/test/output/bar_wrapped_legend_16_800.png +0 -0
- data/test/output/bar_wrapped_legend_30_400.png +0 -0
- data/test/output/bar_wrapped_legend_30_800.png +0 -0
- data/test/output/bar_wrapped_legend_4_400.png +0 -0
- data/test/output/bar_wrapped_legend_4_800.png +0 -0
- data/test/output/bar_wrapped_legend__400.png +0 -0
- data/test/output/bar_wrapped_legend__800.png +0 -0
- data/test/output/bar_x_y_labels.png +0 -0
- data/test/output/bar_y_increment_1.png +0 -0
- data/test/output/bar_y_increment_2.0.png +0 -0
- data/test/output/bar_y_increment_20.png +0 -0
- data/test/output/bar_y_increment_5.png +0 -0
- data/test/output/bar_zero_marker_count.png +0 -0
- data/test/output/bar_zero_spacing.png +0 -0
- data/test/output/bezier.png +0 -0
- data/test/output/bezier_2.png +0 -0
- data/test/output/bezier_3.png +0 -0
- data/test/output/bullet_greyscale.png +0 -0
- data/test/output/bullet_no_options.png +0 -0
- data/test/output/dot.png +0 -0
- data/test/output/dot_manual_colors.png +0 -0
- data/test/output/dot_nearly_zero_max_10.png +0 -0
- data/test/output/dot_no_legend.png +0 -0
- data/test/output/dot_no_line_markers.png +0 -0
- data/test/output/dot_no_title.png +0 -0
- data/test/output/dot_no_title_or_legend.png +0 -0
- data/test/output/dot_one_value.png +0 -0
- data/test/output/dot_pos_neg.png +0 -0
- data/test/output/dot_set_legend_box_size_lg.png +0 -0
- data/test/output/dot_set_legend_box_size_sm.png +0 -0
- data/test/output/dot_set_marker.png +0 -0
- data/test/output/dot_small.png +0 -0
- data/test/output/dot_tall_graph.png +0 -0
- data/test/output/dot_tall_graph_small.png +0 -0
- data/test/output/dot_themed.png +0 -0
- data/test/output/dot_wide_graph.png +0 -0
- data/test/output/dot_wide_graph_small.png +0 -0
- data/test/output/dot_x_y_labels.png +0 -0
- data/test/output/dot_y_increment_1.png +0 -0
- data/test/output/dot_y_increment_2.0.png +0 -0
- data/test/output/dot_y_increment_20.png +0 -0
- data/test/output/dot_y_increment_5.png +0 -0
- data/test/output/enhancements-1.png +0 -0
- data/test/output/enhancements.png +0 -0
- data/test/output/line_all_neg.png +0 -0
- data/test/output/line_all_neg_400.png +0 -0
- data/test/output/line_all_neg_no_max.png +0 -0
- data/test/output/line_baseline.png +0 -0
- data/test/output/line_hang_value.png +0 -0
- data/test/output/line_hide_dots.png +0 -0
- data/test/output/line_hide_lines.png +0 -0
- data/test/output/line_jruby_error.png +0 -0
- data/test/output/line_large.png +0 -0
- data/test/output/line_large_baseline.png +0 -0
- data/test/output/line_legend_at_bottom.png +0 -0
- data/test/output/line_many.png +0 -0
- data/test/output/line_many_lines_small.png +0 -0
- data/test/output/line_many_numbers.png +0 -0
- data/test/output/line_marker_label_accuracy.png +0 -0
- data/test/output/line_more_sets_than_colors.png +0 -0
- data/test/output/line_no_data.png +0 -0
- data/test/output/line_no_data_msg.png +0 -0
- data/test/output/line_no_data_other.png +0 -0
- data/test/output/line_no_hide.png +0 -0
- data/test/output/line_no_legend.png +0 -0
- data/test/output/line_no_line_markers.png +0 -0
- data/test/output/line_no_title.png +0 -0
- data/test/output/line_nothing_but_the_graph.png +0 -0
- data/test/output/line_one_value.png +0 -0
- data/test/output/line_one_value_array.png +0 -0
- data/test/output/line_pos_neg.png +0 -0
- data/test/output/line_pos_neg_400.png +0 -0
- data/test/output/line_similar_high_end_values.png +0 -0
- data/test/output/line_similar_high_end_values_with_floor.png +0 -0
- data/test/output/line_small_small_zero.png +0 -0
- data/test/output/line_small_values.png +0 -0
- data/test/output/line_small_values_small.png +0 -0
- data/test/output/line_small_zero.png +0 -0
- data/test/output/line_some_nil_points.png +0 -0
- data/test/output/line_theme_37signals_.png +0 -0
- data/test/output/line_theme_37signals_400.png +0 -0
- data/test/output/line_theme_keynote_.png +0 -0
- data/test/output/line_theme_keynote_400.png +0 -0
- data/test/output/line_theme_odeo_.png +0 -0
- data/test/output/line_theme_odeo_400.png +0 -0
- data/test/output/line_theme_rails_keynote_.png +0 -0
- data/test/output/line_theme_rails_keynote_400.png +0 -0
- data/test/output/line_tiny.png +0 -0
- data/test/output/line_transparent.png +0 -0
- data/test/output/line_very_small.png +0 -0
- data/test/output/line_wide_graph.png +0 -0
- data/test/output/line_wide_graph_small.png +0 -0
- data/test/output/line_xy.png +0 -0
- data/test/output/line_xy_pairs.png +0 -0
- data/test/output/line_y_axis_increment.png +0 -0
- data/test/output/mini_bar.png +0 -0
- data/test/output/mini_pie.png +0 -0
- data/test/output/mini_pie_right_legend.png +0 -0
- data/test/output/mini_side_bar.png +0 -0
- data/test/output/mini_side_bar_multi_color.png +0 -0
- data/test/output/net_dots_tiny.png +0 -0
- data/test/output/net_large.png +0 -0
- data/test/output/net_many.png +0 -0
- data/test/output/net_many_nets_small.png +0 -0
- data/test/output/net_no_data.png +0 -0
- data/test/output/net_no_data_msg.png +0 -0
- data/test/output/net_no_data_other.png +0 -0
- data/test/output/net_no_legend.png +0 -0
- data/test/output/net_no_net_markers.png +0 -0
- data/test/output/net_no_title.png +0 -0
- data/test/output/net_nothing_but_the_graph.png +0 -0
- data/test/output/net_similar_high_end_values.png +0 -0
- data/test/output/net_small.png +0 -0
- data/test/output/net_small_small.png +0 -0
- data/test/output/net_small_small_zero.png +0 -0
- data/test/output/net_small_zero.png +0 -0
- data/test/output/net_wide_graph.png +0 -0
- data/test/output/net_wide_graph_small.png +0 -0
- data/test/output/pie_equal.png +0 -0
- data/test/output/pie_grey.png +0 -0
- data/test/output/pie_keynote.png +0 -0
- data/test/output/pie_keynote_small.png +0 -0
- data/test/output/pie_legend.png +0 -0
- data/test/output/pie_legend_small.png +0 -0
- data/test/output/pie_nearly_equal.png +0 -0
- data/test/output/pie_one_val.png +0 -0
- data/test/output/pie_pastel.png +0 -0
- data/test/output/pie_simple.png +0 -0
- data/test/output/pie_wide.png +0 -0
- data/test/output/pie_wrapped_legend_16_400.png +0 -0
- data/test/output/pie_wrapped_legend_16_800.png +0 -0
- data/test/output/pie_wrapped_legend_30_400.png +0 -0
- data/test/output/pie_wrapped_legend_30_800.png +0 -0
- data/test/output/pie_wrapped_legend_4_400.png +0 -0
- data/test/output/pie_wrapped_legend_4_800.png +0 -0
- data/test/output/pie_wrapped_legend__400.png +0 -0
- data/test/output/pie_wrapped_legend__800.png +0 -0
- data/test/output/pie_zero.png +0 -0
- data/test/output/scatter_all_neg.png +0 -0
- data/test/output/scatter_all_neg_400.png +0 -0
- data/test/output/scatter_basic.png +0 -0
- data/test/output/scatter_many.png +0 -0
- data/test/output/scatter_no_data.png +0 -0
- data/test/output/scatter_no_data_msg.png +0 -0
- data/test/output/scatter_no_data_other.png +0 -0
- data/test/output/scatter_no_hide.png +0 -0
- data/test/output/scatter_no_labels.png +0 -0
- data/test/output/scatter_no_legend.png +0 -0
- data/test/output/scatter_no_line_markers.png +0 -0
- data/test/output/scatter_no_title.png +0 -0
- data/test/output/scatter_nothing_but_the_graph.png +0 -0
- data/test/output/scatter_pos_neg.png +0 -0
- data/test/output/scatter_pos_neg_400.png +0 -0
- data/test/output/scatter_wide_graph.png +0 -0
- data/test/output/scatter_wide_graph_small.png +0 -0
- data/test/output/scene_hazy_night.png +0 -0
- data/test/output/scene_not_hazy_day.png +0 -0
- data/test/output/scene_partly_cloudy_day.png +0 -0
- data/test/output/scene_stormy_day.png +0 -0
- data/test/output/scene_stormy_night.png +0 -0
- data/test/output/side_bar.png +0 -0
- data/test/output/side_bar_data_range.png +0 -0
- data/test/output/side_bar_labels.png +0 -0
- data/test/output/side_bar_spacing_full.png +0 -0
- data/test/output/side_bar_spacing_half.png +0 -0
- data/test/output/side_bar_spacing_none.png +0 -0
- data/test/output/side_stacked_bar_keynote.png +0 -0
- data/test/output/side_stacked_bar_keynote_small.png +0 -0
- data/test/output/side_stacked_bar_labels.png +0 -0
- data/test/output/side_stacked_bar_long_label.png +0 -0
- data/test/output/side_stacked_bar_wide.png +0 -0
- data/test/output/spider_37signals.png +0 -0
- data/test/output/spider_equal.png +0 -0
- data/test/output/spider_keynote.png +0 -0
- data/test/output/spider_legend.png +0 -0
- data/test/output/spider_legend_small.png +0 -0
- data/test/output/spider_lots_of_data.png +0 -0
- data/test/output/spider_lots_of_data_normal_names.png +0 -0
- data/test/output/spider_nearly_equal.png +0 -0
- data/test/output/spider_no_axes.png +0 -0
- data/test/output/spider_no_background.png +0 -0
- data/test/output/spider_no_print.png +0 -0
- data/test/output/spider_overlay_1.png +0 -0
- data/test/output/spider_overlay_2.png +0 -0
- data/test/output/spider_rotation.png +0 -0
- data/test/output/spider_small.png +0 -0
- data/test/output/spider_wide.png +0 -0
- data/test/output/spider_zero.png +0 -0
- data/test/output/stacked_area_keynote.png +0 -0
- data/test/output/stacked_area_keynote_small.png +0 -0
- data/test/output/stacked_bar_keynote.png +0 -0
- data/test/output/stacked_bar_keynote_small.png +0 -0
- data/test/output_java/accum_bar.png +0 -0
- data/test/output_java/area_keynote.png +0 -0
- data/test/output_java/area_keynote_small.png +0 -0
- data/test/output_java/area_many.png +0 -0
- data/test/output_java/area_many_areas_small.png +0 -0
- data/test/output_java/area_tiny.png +0 -0
- data/test/output_java/area_wide.png +0 -0
- data/test/output_java/bar2_wrapped_legend_16_400.png +0 -0
- data/test/output_java/bar2_wrapped_legend_16_800.png +0 -0
- data/test/output_java/bar2_wrapped_legend_30_400.png +0 -0
- data/test/output_java/bar2_wrapped_legend_30_800.png +0 -0
- data/test/output_java/bar2_wrapped_legend_4_400.png +0 -0
- data/test/output_java/bar2_wrapped_legend_4_800.png +0 -0
- data/test/output_java/bar2_wrapped_legend__400.png +0 -0
- data/test/output_java/bar2_wrapped_legend__800.png +0 -0
- data/test/output_java/bar_background_gradient_bottom_top.png +0 -0
- data/test/output_java/bar_background_gradient_left_right.png +0 -0
- data/test/output_java/bar_background_gradient_right_left.png +0 -0
- data/test/output_java/bar_background_gradient_top_bottom.png +0 -0
- data/test/output_java/bar_background_gradient_topleft_bottomright.png +0 -0
- data/test/output_java/bar_background_gradient_topright_bottomleft.png +0 -0
- data/test/output_java/bar_formatted_numbers.png +0 -0
- data/test/output_java/bar_keynote.png +0 -0
- data/test/output_java/bar_keynote_small.png +0 -0
- data/test/output_java/bar_long_legend_text.png +0 -0
- data/test/output_java/bar_manual_colors.png +0 -0
- data/test/output_java/bar_marker_shadow.png +0 -0
- data/test/output_java/bar_nearly_zero_max_10.png +0 -0
- data/test/output_java/bar_no_legend.png +0 -0
- data/test/output_java/bar_no_line_markers.png +0 -0
- data/test/output_java/bar_no_title.png +0 -0
- data/test/output_java/bar_no_title_or_legend.png +0 -0
- data/test/output_java/bar_odeo.png +0 -0
- data/test/output_java/bar_one_value.png +0 -0
- data/test/output_java/bar_pos_neg.png +0 -0
- data/test/output_java/bar_rails_keynote.png +0 -0
- data/test/output_java/bar_set_absolute_trunc.png +0 -0
- data/test/output_java/bar_set_label_stagger_height.png +0 -0
- data/test/output_java/bar_set_legend_box_size_lg.png +0 -0
- data/test/output_java/bar_set_legend_box_size_sm.png +0 -0
- data/test/output_java/bar_set_marker.png +0 -0
- data/test/output_java/bar_set_trailing_dots_trunc.png +0 -0
- data/test/output_java/bar_spacing_full.png +0 -0
- data/test/output_java/bar_spacing_half.png +0 -0
- data/test/output_java/bar_spacing_none.png +0 -0
- data/test/output_java/bar_tall_graph.png +0 -0
- data/test/output_java/bar_tall_graph_small.png +0 -0
- data/test/output_java/bar_themed.png +0 -0
- data/test/output_java/bar_title_margin.png +0 -0
- data/test/output_java/bar_value_labels.png +0 -0
- data/test/output_java/bar_wide_graph.png +0 -0
- data/test/output_java/bar_wide_graph_small.png +0 -0
- data/test/output_java/bar_wrapped_legend_16_400.png +0 -0
- data/test/output_java/bar_wrapped_legend_16_800.png +0 -0
- data/test/output_java/bar_wrapped_legend_30_400.png +0 -0
- data/test/output_java/bar_wrapped_legend_30_800.png +0 -0
- data/test/output_java/bar_wrapped_legend_4_400.png +0 -0
- data/test/output_java/bar_wrapped_legend_4_800.png +0 -0
- data/test/output_java/bar_wrapped_legend__400.png +0 -0
- data/test/output_java/bar_wrapped_legend__800.png +0 -0
- data/test/output_java/bar_x_y_labels.png +0 -0
- data/test/output_java/bar_y_increment_1.png +0 -0
- data/test/output_java/bar_y_increment_2.0.png +0 -0
- data/test/output_java/bar_y_increment_20.png +0 -0
- data/test/output_java/bar_y_increment_5.png +0 -0
- data/test/output_java/bar_zero_marker_count.png +0 -0
- data/test/output_java/bar_zero_spacing.png +0 -0
- data/test/output_java/bezier.png +0 -0
- data/test/output_java/bezier_2.png +0 -0
- data/test/output_java/bezier_3.png +0 -0
- data/test/output_java/bullet_greyscale.png +0 -0
- data/test/output_java/bullet_no_options.png +0 -0
- data/test/output_java/dot.png +0 -0
- data/test/output_java/dot_manual_colors.png +0 -0
- data/test/output_java/dot_nearly_zero_max_10.png +0 -0
- data/test/output_java/dot_no_legend.png +0 -0
- data/test/output_java/dot_no_line_markers.png +0 -0
- data/test/output_java/dot_no_title.png +0 -0
- data/test/output_java/dot_no_title_or_legend.png +0 -0
- data/test/output_java/dot_one_value.png +0 -0
- data/test/output_java/dot_pos_neg.png +0 -0
- data/test/output_java/dot_set_legend_box_size_lg.png +0 -0
- data/test/output_java/dot_set_legend_box_size_sm.png +0 -0
- data/test/output_java/dot_set_marker.png +0 -0
- data/test/output_java/dot_small.png +0 -0
- data/test/output_java/dot_tall_graph.png +0 -0
- data/test/output_java/dot_tall_graph_small.png +0 -0
- data/test/output_java/dot_themed.png +0 -0
- data/test/output_java/dot_wide_graph.png +0 -0
- data/test/output_java/dot_wide_graph_small.png +0 -0
- data/test/output_java/dot_x_y_labels.png +0 -0
- data/test/output_java/dot_y_increment_1.png +0 -0
- data/test/output_java/dot_y_increment_2.0.png +0 -0
- data/test/output_java/dot_y_increment_20.png +0 -0
- data/test/output_java/dot_y_increment_5.png +0 -0
- data/test/output_java/enhancements-1.png +0 -0
- data/test/output_java/enhancements.png +0 -0
- data/test/output_java/line_all_neg.png +0 -0
- data/test/output_java/line_all_neg_400.png +0 -0
- data/test/output_java/line_all_neg_no_max.png +0 -0
- data/test/output_java/line_baseline.png +0 -0
- data/test/output_java/line_hang_value.png +0 -0
- data/test/output_java/line_hide_dots.png +0 -0
- data/test/output_java/line_hide_lines.png +0 -0
- data/test/output_java/line_jruby_error.png +0 -0
- data/test/output_java/line_large.png +0 -0
- data/test/output_java/line_large_baseline.png +0 -0
- data/test/output_java/line_legend_at_bottom.png +0 -0
- data/test/output_java/line_many.png +0 -0
- data/test/output_java/line_many_lines_small.png +0 -0
- data/test/output_java/line_many_numbers.png +0 -0
- data/test/output_java/line_marker_label_accuracy.png +0 -0
- data/test/output_java/line_more_sets_than_colors.png +0 -0
- data/test/output_java/line_no_data.png +0 -0
- data/test/output_java/line_no_data_msg.png +0 -0
- data/test/output_java/line_no_data_other.png +0 -0
- data/test/output_java/line_no_hide.png +0 -0
- data/test/output_java/line_no_legend.png +0 -0
- data/test/output_java/line_no_line_markers.png +0 -0
- data/test/output_java/line_no_title.png +0 -0
- data/test/output_java/line_nothing_but_the_graph.png +0 -0
- data/test/output_java/line_one_value.png +0 -0
- data/test/output_java/line_one_value_array.png +0 -0
- data/test/output_java/line_pos_neg.png +0 -0
- data/test/output_java/line_pos_neg_400.png +0 -0
- data/test/output_java/line_similar_high_end_values.png +0 -0
- data/test/output_java/line_similar_high_end_values_with_floor.png +0 -0
- data/test/output_java/line_small_small_zero.png +0 -0
- data/test/output_java/line_small_values.png +0 -0
- data/test/output_java/line_small_values_small.png +0 -0
- data/test/output_java/line_small_zero.png +0 -0
- data/test/output_java/line_some_nil_points.png +0 -0
- data/test/output_java/line_theme_37signals_.png +0 -0
- data/test/output_java/line_theme_37signals_400.png +0 -0
- data/test/output_java/line_theme_keynote_.png +0 -0
- data/test/output_java/line_theme_keynote_400.png +0 -0
- data/test/output_java/line_theme_odeo_.png +0 -0
- data/test/output_java/line_theme_odeo_400.png +0 -0
- data/test/output_java/line_theme_rails_keynote_.png +0 -0
- data/test/output_java/line_theme_rails_keynote_400.png +0 -0
- data/test/output_java/line_tiny.png +0 -0
- data/test/output_java/line_transparent.png +0 -0
- data/test/output_java/line_very_small.png +0 -0
- data/test/output_java/line_wide_graph.png +0 -0
- data/test/output_java/line_wide_graph_small.png +0 -0
- data/test/output_java/line_xy.png +0 -0
- data/test/output_java/line_xy_pairs.png +0 -0
- data/test/output_java/line_y_axis_increment.png +0 -0
- data/test/output_java/mini_bar.png +0 -0
- data/test/output_java/mini_pie.png +0 -0
- data/test/output_java/mini_pie_right_legend.png +0 -0
- data/test/output_java/mini_side_bar.png +0 -0
- data/test/output_java/mini_side_bar_multi_color.png +0 -0
- data/test/output_java/net_dots_tiny.png +0 -0
- data/test/output_java/net_large.png +0 -0
- data/test/output_java/net_many.png +0 -0
- data/test/output_java/net_many_nets_small.png +0 -0
- data/test/output_java/net_no_data.png +0 -0
- data/test/output_java/net_no_data_msg.png +0 -0
- data/test/output_java/net_no_data_other.png +0 -0
- data/test/output_java/net_no_legend.png +0 -0
- data/test/output_java/net_no_net_markers.png +0 -0
- data/test/output_java/net_no_title.png +0 -0
- data/test/output_java/net_nothing_but_the_graph.png +0 -0
- data/test/output_java/net_similar_high_end_values.png +0 -0
- data/test/output_java/net_small.png +0 -0
- data/test/output_java/net_small_small.png +0 -0
- data/test/output_java/net_small_small_zero.png +0 -0
- data/test/output_java/net_small_zero.png +0 -0
- data/test/output_java/net_wide_graph.png +0 -0
- data/test/output_java/net_wide_graph_small.png +0 -0
- data/test/output_java/pie_equal.png +0 -0
- data/test/output_java/pie_grey.png +0 -0
- data/test/output_java/pie_keynote.png +0 -0
- data/test/output_java/pie_keynote_small.png +0 -0
- data/test/output_java/pie_legend.png +0 -0
- data/test/output_java/pie_legend_small.png +0 -0
- data/test/output_java/pie_nearly_equal.png +0 -0
- data/test/output_java/pie_one_val.png +0 -0
- data/test/output_java/pie_pastel.png +0 -0
- data/test/output_java/pie_simple.png +0 -0
- data/test/output_java/pie_wide.png +0 -0
- data/test/output_java/pie_wrapped_legend_16_400.png +0 -0
- data/test/output_java/pie_wrapped_legend_16_800.png +0 -0
- data/test/output_java/pie_wrapped_legend_30_400.png +0 -0
- data/test/output_java/pie_wrapped_legend_30_800.png +0 -0
- data/test/output_java/pie_wrapped_legend_4_400.png +0 -0
- data/test/output_java/pie_wrapped_legend_4_800.png +0 -0
- data/test/output_java/pie_wrapped_legend__400.png +0 -0
- data/test/output_java/pie_wrapped_legend__800.png +0 -0
- data/test/output_java/pie_zero.png +0 -0
- data/test/output_java/scatter_all_neg.png +0 -0
- data/test/output_java/scatter_all_neg_400.png +0 -0
- data/test/output_java/scatter_basic.png +0 -0
- data/test/output_java/scatter_many.png +0 -0
- data/test/output_java/scatter_no_data.png +0 -0
- data/test/output_java/scatter_no_data_msg.png +0 -0
- data/test/output_java/scatter_no_data_other.png +0 -0
- data/test/output_java/scatter_no_hide.png +0 -0
- data/test/output_java/scatter_no_labels.png +0 -0
- data/test/output_java/scatter_no_legend.png +0 -0
- data/test/output_java/scatter_no_line_markers.png +0 -0
- data/test/output_java/scatter_no_title.png +0 -0
- data/test/output_java/scatter_nothing_but_the_graph.png +0 -0
- data/test/output_java/scatter_pos_neg.png +0 -0
- data/test/output_java/scatter_pos_neg_400.png +0 -0
- data/test/output_java/scatter_wide_graph.png +0 -0
- data/test/output_java/scatter_wide_graph_small.png +0 -0
- data/test/output_java/scene_hazy_night.png +0 -0
- data/test/output_java/scene_not_hazy_day.png +0 -0
- data/test/output_java/scene_partly_cloudy_day.png +0 -0
- data/test/output_java/scene_stormy_day.png +0 -0
- data/test/output_java/scene_stormy_night.png +0 -0
- data/test/output_java/side_bar.png +0 -0
- data/test/output_java/side_bar_data_range.png +0 -0
- data/test/output_java/side_bar_labels.png +0 -0
- data/test/output_java/side_bar_spacing_full.png +0 -0
- data/test/output_java/side_bar_spacing_half.png +0 -0
- data/test/output_java/side_bar_spacing_none.png +0 -0
- data/test/output_java/side_stacked_bar_keynote.png +0 -0
- data/test/output_java/side_stacked_bar_keynote_small.png +0 -0
- data/test/output_java/side_stacked_bar_labels.png +0 -0
- data/test/output_java/side_stacked_bar_long_label.png +0 -0
- data/test/output_java/side_stacked_bar_wide.png +0 -0
- data/test/output_java/spider_37signals.png +0 -0
- data/test/output_java/spider_equal.png +0 -0
- data/test/output_java/spider_keynote.png +0 -0
- data/test/output_java/spider_legend.png +0 -0
- data/test/output_java/spider_legend_small.png +0 -0
- data/test/output_java/spider_lots_of_data.png +0 -0
- data/test/output_java/spider_lots_of_data_normal_names.png +0 -0
- data/test/output_java/spider_nearly_equal.png +0 -0
- data/test/output_java/spider_no_axes.png +0 -0
- data/test/output_java/spider_no_background.png +0 -0
- data/test/output_java/spider_no_print.png +0 -0
- data/test/output_java/spider_overlay_1.png +0 -0
- data/test/output_java/spider_overlay_2.png +0 -0
- data/test/output_java/spider_rotation.png +0 -0
- data/test/output_java/spider_small.png +0 -0
- data/test/output_java/spider_wide.png +0 -0
- data/test/output_java/spider_zero.png +0 -0
- data/test/output_java/stacked_area_keynote.png +0 -0
- data/test/output_java/stacked_area_keynote_small.png +0 -0
- data/test/output_java/stacked_bar_keynote.png +0 -0
- data/test/output_java/stacked_bar_keynote_small.png +0 -0
- data/test/test_accumulator_bar.rb +7 -6
- data/test/test_area.rb +2 -2
- data/test/test_bar.rb +296 -112
- data/test/test_bezier.rb +33 -0
- data/test/test_bullet.rb +26 -26
- data/test/test_dot.rb +44 -54
- data/test/test_legend.rb +29 -29
- data/test/test_line.rb +250 -218
- data/test/test_net.rb +2 -1
- data/test/test_pie.rb +2 -2
- data/test/test_scatter.rb +85 -85
- data/test/test_side_bar.rb +13 -0
- data/test/test_sidestacked_bar.rb +16 -0
- data/test/test_spider.rb +11 -1
- data/test/test_stacked_area.rb +5 -5
- metadata +1041 -49
- data/.rvmrc +0 -5
- data/Gemfile.lock +0 -20
- data/LICENSE.txt +0 -22
- data/README.txt +0 -43
data/test/test_bezier.rb
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
require File.dirname(__FILE__) + "/gruff_test_case"
|
2
|
+
|
3
|
+
class TestBezier < GruffTestCase
|
4
|
+
|
5
|
+
def setup
|
6
|
+
@data_args = [75, 100, {
|
7
|
+
:target => 80,
|
8
|
+
:low => 50,
|
9
|
+
:high => 90
|
10
|
+
}]
|
11
|
+
end
|
12
|
+
|
13
|
+
def test_bezier
|
14
|
+
g = Gruff::Bezier.new
|
15
|
+
g.title = "Bezier?"
|
16
|
+
g.data 'Series 1', [0, 100]
|
17
|
+
g.write("test/output/bezier.png")
|
18
|
+
end
|
19
|
+
|
20
|
+
def test_bezier_2
|
21
|
+
g = Gruff::Bezier.new
|
22
|
+
g.data 'Series 2', [0, 127, 150]
|
23
|
+
g.write("test/output/bezier_2.png")
|
24
|
+
end
|
25
|
+
|
26
|
+
def test_bezier_3
|
27
|
+
g = Gruff::Bezier.new
|
28
|
+
g.data 'Series 3', [100,300,200,250]
|
29
|
+
g.minimum_value = 0
|
30
|
+
g.write("test/output/bezier_3.png")
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
data/test/test_bullet.rb
CHANGED
@@ -1,26 +1,26 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
1
|
+
require File.dirname(__FILE__) + "/gruff_test_case"
|
2
|
+
|
3
|
+
class TestGruffBullet < GruffTestCase
|
4
|
+
|
5
|
+
def setup
|
6
|
+
@data_args = [75, 100, {
|
7
|
+
:target => 80,
|
8
|
+
:low => 50,
|
9
|
+
:high => 90
|
10
|
+
}]
|
11
|
+
end
|
12
|
+
|
13
|
+
def test_bullet_graph
|
14
|
+
g = Gruff::Bullet.new
|
15
|
+
g.title = "Monthly Revenue"
|
16
|
+
g.data *@data_args
|
17
|
+
g.write("test/output/bullet_greyscale.png")
|
18
|
+
end
|
19
|
+
|
20
|
+
def test_no_options
|
21
|
+
g = Gruff::Bullet.new
|
22
|
+
g.data *@data_args
|
23
|
+
g.write("test/output/bullet_no_options.png")
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
data/test/test_dot.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
#!/usr/bin/ruby
|
2
2
|
|
3
|
-
require File.dirname(__FILE__) +
|
3
|
+
require File.dirname(__FILE__) + '/gruff_test_case'
|
4
4
|
|
5
5
|
class TestGruffDot < GruffTestCase
|
6
6
|
|
@@ -19,13 +19,13 @@ class TestGruffDot < GruffTestCase
|
|
19
19
|
|
20
20
|
def test_dot_graph
|
21
21
|
g = setup_basic_graph
|
22
|
-
g.title =
|
23
|
-
g.write(
|
22
|
+
g.title = 'Dot Graph Test'
|
23
|
+
g.write('test/output/dot.png')
|
24
24
|
end
|
25
25
|
|
26
26
|
def test_dot_graph_set_colors
|
27
27
|
g = Gruff::Dot.new
|
28
|
-
g.title =
|
28
|
+
g.title = 'Dot Graph With Manual Colors'
|
29
29
|
g.labels = {
|
30
30
|
0 => '5/6',
|
31
31
|
1 => '5/15',
|
@@ -38,23 +38,13 @@ class TestGruffDot < GruffTestCase
|
|
38
38
|
|
39
39
|
g.minimum_value = 0
|
40
40
|
|
41
|
-
g.write(
|
41
|
+
g.write('test/output/dot_manual_colors.png')
|
42
42
|
end
|
43
43
|
|
44
44
|
def test_dot_graph_small
|
45
|
-
g =
|
46
|
-
g.title =
|
47
|
-
g.
|
48
|
-
0 => '5/6',
|
49
|
-
1 => '5/15',
|
50
|
-
2 => '5/24',
|
51
|
-
3 => '5/30',
|
52
|
-
}
|
53
|
-
@datasets.each do |data|
|
54
|
-
g.data(data[0], data[1])
|
55
|
-
end
|
56
|
-
|
57
|
-
g.write("test/output/dot_keynote_small.png")
|
45
|
+
g = setup_basic_graph(400)
|
46
|
+
g.title = 'Visual Multi-Line Dot Graph Test'
|
47
|
+
g.write('test/output/dot_small.png')
|
58
48
|
end
|
59
49
|
|
60
50
|
# Somewhat worthless test. Should an error be thrown?
|
@@ -68,98 +58,98 @@ class TestGruffDot < GruffTestCase
|
|
68
58
|
|
69
59
|
def test_no_line_markers
|
70
60
|
g = setup_basic_graph(400)
|
71
|
-
g.title =
|
61
|
+
g.title = 'No Line Markers'
|
72
62
|
g.hide_line_markers = true
|
73
|
-
g.write(
|
63
|
+
g.write('test/output/dot_no_line_markers.png')
|
74
64
|
end
|
75
65
|
|
76
66
|
def test_no_legend
|
77
67
|
g = setup_basic_graph(400)
|
78
|
-
g.title =
|
68
|
+
g.title = 'No Legend'
|
79
69
|
g.hide_legend = true
|
80
|
-
g.write(
|
70
|
+
g.write('test/output/dot_no_legend.png')
|
81
71
|
end
|
82
72
|
|
83
73
|
def test_no_title
|
84
74
|
g = setup_basic_graph(400)
|
85
|
-
g.title =
|
75
|
+
g.title = 'No Title'
|
86
76
|
g.hide_title = true
|
87
|
-
g.write(
|
77
|
+
g.write('test/output/dot_no_title.png')
|
88
78
|
end
|
89
79
|
|
90
80
|
def test_no_title_or_legend
|
91
81
|
g = setup_basic_graph(400)
|
92
|
-
g.title =
|
82
|
+
g.title = 'No Title or Legend'
|
93
83
|
g.hide_legend = true
|
94
84
|
g.hide_title = true
|
95
|
-
g.write(
|
85
|
+
g.write('test/output/dot_no_title_or_legend.png')
|
96
86
|
end
|
97
87
|
|
98
88
|
def test_set_marker_count
|
99
89
|
g = setup_basic_graph(400)
|
100
|
-
g.title =
|
90
|
+
g.title = 'Set marker'
|
101
91
|
g.marker_count = 10
|
102
|
-
g.write(
|
92
|
+
g.write('test/output/dot_set_marker.png')
|
103
93
|
end
|
104
94
|
|
105
95
|
def test_set_legend_box_size
|
106
96
|
g = setup_basic_graph(400)
|
107
|
-
g.title =
|
97
|
+
g.title = 'Set Small Legend Box Size'
|
108
98
|
g.legend_box_size = 10.0
|
109
|
-
g.write(
|
99
|
+
g.write('test/output/dot_set_legend_box_size_sm.png')
|
110
100
|
|
111
101
|
g = setup_basic_graph(400)
|
112
|
-
g.title =
|
102
|
+
g.title = 'Set Large Legend Box Size'
|
113
103
|
g.legend_box_size = 50.0
|
114
|
-
g.write(
|
104
|
+
g.write('test/output/dot_set_legend_box_size_lg.png')
|
115
105
|
end
|
116
106
|
|
117
107
|
def test_x_y_labels
|
118
108
|
g = setup_basic_graph(400)
|
119
|
-
g.title =
|
109
|
+
g.title = 'X Y Labels'
|
120
110
|
g.x_axis_label = 'Score (%)'
|
121
|
-
g.y_axis_label =
|
122
|
-
g.write(
|
111
|
+
g.y_axis_label = 'Students'
|
112
|
+
g.write('test/output/dot_x_y_labels.png')
|
123
113
|
end
|
124
114
|
|
125
115
|
def test_wide_graph
|
126
116
|
g = setup_basic_graph('800x400')
|
127
|
-
g.title =
|
128
|
-
g.write(
|
117
|
+
g.title = 'Wide Graph'
|
118
|
+
g.write('test/output/dot_wide_graph.png')
|
129
119
|
|
130
120
|
g = setup_basic_graph('400x200')
|
131
|
-
g.title =
|
132
|
-
g.write(
|
121
|
+
g.title = 'Wide Graph Small'
|
122
|
+
g.write('test/output/dot_wide_graph_small.png')
|
133
123
|
end
|
134
124
|
|
135
125
|
|
136
126
|
def test_tall_graph
|
137
127
|
g = setup_basic_graph('400x600')
|
138
|
-
g.title =
|
139
|
-
g.write(
|
128
|
+
g.title = 'Tall Graph'
|
129
|
+
g.write('test/output/dot_tall_graph.png')
|
140
130
|
|
141
131
|
g = setup_basic_graph('200x400')
|
142
|
-
g.title =
|
143
|
-
g.write(
|
132
|
+
g.title = 'Tall Graph Small'
|
133
|
+
g.write('test/output/dot_tall_graph_small.png')
|
144
134
|
end
|
145
135
|
|
146
136
|
|
147
137
|
def test_one_value
|
148
138
|
g = Gruff::Dot.new
|
149
|
-
g.title =
|
139
|
+
g.title = 'One Value Graph Test'
|
150
140
|
g.labels = {
|
151
141
|
0 => '1',
|
152
142
|
1 => '2'
|
153
143
|
}
|
154
144
|
g.data('one', [1,1])
|
155
145
|
|
156
|
-
g.write(
|
146
|
+
g.write('test/output/dot_one_value.png')
|
157
147
|
end
|
158
148
|
|
159
149
|
|
160
150
|
def test_negative
|
161
151
|
g = Gruff::Dot.new
|
162
|
-
g.title =
|
152
|
+
g.title = 'Pos/Neg Dot Graph Test'
|
163
153
|
g.labels = {
|
164
154
|
0 => '5/6',
|
165
155
|
1 => '5/15',
|
@@ -169,13 +159,13 @@ class TestGruffDot < GruffTestCase
|
|
169
159
|
g.data(:apples, [-1, 0, 4, -4])
|
170
160
|
g.data(:peaches, [10, 8, 6, 3])
|
171
161
|
|
172
|
-
g.write(
|
162
|
+
g.write('test/output/dot_pos_neg.png')
|
173
163
|
end
|
174
164
|
|
175
165
|
|
176
166
|
def test_nearly_zero
|
177
167
|
g = Gruff::Dot.new
|
178
|
-
g.title =
|
168
|
+
g.title = 'Nearly Zero Graph'
|
179
169
|
g.labels = {
|
180
170
|
0 => '5/6',
|
181
171
|
1 => '5/15',
|
@@ -186,7 +176,7 @@ class TestGruffDot < GruffTestCase
|
|
186
176
|
g.data(:peaches, [4, 3, 2, 1])
|
187
177
|
g.minimum_value = 0
|
188
178
|
g.maximum_value = 10
|
189
|
-
g.write(
|
179
|
+
g.write('test/output/dot_nearly_zero_max_10.png')
|
190
180
|
end
|
191
181
|
|
192
182
|
def test_y_axis_increment
|
@@ -214,7 +204,7 @@ class TestGruffDot < GruffTestCase
|
|
214
204
|
|
215
205
|
def test_custom_theme
|
216
206
|
g = Gruff::Dot.new
|
217
|
-
g.title =
|
207
|
+
g.title = 'Custom Theme'
|
218
208
|
g.font = File.expand_path('CREABBRG.TTF', ENV['MAGICK_FONT_PATH'])
|
219
209
|
g.title_font_size = 60
|
220
210
|
g.legend_font_size = 32
|
@@ -223,7 +213,7 @@ class TestGruffDot < GruffTestCase
|
|
223
213
|
:colors => %w(#efd250 #666699 #e5573f #9595e2),
|
224
214
|
:marker_color => 'white',
|
225
215
|
:font_color => 'blue',
|
226
|
-
:background_image =>
|
216
|
+
:background_image => 'assets/pc306715.jpg'
|
227
217
|
}
|
228
218
|
g.labels = {
|
229
219
|
0 => '5/6',
|
@@ -236,13 +226,13 @@ class TestGruffDot < GruffTestCase
|
|
236
226
|
g.data(:portland, [3, 1, 7, 3])
|
237
227
|
g.data(:victoria, [4, 3, 5, 7])
|
238
228
|
g.minimum_value = 0
|
239
|
-
g.write(
|
229
|
+
g.write('test/output/dot_themed.png')
|
240
230
|
end
|
241
231
|
|
242
232
|
def test_july_enhancements
|
243
233
|
g = Gruff::Dot.new(600)
|
244
234
|
g.hide_legend = true
|
245
|
-
g.title =
|
235
|
+
g.title = 'Full speed ahead'
|
246
236
|
g.labels = (0..10).inject({}) { |memo, i| memo.merge({ i => (i*10).to_s}) }
|
247
237
|
g.data(:apples, (0..9).map { rand(20)/10.0 })
|
248
238
|
g.y_axis_increment = 1.0
|
@@ -256,7 +246,7 @@ protected
|
|
256
246
|
|
257
247
|
def setup_basic_graph(size=800)
|
258
248
|
g = Gruff::Dot.new(size)
|
259
|
-
g.title =
|
249
|
+
g.title = 'My Dot Graph'
|
260
250
|
g.labels = {
|
261
251
|
0 => '5/6',
|
262
252
|
1 => '5/15',
|
data/test/test_legend.rb
CHANGED
@@ -1,30 +1,30 @@
|
|
1
|
-
require File.dirname(__FILE__) +
|
1
|
+
require File.dirname(__FILE__) + '/gruff_test_case'
|
2
2
|
|
3
3
|
class TestGruffLegend < GruffTestCase
|
4
4
|
|
5
5
|
def setup
|
6
6
|
@datasets = [
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
7
|
+
[:Jimmy, [25, 36, 86, 39, 25, 31, 79, 88]],
|
8
|
+
[:Charles, [80, 54, 67, 54, 68, 70, 90, 95]],
|
9
|
+
[:Julie, [22, 29, 35, 38, 36, 40, 46, 57]],
|
10
|
+
[:Jane, [95, 95, 95, 90, 85, 80, 88, 100]],
|
11
|
+
[:Philip, [90, 34, 23, 12, 78, 89, 98, 88]],
|
12
|
+
[:Arthur, [5, 10, 13, 11, 6, 16, 22, 32]],
|
13
|
+
[:Vincent, [5, 10, 13, 11, 6, 16, 22, 32]],
|
14
|
+
[:Jake, [5, 10, 13, 11, 6, 16, 22, 32]],
|
15
|
+
[:Stephen, [5, 10, 13, 11, 6, 16, 22, 32]],
|
16
|
+
]
|
17
17
|
|
18
18
|
@sample_labels = {
|
19
|
-
0 => '5/6',
|
20
|
-
1 => '5/15',
|
21
|
-
2 => '5/24',
|
22
|
-
3 => '5/30',
|
23
|
-
4 => '6/4',
|
24
|
-
5 => '6/12',
|
25
|
-
6 => '6/21',
|
26
|
-
7 => '6/28',
|
27
|
-
|
19
|
+
0 => '5/6',
|
20
|
+
1 => '5/15',
|
21
|
+
2 => '5/24',
|
22
|
+
3 => '5/30',
|
23
|
+
4 => '6/4',
|
24
|
+
5 => '6/12',
|
25
|
+
6 => '6/21',
|
26
|
+
7 => '6/28',
|
27
|
+
}
|
28
28
|
end
|
29
29
|
|
30
30
|
def full_suite_for(name, type)
|
@@ -34,13 +34,13 @@ class TestGruffLegend < GruffTestCase
|
|
34
34
|
g.title = "Wrapped Legend Bar Test #{font_size}pts #{width}px"
|
35
35
|
g.labels = @sample_labels
|
36
36
|
0xEFD250.step(0xFF0000, 60) do |num|
|
37
|
-
g.colors <<
|
37
|
+
g.colors << '#%x' % num
|
38
38
|
end
|
39
|
-
|
39
|
+
|
40
40
|
@datasets.each do |data|
|
41
41
|
g.data(data[0], data[1])
|
42
42
|
end
|
43
|
-
|
43
|
+
|
44
44
|
g.legend_font_size = font_size unless font_size.nil?
|
45
45
|
g.write("test/output/#{name}_wrapped_legend_#{font_size}_#{width}.png")
|
46
46
|
end
|
@@ -50,19 +50,19 @@ class TestGruffLegend < GruffTestCase
|
|
50
50
|
def test_bar_legend_wrap
|
51
51
|
full_suite_for(:bar, Gruff::Bar)
|
52
52
|
end
|
53
|
-
|
53
|
+
|
54
54
|
def test_pie_legend_wrap
|
55
55
|
full_suite_for(:pie, Gruff::Pie)
|
56
56
|
end
|
57
|
-
|
57
|
+
|
58
58
|
def test_more_than_two_lines_of_legends
|
59
59
|
@datasets = @datasets + [[:Julie2, [22, 29, 35, 38, 36, 40, 46, 57]],
|
60
60
|
[:Jane2, [95, 95, 95, 90, 85, 80, 88, 100]],
|
61
61
|
[:Philip2, [90, 34, 23, 12, 78, 89, 98, 88]],
|
62
|
-
[
|
63
|
-
[
|
64
|
-
[
|
65
|
-
[
|
62
|
+
[:Arthur2, [5, 10, 13, 11, 6, 16, 22, 32]],
|
63
|
+
[:Vincent2, [5, 10, 13, 11, 6, 16, 22, 32]],
|
64
|
+
[:Jake2, [5, 10, 13, 11, 6, 16, 22, 32]],
|
65
|
+
[:Stephen2, [5, 10, 13, 11, 6, 16, 22, 32]]]
|
66
66
|
full_suite_for(:bar2, Gruff::Bar)
|
67
67
|
end
|
68
68
|
end
|
data/test/test_line.rb
CHANGED
@@ -1,30 +1,37 @@
|
|
1
1
|
#!/usr/bin/ruby
|
2
2
|
|
3
|
-
require File.dirname(__FILE__) +
|
3
|
+
require File.dirname(__FILE__) + '/gruff_test_case'
|
4
4
|
|
5
5
|
class TestGruffLine < GruffTestCase
|
6
|
-
|
7
|
-
# TODO Delete old output files once when starting tests
|
8
|
-
|
9
6
|
def test_should_render_with_transparent_theme
|
10
7
|
g = Gruff::Line.new(400)
|
11
|
-
g.title =
|
8
|
+
g.title = 'Transparent Background'
|
12
9
|
g.theme = {
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
10
|
+
:colors => %w(black grey),
|
11
|
+
:marker_color => 'grey',
|
12
|
+
:font_color => 'black',
|
13
|
+
:background_colors => 'transparent'
|
17
14
|
}
|
18
15
|
|
19
16
|
g.labels = {
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
17
|
+
0 => '5/6',
|
18
|
+
1 => '5/15',
|
19
|
+
2 => '5/24',
|
20
|
+
3 => '5/30',
|
24
21
|
}
|
25
22
|
g.data(:apples, [-1, 0, 4, -4])
|
26
23
|
g.data(:peaches, [10, 8, 6, 3])
|
27
|
-
g.write(
|
24
|
+
g.write('test/output/line_transparent.png')
|
25
|
+
end
|
26
|
+
|
27
|
+
def test_very_small
|
28
|
+
g = Gruff::Line.new(200)
|
29
|
+
g.title = 'Very Small Line Chart 200px'
|
30
|
+
g.labels = @labels
|
31
|
+
@datasets.each do |data|
|
32
|
+
g.data(data[0], data[1])
|
33
|
+
end
|
34
|
+
g.write('test/output/line_very_small.png')
|
28
35
|
end
|
29
36
|
|
30
37
|
def test_line_graph_with_themes
|
@@ -34,35 +41,35 @@ class TestGruffLine < GruffTestCase
|
|
34
41
|
|
35
42
|
def test_one_value
|
36
43
|
g = Gruff::Line.new
|
37
|
-
g.title =
|
44
|
+
g.title = 'One Value'
|
38
45
|
g.labels = {
|
39
|
-
|
40
|
-
|
46
|
+
0 => '1',
|
47
|
+
1 => '2'
|
41
48
|
}
|
42
49
|
g.data('one', 1)
|
43
50
|
|
44
|
-
g.write(
|
51
|
+
g.write('test/output/line_one_value.png')
|
45
52
|
end
|
46
53
|
|
47
54
|
def test_one_value_array
|
48
55
|
g = Gruff::Line.new
|
49
|
-
g.title =
|
56
|
+
g.title = 'One Value in an Array'
|
50
57
|
g.labels = {
|
51
|
-
|
52
|
-
|
58
|
+
0 => '1',
|
59
|
+
1 => '2'
|
53
60
|
}
|
54
61
|
g.data('one', [1])
|
55
62
|
|
56
|
-
g.write(
|
63
|
+
g.write('test/output/line_one_value_array.png')
|
57
64
|
end
|
58
65
|
|
59
66
|
|
60
67
|
def test_should_not_hang_with_0_0_100
|
61
68
|
g = Gruff::Line.new(320)
|
62
|
-
g.title =
|
63
|
-
g.data('test', [0,0,100])
|
69
|
+
g.title = 'Hang Value Graph Test'
|
70
|
+
g.data('test', [0, 0, 100])
|
64
71
|
|
65
|
-
g.write(
|
72
|
+
g.write('test/output/line_hang_value.png')
|
66
73
|
end
|
67
74
|
|
68
75
|
# TODO
|
@@ -79,57 +86,57 @@ class TestGruffLine < GruffTestCase
|
|
79
86
|
|
80
87
|
def test_line_small_values
|
81
88
|
@datasets = [
|
82
|
-
|
83
|
-
|
84
|
-
|
89
|
+
[:small, [0.1, 0.14356, 0.0, 0.5674839, 0.456]],
|
90
|
+
[:small2, [0.2, 0.3, 0.1, 0.05, 0.9]]
|
91
|
+
]
|
85
92
|
|
86
93
|
g = Gruff::Line.new
|
87
|
-
g.title =
|
94
|
+
g.title = 'Small Values Line Graph Test'
|
88
95
|
@datasets.each do |data|
|
89
96
|
g.data(data[0], data[1])
|
90
97
|
end
|
91
|
-
g.write(
|
98
|
+
g.write('test/output/line_small_values.png')
|
92
99
|
|
93
100
|
g = Gruff::Line.new(400)
|
94
|
-
g.title =
|
101
|
+
g.title = 'Small Values Line Graph Test 400px'
|
95
102
|
@datasets.each do |data|
|
96
103
|
g.data(data[0], data[1])
|
97
104
|
end
|
98
|
-
g.write(
|
105
|
+
g.write('test/output/line_small_values_small.png')
|
99
106
|
end
|
100
107
|
|
101
108
|
def test_line_starts_with_zero
|
102
109
|
@datasets = [
|
103
|
-
|
104
|
-
|
105
|
-
|
110
|
+
[:first0, [0, 5, 10, 8, 18]],
|
111
|
+
[:normal, [1, 2, 3, 4, 5]]
|
112
|
+
]
|
106
113
|
|
107
114
|
g = Gruff::Line.new
|
108
|
-
g.title =
|
115
|
+
g.title = 'Small Values Line Graph Test'
|
109
116
|
@datasets.each do |data|
|
110
117
|
g.data(data[0], data[1])
|
111
118
|
end
|
112
|
-
g.write(
|
119
|
+
g.write('test/output/line_small_zero.png')
|
113
120
|
|
114
121
|
g = Gruff::Line.new(400)
|
115
|
-
g.title =
|
122
|
+
g.title = 'Small Values Line Graph Test 400px'
|
116
123
|
@datasets.each do |data|
|
117
124
|
g.data(data[0], data[1])
|
118
125
|
end
|
119
|
-
g.write(
|
126
|
+
g.write('test/output/line_small_small_zero.png')
|
120
127
|
end
|
121
128
|
|
122
129
|
|
123
130
|
def test_line_large_values
|
124
131
|
@datasets = [
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
132
|
+
[:large, [100_005, 35_000, 28_000, 27_000]],
|
133
|
+
[:large2, [35_000, 28_000, 27_000, 100_005]],
|
134
|
+
[:large3, [28_000, 27_000, 100_005, 35_000]],
|
135
|
+
[:large4, [1_238, 39_092, 27_938, 48_876]]
|
136
|
+
]
|
130
137
|
|
131
138
|
g = Gruff::Line.new
|
132
|
-
g.title =
|
139
|
+
g.title = 'Very Large Values Line Graph Test'
|
133
140
|
g.baseline_value = 50_000
|
134
141
|
g.baseline_color = 'green'
|
135
142
|
g.dot_radius = 15
|
@@ -138,7 +145,7 @@ class TestGruffLine < GruffTestCase
|
|
138
145
|
g.data(data[0], data[1])
|
139
146
|
end
|
140
147
|
|
141
|
-
g.write(
|
148
|
+
g.write('test/output/line_large.png')
|
142
149
|
end
|
143
150
|
|
144
151
|
# def test_long_title
|
@@ -152,15 +159,15 @@ class TestGruffLine < GruffTestCase
|
|
152
159
|
|
153
160
|
def test_request_too_many_colors
|
154
161
|
g = Gruff::Line.new
|
155
|
-
g.title =
|
162
|
+
g.title = 'More Sets Than in Color Array'
|
156
163
|
# g.theme = {} # Sets theme with only black and white
|
157
164
|
@datasets.each do |data|
|
158
165
|
g.data(data[0], data[1])
|
159
166
|
end
|
160
167
|
@datasets.each do |data|
|
161
|
-
g.data("#{data[0]}-B", data[1].map {|d| d + 20})
|
168
|
+
g.data("#{data[0]}-B", data[1].map { |d| d + 20 })
|
162
169
|
end
|
163
|
-
g.write(
|
170
|
+
g.write('test/output/line_more_sets_than_colors.png')
|
164
171
|
end
|
165
172
|
|
166
173
|
#
|
@@ -170,116 +177,116 @@ class TestGruffLine < GruffTestCase
|
|
170
177
|
|
171
178
|
def test_many_datapoints
|
172
179
|
g = Gruff::Line.new
|
173
|
-
g.title =
|
180
|
+
g.title = 'Many Multi-Line Graph Test'
|
174
181
|
g.labels = {
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
182
|
+
0 => 'June',
|
183
|
+
10 => 'July',
|
184
|
+
30 => 'August',
|
185
|
+
50 => 'September',
|
179
186
|
}
|
180
|
-
g.data('many points', (0..50).collect {|i| rand(100) })
|
181
|
-
g.x_axis_label =
|
187
|
+
g.data('many points', (0..50).collect { |i| rand(100) })
|
188
|
+
g.x_axis_label = 'Months'
|
182
189
|
|
183
190
|
# Default theme
|
184
|
-
g.write(
|
191
|
+
g.write('test/output/line_many.png')
|
185
192
|
end
|
186
193
|
|
187
194
|
|
188
195
|
def test_similar_high_end_values
|
189
|
-
@dataset = %w(29.43 29.459 29.498 29.53 29.548 29.589 29.619 29.66 29.689 29.849 29.878 29.74 29.769 29.79 29.808 29.828).collect {|i| i.to_f}
|
196
|
+
@dataset = %w(29.43 29.459 29.498 29.53 29.548 29.589 29.619 29.66 29.689 29.849 29.878 29.74 29.769 29.79 29.808 29.828).collect { |i| i.to_f }
|
190
197
|
|
191
198
|
g = Gruff::Line.new
|
192
|
-
g.title =
|
193
|
-
g.data('similar points', @dataset
|
194
|
-
g.write(
|
199
|
+
g.title = 'Similar High End Values Test'
|
200
|
+
g.data('similar points', @dataset)
|
201
|
+
g.write('test/output/line_similar_high_end_values.png')
|
195
202
|
|
196
203
|
g = Gruff::Line.new
|
197
|
-
g.title =
|
198
|
-
g.data('similar points', @dataset
|
204
|
+
g.title = 'Similar High End Values With Floor'
|
205
|
+
g.data('similar points', @dataset)
|
199
206
|
g.minimum_value = 0
|
200
|
-
g.y_axis_label =
|
201
|
-
g.write(
|
207
|
+
g.y_axis_label = 'Barometric Pressure'
|
208
|
+
g.write('test/output/line_similar_high_end_values_with_floor.png')
|
202
209
|
end
|
203
210
|
|
204
211
|
def test_many_lines_graph_small
|
205
212
|
g = Gruff::Line.new(400)
|
206
|
-
g.title =
|
213
|
+
g.title = 'Many Values Line Test 400px'
|
207
214
|
g.labels = {
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
215
|
+
0 => '5/6',
|
216
|
+
10 => '5/15',
|
217
|
+
20 => '5/24',
|
218
|
+
30 => '5/30',
|
219
|
+
40 => '6/4',
|
220
|
+
50 => '6/16'
|
214
221
|
}
|
215
222
|
%w{jimmy jane philip arthur julie bert}.each do |student_name|
|
216
223
|
g.data(student_name, (0..50).collect { |i| rand 100 })
|
217
224
|
end
|
218
225
|
|
219
226
|
# Default theme
|
220
|
-
g.write(
|
227
|
+
g.write('test/output/line_many_lines_small.png')
|
221
228
|
end
|
222
229
|
|
223
230
|
def test_graph_tiny
|
224
231
|
g = Gruff::Line.new(300)
|
225
|
-
g.title =
|
232
|
+
g.title = 'Tiny Test 300px'
|
226
233
|
g.labels = {
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
234
|
+
0 => '5/6',
|
235
|
+
10 => '5/15',
|
236
|
+
20 => '5/24',
|
237
|
+
30 => '5/30',
|
238
|
+
40 => '6/4',
|
239
|
+
50 => '6/16'
|
233
240
|
}
|
234
241
|
%w{jimmy jane philip arthur julie bert}.each do |student_name|
|
235
242
|
g.data(student_name, (0..50).collect { |i| rand 100 })
|
236
243
|
end
|
237
244
|
|
238
245
|
# Default theme
|
239
|
-
g.write(
|
246
|
+
g.write('test/output/line_tiny.png')
|
240
247
|
end
|
241
248
|
|
242
249
|
def test_no_data
|
243
250
|
g = Gruff::Line.new(400)
|
244
|
-
g.title =
|
251
|
+
g.title = 'No Data'
|
245
252
|
# Default theme
|
246
|
-
g.write(
|
253
|
+
g.write('test/output/line_no_data.png')
|
247
254
|
|
248
255
|
g = Gruff::Line.new(400)
|
249
|
-
g.title =
|
256
|
+
g.title = 'No Data Title'
|
250
257
|
g.no_data_message = 'There is no data'
|
251
|
-
g.write(
|
258
|
+
g.write('test/output/line_no_data_msg.png')
|
252
259
|
end
|
253
260
|
|
254
261
|
|
255
262
|
def test_all_zeros
|
256
263
|
g = Gruff::Line.new(400)
|
257
|
-
g.title =
|
264
|
+
g.title = 'All Zeros'
|
258
265
|
|
259
|
-
g.data(:gus, [0,0,0,0])
|
266
|
+
g.data(:gus, [0, 0, 0, 0])
|
260
267
|
|
261
268
|
# Default theme
|
262
|
-
g.write(
|
269
|
+
g.write('test/output/line_no_data_other.png')
|
263
270
|
end
|
264
271
|
|
265
272
|
|
266
273
|
def test_some_nil_points
|
267
274
|
g = Gruff::Line.new
|
268
|
-
g.title =
|
275
|
+
g.title = 'Some Nil Points'
|
269
276
|
|
270
277
|
@datasets = [
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
278
|
+
[:data1, [1, 2, 3, nil, 3, 5, 6]],
|
279
|
+
[:data2, [5, nil, nil, 5, nil, nil, 5]],
|
280
|
+
[:data3, [4, nil, 2, 1, 0]],
|
281
|
+
[:data4, [nil, nil, 3, 1, 2]]
|
282
|
+
]
|
276
283
|
|
277
284
|
@datasets.each do |data|
|
278
285
|
g.data(*data)
|
279
286
|
end
|
280
287
|
|
281
288
|
# Default theme
|
282
|
-
g.write(
|
289
|
+
g.write('test/output/line_some_nil_points.png')
|
283
290
|
end
|
284
291
|
|
285
292
|
def test_no_title
|
@@ -289,150 +296,162 @@ class TestGruffLine < GruffTestCase
|
|
289
296
|
g.data(data[0], data[1])
|
290
297
|
end
|
291
298
|
|
292
|
-
g.write(
|
299
|
+
g.write('test/output/line_no_title.png')
|
293
300
|
end
|
294
301
|
|
295
302
|
def test_no_line_markers
|
296
303
|
g = setup_basic_graph(400)
|
297
|
-
g.title =
|
304
|
+
g.title = 'No Line Markers'
|
298
305
|
g.hide_line_markers = true
|
299
|
-
g.write(
|
306
|
+
g.write('test/output/line_no_line_markers.png')
|
300
307
|
end
|
301
308
|
|
302
309
|
def test_no_legend
|
303
310
|
g = setup_basic_graph(400)
|
304
|
-
g.title =
|
311
|
+
g.title = 'No Legend'
|
305
312
|
g.hide_legend = true
|
306
|
-
g.write(
|
313
|
+
g.write('test/output/line_no_legend.png')
|
307
314
|
end
|
308
315
|
|
309
316
|
def test_nothing_but_the_graph
|
310
317
|
g = setup_basic_graph(400)
|
311
|
-
g.title =
|
318
|
+
g.title = 'THIS TITLE SHOULD NOT DISPLAY!!!'
|
312
319
|
g.hide_line_markers = true
|
313
320
|
g.hide_legend = true
|
314
321
|
g.hide_title = true
|
315
|
-
g.write(
|
322
|
+
g.write('test/output/line_nothing_but_the_graph.png')
|
323
|
+
end
|
324
|
+
|
325
|
+
def test_legend_below_the_chart
|
326
|
+
g = setup_basic_graph(400)
|
327
|
+
g.title = 'Legend below the chart'
|
328
|
+
g.legend_at_bottom = true
|
329
|
+
g.write('test/output/line_legend_at_bottom.png')
|
316
330
|
end
|
317
331
|
|
318
332
|
def test_baseline_larger_than_data
|
319
333
|
g = setup_basic_graph(400)
|
320
|
-
g.title =
|
334
|
+
g.title = 'Baseline Larger Than Data'
|
321
335
|
g.baseline_value = 150
|
322
|
-
g.write(
|
336
|
+
g.write('test/output/line_large_baseline.png')
|
323
337
|
end
|
324
338
|
|
325
|
-
|
326
339
|
def test_hide_dots
|
327
340
|
g = setup_basic_graph(400)
|
328
|
-
g.title =
|
341
|
+
g.title = 'Hide Dots'
|
329
342
|
g.hide_dots = true
|
330
|
-
g.write(
|
343
|
+
g.write('test/output/line_hide_dots.png')
|
331
344
|
end
|
332
345
|
|
333
346
|
def test_hide_lines
|
334
347
|
g = setup_basic_graph(400)
|
335
|
-
g.title =
|
348
|
+
g.title = 'Hide Lines'
|
336
349
|
g.hide_lines = true
|
337
|
-
g.write(
|
350
|
+
g.write('test/output/line_hide_lines.png')
|
338
351
|
end
|
339
352
|
|
340
353
|
def test_wide_graph
|
341
354
|
g = setup_basic_graph('800x400')
|
342
|
-
g.title =
|
343
|
-
g.write(
|
355
|
+
g.title = 'Wide Graph'
|
356
|
+
g.write('test/output/line_wide_graph.png')
|
344
357
|
|
345
358
|
g = setup_basic_graph('400x200')
|
346
|
-
g.title =
|
347
|
-
g.write(
|
359
|
+
g.title = 'Wide Graph Small'
|
360
|
+
g.write('test/output/line_wide_graph_small.png')
|
348
361
|
end
|
349
362
|
|
350
363
|
def test_negative
|
351
364
|
g = setup_pos_neg(800)
|
352
|
-
g.write(
|
365
|
+
g.write('test/output/line_pos_neg.png')
|
353
366
|
|
354
367
|
g = setup_pos_neg(400)
|
355
368
|
g.title = 'Pos/Neg Line Test Small'
|
356
|
-
g.write(
|
369
|
+
g.write('test/output/line_pos_neg_400.png')
|
357
370
|
end
|
358
371
|
|
359
372
|
def test_all_negative
|
360
373
|
g = setup_all_neg(800)
|
361
|
-
g.
|
374
|
+
g.maximum_value = 0
|
375
|
+
g.write('test/output/line_all_neg.png')
|
376
|
+
end
|
362
377
|
|
378
|
+
def test_all_negative_no_max_value
|
379
|
+
g = setup_all_neg(800)
|
380
|
+
g.write('test/output/line_all_neg_no_max.png')
|
381
|
+
end
|
382
|
+
|
383
|
+
def test_all_negative_400
|
363
384
|
g = setup_all_neg(400)
|
385
|
+
g.maximum_value = 0
|
364
386
|
g.title = 'All Neg Line Test Small'
|
365
|
-
g.write(
|
387
|
+
g.write('test/output/line_all_neg_400.png')
|
366
388
|
end
|
367
389
|
|
368
390
|
def test_many_numbers
|
369
391
|
g = Gruff::Line.new('400x170')
|
370
|
-
g.title =
|
392
|
+
g.title = 'Line Test, Many Numbers'
|
371
393
|
|
372
394
|
data = [
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
|
392
|
-
|
393
|
-
|
394
|
-
:
|
395
|
-
:
|
396
|
-
:
|
397
|
-
{ :date => '07'},
|
398
|
-
{ :date => '08' },
|
399
|
-
{ :date => '09',
|
395
|
+
{:date => '01',
|
396
|
+
:wpm => 0,
|
397
|
+
:errors => 0,
|
398
|
+
:accuracy => 0},
|
399
|
+
{:date => '02',
|
400
|
+
:wpm => 10,
|
401
|
+
:errors => 2,
|
402
|
+
:accuracy => 80},
|
403
|
+
{:date => '03',
|
404
|
+
:wpm => 15,
|
405
|
+
:errors => 0,
|
406
|
+
:accuracy => 100},
|
407
|
+
{:date => '04',
|
408
|
+
:wpm => 16,
|
409
|
+
:errors => 2,
|
410
|
+
:accuracy => 87},
|
411
|
+
{:date => '05'},
|
412
|
+
{:date => '06',
|
413
|
+
:wpm => 18,
|
414
|
+
:errors => 1,
|
415
|
+
:accuracy => 94},
|
416
|
+
{:date => '07'},
|
417
|
+
{:date => '08'},
|
418
|
+
{:date => '09',
|
400
419
|
:wpm => 21,
|
401
420
|
:errors => 1,
|
402
|
-
:accuracy => 95
|
403
|
-
|
404
|
-
|
405
|
-
|
406
|
-
|
407
|
-
|
408
|
-
|
409
|
-
|
410
|
-
|
411
|
-
|
412
|
-
|
421
|
+
:accuracy => 95},
|
422
|
+
{:date => '10'},
|
423
|
+
{:date => '11'},
|
424
|
+
{:date => '12'},
|
425
|
+
{:date => '13'},
|
426
|
+
{:date => '14'},
|
427
|
+
{:date => '15'},
|
428
|
+
{:date => '16'},
|
429
|
+
{:date => '17'},
|
430
|
+
{:date => '18'},
|
431
|
+
{:date => '19',
|
413
432
|
:wpm => 28,
|
414
433
|
:errors => 5,
|
415
|
-
:accuracy => 82
|
416
|
-
|
417
|
-
|
418
|
-
|
419
|
-
|
420
|
-
|
421
|
-
|
422
|
-
|
423
|
-
|
434
|
+
:accuracy => 82},
|
435
|
+
{:date => '20'},
|
436
|
+
{:date => '21'},
|
437
|
+
{:date => '22'},
|
438
|
+
{:date => '23'},
|
439
|
+
{:date => '24'},
|
440
|
+
{:date => '25'},
|
441
|
+
{:date => '26'},
|
442
|
+
{:date => '27',
|
424
443
|
:wpm => 37,
|
425
444
|
:errors => 3,
|
426
|
-
:accuracy => 92
|
445
|
+
:accuracy => 92},
|
427
446
|
]
|
428
447
|
|
429
448
|
[:wpm, :errors, :accuracy].each do |field|
|
430
|
-
g.
|
449
|
+
g.dataxy(field, data.each_with_index.map { |d, i| [i + 1, d[field]] if d[field] }.compact)
|
431
450
|
end
|
432
451
|
|
433
452
|
labels = Hash.new
|
434
453
|
data.each_with_index do |d, i|
|
435
|
-
labels[i] = d[:date]
|
454
|
+
labels[i + 1] = d[:date] if d.size > 1
|
436
455
|
end
|
437
456
|
g.labels = labels
|
438
457
|
|
@@ -441,7 +460,7 @@ class TestGruffLine < GruffTestCase
|
|
441
460
|
|
442
461
|
def test_no_hide_line_no_labels
|
443
462
|
g = Gruff::Line.new
|
444
|
-
g.title =
|
463
|
+
g.title = 'No Hide Line No Labels'
|
445
464
|
@datasets.each do |data|
|
446
465
|
g.data(data[0], data[1])
|
447
466
|
end
|
@@ -451,32 +470,32 @@ class TestGruffLine < GruffTestCase
|
|
451
470
|
|
452
471
|
def test_xy_data
|
453
472
|
g = Gruff::Line.new
|
454
|
-
g.title =
|
455
|
-
g.dataxy(
|
456
|
-
g.dataxy(
|
457
|
-
g.data(
|
458
|
-
g.labels = {0 => '2003', 2 => '2004', 4 => '2005'}
|
459
|
-
g.write('test/output/
|
473
|
+
g.title = 'X/Y Dataset'
|
474
|
+
g.dataxy('Apples', [1, 3, 4, 5, 6, 10], [1, 2, 3, 4, 4, 3])
|
475
|
+
g.dataxy('Bapples', [1, 3, 4, 5, 7, 9], [1, 1, 2, 2, 3, 3])
|
476
|
+
g.data('Capples', [1, 1, 2, 2, 3, 3])
|
477
|
+
g.labels = {0 => '2003', 2 => '2004', 4 => '2005', 6 => '2006', 8 => '2007', 10 => '2008'}
|
478
|
+
g.write('test/output/line_xy.png')
|
460
479
|
end
|
461
480
|
|
462
481
|
def test_xy_data_pairs
|
463
482
|
g = Gruff::Line.new
|
464
|
-
g.title =
|
465
|
-
g.dataxy(
|
466
|
-
g.dataxy(
|
467
|
-
g.data(
|
468
|
-
g.dataxy(
|
469
|
-
g.dataxy(
|
470
|
-
g.labels = {0 => '2003', 2 => '2004', 4 => '2005'}
|
471
|
-
g.write('test/output/
|
483
|
+
g.title = 'X/Y Dataset Pairs'
|
484
|
+
g.dataxy('Apples', [[1, 1], [3, 2], [4, 3], [5, 4], [6, 4], [10, 3]])
|
485
|
+
g.dataxy('Bapples', [[1, 1], [3, 1], [4, 2], [5, 2], [7, 3], [9, 3]])
|
486
|
+
g.data('Capples', [1, 1, 2, 2, 3, 3])
|
487
|
+
g.dataxy('Dapples', [[1, 1], [2, 3], [5, 8], [13, 21]])
|
488
|
+
g.dataxy('Eapples', [[1, 1], [2, 3], [5, 8], [13, 21], [13, 8], [5, 3], [2, 1], [1, 1]])
|
489
|
+
g.labels = {0 => '2003', 2 => '2004', 4 => '2005', 6 => '2006', 8 => '2007', 10 => '2008', 12 => '2009'}
|
490
|
+
g.write('test/output/line_xy_pairs.png')
|
472
491
|
end
|
473
492
|
|
474
493
|
def test_jruby_error
|
475
494
|
g = Gruff::Line.new
|
476
495
|
g.theme = {
|
477
|
-
|
478
|
-
|
479
|
-
|
496
|
+
:colors => %w(#7F0099 #2F85ED #2FED09 #EC962F),
|
497
|
+
:marker_color => '#aaa',
|
498
|
+
:background_colors => %w(#E8E8E8 #B9FD6C)
|
480
499
|
}
|
481
500
|
g.hide_title = true
|
482
501
|
|
@@ -489,36 +508,49 @@ class TestGruffLine < GruffTestCase
|
|
489
508
|
|
490
509
|
def test_marker_label_accuracy
|
491
510
|
g = Gruff::Line.new
|
492
|
-
g.title =
|
511
|
+
g.title = 'Marker label accuracy'
|
493
512
|
g.labels = {
|
494
|
-
|
495
|
-
|
496
|
-
|
497
|
-
|
498
|
-
|
513
|
+
0 => '1',
|
514
|
+
1 => '2',
|
515
|
+
2 => '3',
|
516
|
+
3 => '4',
|
517
|
+
4 => '5'
|
499
518
|
}
|
500
|
-
g.data('first',
|
519
|
+
g.data('first', [0.5, 0.51, 0.52, 0.53, 0.54])
|
501
520
|
g.data('second', [0.6, 0.61, 0.62, 0.63, 0.64])
|
502
|
-
g.data('third',
|
521
|
+
g.data('third', [0.7, 0.71, 0.72, 0.73, 0.74])
|
503
522
|
|
504
|
-
g.write(
|
523
|
+
g.write('test/output/line_marker_label_accuracy.png')
|
505
524
|
end
|
506
525
|
|
526
|
+
def test_y_axis_increment
|
527
|
+
g = Gruff::Line.new
|
528
|
+
g.title = 'y axis increment'
|
529
|
+
|
530
|
+
g.data('data', [1, 2, 3])
|
507
531
|
|
508
|
-
|
532
|
+
g.y_axis_increment = 1
|
509
533
|
|
510
|
-
|
511
|
-
|
534
|
+
g.write('test/output/line_y_axis_increment.png')
|
535
|
+
end
|
512
536
|
|
513
|
-
|
537
|
+
def test_baseline
|
538
|
+
g = Gruff::Line.new
|
539
|
+
g.title = 'Line Chart with Baseline = 5'
|
514
540
|
|
515
|
-
|
541
|
+
g.data('Apples', [3, 2, 3, 4, 4, 3])
|
542
|
+
g.data('Oranges', [4, 8, 7, 9, 8, 9])
|
543
|
+
g.data('Watermelon', [2, 3, 4, 5, 6, 8])
|
544
|
+
g.data('Peaches', [9, 9, 10, 8, 7, 9])
|
516
545
|
|
517
|
-
g.
|
518
|
-
g.
|
519
|
-
|
546
|
+
g.labels = {0 => '2003', 2 => '2004', 4 => '2005'}
|
547
|
+
g.baseline_value = 5
|
548
|
+
|
549
|
+
g.write('line_baseline.png')
|
520
550
|
end
|
521
551
|
|
552
|
+
private
|
553
|
+
|
522
554
|
# TODO Reset data after each theme
|
523
555
|
def line_graph_with_themes(size=nil)
|
524
556
|
g = Gruff::Line.new(size)
|
@@ -535,7 +567,7 @@ private
|
|
535
567
|
g.title = "Multi-Line Graph Test #{size}"
|
536
568
|
g.labels = @labels
|
537
569
|
g.baseline_value = 90
|
538
|
-
g.
|
570
|
+
g.theme = Gruff::Themes::THIRTYSEVEN_SIGNALS
|
539
571
|
@datasets.each do |data|
|
540
572
|
g.data(data[0], data[1])
|
541
573
|
end
|
@@ -545,7 +577,7 @@ private
|
|
545
577
|
g.title = "Multi-Line Graph Test #{size}"
|
546
578
|
g.labels = @labels
|
547
579
|
g.baseline_value = 90
|
548
|
-
g.
|
580
|
+
g.theme = Gruff::Themes::RAILS_KEYNOTE
|
549
581
|
@datasets.each do |data|
|
550
582
|
g.data(data[0], data[1])
|
551
583
|
end
|
@@ -555,7 +587,7 @@ private
|
|
555
587
|
g.title = "Multi-Line Graph Test #{size}"
|
556
588
|
g.labels = @labels
|
557
589
|
g.baseline_value = 90
|
558
|
-
g.
|
590
|
+
g.theme = Gruff::Themes::ODEO
|
559
591
|
@datasets.each do |data|
|
560
592
|
g.data(data[0], data[1])
|
561
593
|
end
|
@@ -564,31 +596,31 @@ private
|
|
564
596
|
|
565
597
|
def setup_pos_neg(size=800)
|
566
598
|
g = Gruff::Line.new(size)
|
567
|
-
g.title =
|
599
|
+
g.title = 'Pos/Neg Line Graph Test'
|
568
600
|
g.labels = {
|
569
|
-
|
570
|
-
|
571
|
-
|
572
|
-
|
601
|
+
0 => '5/6',
|
602
|
+
1 => '5/15',
|
603
|
+
2 => '5/24',
|
604
|
+
3 => '5/30',
|
573
605
|
}
|
574
606
|
g.data(:apples, [-1, 0, 4, -4])
|
575
607
|
g.data(:peaches, [10, 8, 6, 3])
|
576
|
-
|
608
|
+
g
|
577
609
|
end
|
578
610
|
|
579
611
|
|
580
612
|
def setup_all_neg(size=800)
|
581
613
|
g = Gruff::Line.new(size)
|
582
|
-
g.title =
|
614
|
+
g.title = 'All Neg Line Graph Test'
|
583
615
|
g.labels = {
|
584
|
-
|
585
|
-
|
586
|
-
|
587
|
-
|
616
|
+
0 => '5/6',
|
617
|
+
1 => '5/15',
|
618
|
+
2 => '5/24',
|
619
|
+
3 => '5/30',
|
588
620
|
}
|
589
621
|
g.data(:apples, [-1, -5, -20, -4])
|
590
622
|
g.data(:peaches, [-10, -8, -6, -3])
|
591
623
|
g
|
592
624
|
end
|
593
|
-
|
625
|
+
|
594
626
|
end
|