Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adjust line number position on side graph #624

Merged
merged 1 commit into from
Aug 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion lib/gruff/dot.rb
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,9 @@ def draw_line_markers

unless @hide_line_numbers
label = y_axis_label(marker_label, @increment)
y = @graph_bottom + @label_margin + (labels_caps_height / 2.0) + 5 # 5px offset for tick_mark_mode
text_renderer = Gruff::Renderer::Text.new(renderer, label, font: @marker_font)
text_renderer.add_to_render_queue(0, 0, x, @graph_bottom + (@label_margin * 1.5), Magick::CenterGravity)
text_renderer.add_to_render_queue(0, 0, x, y, Magick::CenterGravity)
end
end
end
Expand Down
3 changes: 2 additions & 1 deletion lib/gruff/side_bar.rb
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,9 @@ def draw_line_markers
diff = index - number_of_lines
marker_label = (BigDecimal(diff.abs.to_s) * BigDecimal(increment.to_s)) + BigDecimal(minimum_value.to_s)
label = x_axis_label(marker_label, @increment)
y = @graph_bottom + @label_margin + (labels_caps_height / 2.0)
text_renderer = Gruff::Renderer::Text.new(renderer, label, font: @marker_font)
text_renderer.add_to_render_queue(0, 0, x, @graph_bottom + @label_margin, Magick::CenterGravity)
text_renderer.add_to_render_queue(0, 0, x, y, Magick::CenterGravity)
end
end
end
Expand Down
Binary file modified test/expected/dot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/expected/dot_duck_typing.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/expected/dot_empty_data.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/expected/dot_manual_colors.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/expected/dot_marker_shadow_color.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/expected/dot_nearly_zero_max_10.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/expected/dot_no_labels.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/expected/dot_no_legend.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/expected/dot_no_title.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/expected/dot_no_title_or_legend.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/expected/dot_one_value.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/expected/dot_pos_neg.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/expected/dot_set_legend_box_size_lg.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/expected/dot_set_legend_box_size_sm.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/expected/dot_set_marker.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/expected/dot_set_trailing_dots_trunc.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/expected/dot_small.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/expected/dot_tall_graph.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/expected/dot_tall_graph_small.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/expected/dot_themed.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/expected/dot_wide_graph.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/expected/dot_wide_graph_small.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/expected/dot_x_y_labels.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/expected/dot_y_increment_1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/expected/dot_y_increment_2.0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/expected/dot_y_increment_20.png
Binary file modified test/expected/dot_y_increment_5.png
Binary file modified test/expected/enhancements_dot.png
Binary file modified test/expected/line_empty_data.png
Binary file modified test/expected/side_bar.png
Binary file modified test/expected/side_bar_all_neg.png
Binary file modified test/expected/side_bar_axis_label_with_legend_at_bottom.png
Binary file modified test/expected/side_bar_data_range.png
Binary file modified test/expected/side_bar_duck_typing.png
Binary file modified test/expected/side_bar_empty_data.png
Binary file modified test/expected/side_bar_group_spacing.png
Binary file modified test/expected/side_bar_label_format.png
Binary file modified test/expected/side_bar_labels.png
Binary file modified test/expected/side_bar_labels_position.png
Binary file modified test/expected/side_bar_no_labels.png
Binary file modified test/expected/side_bar_pos_neg.png
Binary file modified test/expected/side_bar_set_trailing_dots_trunc.png
Binary file modified test/expected/side_bar_spacing_full.png
Binary file modified test/expected/side_bar_spacing_half.png
Binary file modified test/expected/side_bar_spacing_none.png
Binary file modified test/expected/side_stacked_bar_duck_typing.png
Binary file modified test/expected/side_stacked_bar_empty_data.png
Binary file modified test/expected/side_stacked_bar_keynote.png
Binary file modified test/expected/side_stacked_bar_keynote_small.png
Binary file modified test/expected/side_stacked_bar_label_format.png
Binary file modified test/expected/side_stacked_bar_labels.png
Binary file modified test/expected/side_stacked_bar_long_label.png
Binary file modified test/expected/side_stacked_bar_no_labels.png
Binary file modified test/expected/side_stacked_bar_overlap_coordinate_axes.png
Binary file modified test/expected/side_stacked_bar_wide.png