gruff 0.16.0-java → 0.19.0-java
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.devcontainer/devcontainer.json +26 -0
- data/.github/workflows/ci.yml +9 -6
- data/.gitignore +1 -0
- data/.rubocop.yml +0 -6
- data/CHANGELOG.md +32 -0
- data/README.md +7 -3
- data/gruff.gemspec +2 -4
- data/lib/gruff/area.rb +3 -1
- data/lib/gruff/bar.rb +26 -24
- data/lib/gruff/base.rb +214 -93
- data/lib/gruff/bezier.rb +7 -8
- data/lib/gruff/{box_plot.rb → box.rb} +12 -6
- data/lib/gruff/bubble.rb +99 -0
- data/lib/gruff/candlestick.rb +22 -14
- data/lib/gruff/dot.rb +5 -6
- data/lib/gruff/helper/bar_conversion.rb +1 -5
- data/lib/gruff/helper/bar_mixin.rb +25 -0
- data/lib/gruff/helper/bar_value_label.rb +0 -22
- data/lib/gruff/helper/stacked_mixin.rb +16 -0
- data/lib/gruff/histogram.rb +8 -5
- data/lib/gruff/line.rb +47 -27
- data/lib/gruff/mini/bar.rb +1 -1
- data/lib/gruff/mini/legend.rb +13 -9
- data/lib/gruff/mini/pie.rb +2 -2
- data/lib/gruff/net.rb +26 -13
- data/lib/gruff/pie.rb +7 -2
- data/lib/gruff/renderer/bezier.rb +1 -1
- data/lib/gruff/renderer/circle.rb +5 -3
- data/lib/gruff/renderer/dash_line.rb +1 -1
- data/lib/gruff/renderer/dot.rb +26 -15
- data/lib/gruff/renderer/line.rb +1 -1
- data/lib/gruff/renderer/polygon.rb +1 -1
- data/lib/gruff/renderer/polyline.rb +4 -2
- data/lib/gruff/renderer/renderer.rb +0 -4
- data/lib/gruff/renderer/text.rb +7 -1
- data/lib/gruff/scatter.rb +52 -55
- data/lib/gruff/side_bar.rb +28 -24
- data/lib/gruff/side_stacked_bar.rb +36 -41
- data/lib/gruff/spider.rb +7 -2
- data/lib/gruff/stacked_area.rb +8 -3
- data/lib/gruff/stacked_bar.rb +48 -40
- data/lib/gruff/store/xy_data.rb +8 -9
- data/lib/gruff/store/xy_pointsizes_data.rb +60 -0
- data/lib/gruff/version.rb +1 -1
- data/lib/gruff.rb +3 -4
- metadata +9 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fa39c23fc44be66931c2b7f05ad88021b82a8a900ce7894eb962ddaf9ba895f3
|
4
|
+
data.tar.gz: c1bbf2d54c4ad2760e66352626fc07b7b3f89ee4c8d9edcaa87270c173572c4d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d82e25b5eefc2e5c8ead58a5e3968b5df4952066032d5fa7c80dd69516b726644c76e91d7e136389cc5c0a6899291b2ac6a4a57548116fd8c53ced4bf347d3b8
|
7
|
+
data.tar.gz: 0d9e8d013c78269a606c85fbf3313302dd9048b37c3fd3eeae55894823a1754fc389073aa4381a4598511fbb31bdc1c2d56b565bc1bc2fac922b3a38261540e8
|
@@ -0,0 +1,26 @@
|
|
1
|
+
// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at:
|
2
|
+
// https://github.com/microsoft/vscode-dev-containers/tree/v0.245.0/containers/docker-existing-dockerfile
|
3
|
+
{
|
4
|
+
"name": "Existing Dockerfile",
|
5
|
+
|
6
|
+
// Sets the run context to one level up instead of the .devcontainer folder.
|
7
|
+
"context": "..",
|
8
|
+
|
9
|
+
// Update the 'dockerFile' property if you aren't using the standard 'Dockerfile' filename.
|
10
|
+
"dockerFile": "../Dockerfile"
|
11
|
+
|
12
|
+
// Use 'forwardPorts' to make a list of ports inside the container available locally.
|
13
|
+
// "forwardPorts": [],
|
14
|
+
|
15
|
+
// Uncomment the next line to run commands after the container is created - for example installing curl.
|
16
|
+
// "postCreateCommand": "apt-get update && apt-get install -y curl",
|
17
|
+
|
18
|
+
// Uncomment when using a ptrace-based debugger like C++, Go, and Rust
|
19
|
+
// "runArgs": [ "--cap-add=SYS_PTRACE", "--security-opt", "seccomp=unconfined" ],
|
20
|
+
|
21
|
+
// Uncomment to use the Docker CLI from inside the container. See https://aka.ms/vscode-remote/samples/docker-from-docker.
|
22
|
+
// "mounts": [ "source=/var/run/docker.sock,target=/var/run/docker.sock,type=bind" ],
|
23
|
+
|
24
|
+
// Uncomment to connect as a non-root user if you've added one. See https://aka.ms/vscode-remote/containers/non-root.
|
25
|
+
// "remoteUser": "vscode"
|
26
|
+
}
|
data/.github/workflows/ci.yml
CHANGED
@@ -6,9 +6,12 @@ on:
|
|
6
6
|
pull_request:
|
7
7
|
branches: [ master ]
|
8
8
|
|
9
|
+
permissions:
|
10
|
+
contents: read
|
11
|
+
|
9
12
|
jobs:
|
10
13
|
lint:
|
11
|
-
runs-on: ubuntu-
|
14
|
+
runs-on: ubuntu-22.04
|
12
15
|
timeout-minutes: 20
|
13
16
|
name: Lint
|
14
17
|
steps:
|
@@ -23,18 +26,18 @@ jobs:
|
|
23
26
|
- name: Install dependencies
|
24
27
|
run: bundle install --path=vendor/bundle --jobs 4 --retry 3
|
25
28
|
- name: RuboCop Problem Matchers
|
26
|
-
uses: r7kamura/rubocop-problem-matchers-action@v1
|
29
|
+
uses: r7kamura/rubocop-problem-matchers-action@v1
|
27
30
|
- name: Run tests
|
28
31
|
run: bundle exec rubocop
|
29
32
|
|
30
33
|
test-ruby:
|
31
|
-
runs-on: ubuntu-
|
34
|
+
runs-on: ubuntu-22.04
|
32
35
|
timeout-minutes: 20
|
33
36
|
strategy:
|
34
37
|
matrix:
|
35
38
|
ruby-version: ['2.5', '2.6', '2.7', '3.0', '3.1']
|
36
39
|
imagemagick-version:
|
37
|
-
- { full: 7.1.0-
|
40
|
+
- { full: 7.1.0-45, major-minor: '7.0' }
|
38
41
|
name: Ruby ${{ matrix.ruby-version }}
|
39
42
|
steps:
|
40
43
|
- uses: actions/checkout@v3
|
@@ -60,11 +63,11 @@ jobs:
|
|
60
63
|
run: bundle exec rake
|
61
64
|
|
62
65
|
test-jruby:
|
63
|
-
runs-on: ubuntu-
|
66
|
+
runs-on: ubuntu-22.04
|
64
67
|
timeout-minutes: 20
|
65
68
|
strategy:
|
66
69
|
matrix:
|
67
|
-
ruby-version: ['9.2.
|
70
|
+
ruby-version: ['9.2.21.0', '9.3.7.0']
|
68
71
|
name: JRuby ${{ matrix.ruby-version }}
|
69
72
|
steps:
|
70
73
|
- uses: actions/checkout@v3
|
data/.gitignore
CHANGED
data/.rubocop.yml
CHANGED
@@ -48,9 +48,6 @@ Lint/FloatComparison:
|
|
48
48
|
Lint/NumberConversion:
|
49
49
|
Enabled: false
|
50
50
|
|
51
|
-
Naming/MemoizedInstanceVariableName:
|
52
|
-
Enabled: false
|
53
|
-
|
54
51
|
Naming/MethodParameterName:
|
55
52
|
Enabled: false
|
56
53
|
|
@@ -122,6 +119,3 @@ Style/StructInheritance:
|
|
122
119
|
|
123
120
|
Performance/ChainArrayAllocation:
|
124
121
|
Enabled: false
|
125
|
-
|
126
|
-
Performance/StringReplacement:
|
127
|
-
Enabled: false
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,37 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
+
## 0.19.0
|
4
|
+
- Draw the graph starting from zero point by default (#609)
|
5
|
+
- Improve joints in Gruff::Net using polyline method (#608)
|
6
|
+
- Improve joints in Gruff::Line using polyline method (#607)
|
7
|
+
- Adjust default font size in Gruff::Mini::{Bar, Pie}
|
8
|
+
|
9
|
+
## 0.18.0
|
10
|
+
- Add Gruff::Bubble (#604)
|
11
|
+
- Rename Gruff::BoxPlot to Gruff::Box (#603)
|
12
|
+
- Mark Gruff::Scatter#disable_significant_rounding_x_axis= as deprecated (#602)
|
13
|
+
- Mark Gruff::Scatter#x_label_margin= as deprecated (#601)
|
14
|
+
- Mark Gruff::Scatter#use_vertical_x_labels= as deprecated (#600)
|
15
|
+
|
16
|
+
## 0.17.0
|
17
|
+
- Add Gruff::Base#label_rotation= method to rotate bottom label (#599)
|
18
|
+
- Mark #label_stagger_height= as deprecated (#598)
|
19
|
+
- Fixed truncation of long legends in mini graph (#597)
|
20
|
+
- Fix error when input empty data in Gruff::Bezier (#596)
|
21
|
+
- Fix error when input empty data in Gruff::StackedArea (#595)
|
22
|
+
- Fix error when input empty data in Gruff::BoxPlot (#594)
|
23
|
+
- Fix error when input empty data in Gruff::Spider (#593)
|
24
|
+
- Fix error when input empty data in Gruff::Histogram (#592)
|
25
|
+
- Fix error when input empty data in Gruff::Area (#591)
|
26
|
+
- Stop adjusting the square radius in Gruff::Line (#589)
|
27
|
+
- Add diamond dot stype in Gruff::Line (#588)
|
28
|
+
- Allow title to be set as an array (#587)
|
29
|
+
- Allow labels to be set as an array corresponding to the data values (#586)
|
30
|
+
- Fixed a bug that breaks the colors in the theme when using the add_color method (#583)
|
31
|
+
- Ensure to raise an exception if use sort feature in Candlestick
|
32
|
+
- Fix column_count in BoxPlot/Candlestick (#581)
|
33
|
+
- Fix left/right graph margin (#579)
|
34
|
+
|
3
35
|
## 0.16.0
|
4
36
|
- Add Candlestick (#575)
|
5
37
|
- Add BoxPlot (#574)
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# Gruff Graphs
|
2
2
|
|
3
|
-
[![
|
3
|
+
[![CI](https://github.com/topfunky/gruff/actions/workflows/ci.yml/badge.svg)](https://github.com/topfunky/gruff/actions/workflows/ci.yml)
|
4
4
|
[![Gem Version](https://badge.fury.io/rb/gruff.svg)](https://badge.fury.io/rb/gruff)
|
5
5
|
|
6
6
|
A library for making beautiful graphs.
|
@@ -126,14 +126,18 @@ In progress!
|
|
126
126
|
|
127
127
|
![Histogram chart](https://raw.github.com/topfunky/gruff/master/test/expected/histogram.png)
|
128
128
|
|
129
|
-
### Box
|
129
|
+
### Box chart
|
130
130
|
|
131
|
-
![Box
|
131
|
+
![Box chart](https://raw.github.com/topfunky/gruff/master/test/expected/box.png)
|
132
132
|
|
133
133
|
### Candlestick
|
134
134
|
|
135
135
|
![Candlestick](https://raw.github.com/topfunky/gruff/master/test/expected/candlestick.png)
|
136
136
|
|
137
|
+
### Bubble chart
|
138
|
+
|
139
|
+
![Bubble chart](https://raw.github.com/topfunky/gruff/master/test/expected/bubble.png)
|
140
|
+
|
137
141
|
## Documentation
|
138
142
|
|
139
143
|
http://www.rubydoc.info/github/topfunky/gruff/frames
|
data/gruff.gemspec
CHANGED
@@ -16,16 +16,14 @@ Gem::Specification.new do |s|
|
|
16
16
|
s.require_paths = %w[lib]
|
17
17
|
s.summary = 'Beautiful graphs for one or multiple datasets.'
|
18
18
|
s.license = 'MIT'
|
19
|
-
s.test_files = s.files.grep(%r{^(test|spec|features)/})
|
20
19
|
s.executables = s.files.grep(%r{^bin/}).map { |f| File.basename(f) }
|
21
|
-
s.specification_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
22
20
|
|
23
21
|
if defined? JRUBY_VERSION
|
24
22
|
s.platform = 'java'
|
25
23
|
s.add_dependency 'rmagick4j'
|
26
24
|
else
|
27
25
|
s.add_dependency 'rmagick', '>= 4.2'
|
28
|
-
s.add_development_dependency 'rubocop', '~> 1.
|
26
|
+
s.add_development_dependency 'rubocop', '~> 1.28.2'
|
29
27
|
s.add_development_dependency 'rubocop-performance', '~> 1.13.3'
|
30
28
|
s.add_development_dependency 'rubocop-rake', '~> 0.6.0'
|
31
29
|
end
|
@@ -35,7 +33,7 @@ Gem::Specification.new do |s|
|
|
35
33
|
s.add_development_dependency 'rake'
|
36
34
|
s.add_development_dependency 'minitest-reporters'
|
37
35
|
s.add_development_dependency 'simplecov'
|
38
|
-
s.add_development_dependency 'yard', '~> 0.9.
|
36
|
+
s.add_development_dependency 'yard', '~> 0.9.28'
|
39
37
|
|
40
38
|
s.metadata['rubygems_mfa_required'] = 'true'
|
41
39
|
end
|
data/lib/gruff/area.rb
CHANGED
@@ -30,9 +30,11 @@ private
|
|
30
30
|
end
|
31
31
|
|
32
32
|
def draw_graph
|
33
|
-
x_increment = @graph_width / (column_count - 1)
|
33
|
+
x_increment = (@graph_width / (column_count - 1)).to_f
|
34
34
|
|
35
35
|
store.norm_data.each do |data_row|
|
36
|
+
next if data_row.points.empty?
|
37
|
+
|
36
38
|
poly_points = []
|
37
39
|
|
38
40
|
data_row.points.each_with_index do |data_point, index|
|
data/lib/gruff/bar.rb
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require_relative 'helper/bar_mixin'
|
4
|
+
|
3
5
|
#
|
4
6
|
# Gruff::Bar provide a bar graph that presents categorical data
|
5
7
|
# with rectangular bars.
|
@@ -16,6 +18,8 @@
|
|
16
18
|
# g.write('bar.png')
|
17
19
|
#
|
18
20
|
class Gruff::Bar < Gruff::Base
|
21
|
+
include BarMixin
|
22
|
+
|
19
23
|
# Spacing factor applied between bars.
|
20
24
|
attr_writer :bar_spacing
|
21
25
|
|
@@ -86,8 +90,6 @@ private
|
|
86
90
|
return if @hide_line_markers
|
87
91
|
|
88
92
|
if @show_labels_for_bar_values
|
89
|
-
proc_text_metrics = ->(text) { text_metrics(@marker_font, text) }
|
90
|
-
|
91
93
|
if maximum_value >= 0
|
92
94
|
_, metrics = Gruff::BarValueLabel.metrics(maximum_value, @label_formatting, proc_text_metrics)
|
93
95
|
@graph_top += metrics.height
|
@@ -112,36 +114,32 @@ private
|
|
112
114
|
minimum_value: minimum_value, maximum_value: maximum_value, spread: @spread
|
113
115
|
)
|
114
116
|
|
115
|
-
|
117
|
+
group_left_x = @graph_left
|
116
118
|
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
# Use incremented x and scaled y
|
123
|
-
# x
|
124
|
-
left_x = @graph_left + (bar_width * (row_index + point_index + ((store.length - 1) * point_index))) + padding + group_spacing
|
119
|
+
normalized_group_bars.each_with_index do |group_bars, group_index|
|
120
|
+
right_x = 0
|
121
|
+
group_bars.each_with_index do |bar, index|
|
122
|
+
left_x = group_left_x + (bar_width * index) + padding
|
125
123
|
right_x = left_x + (bar_width * @bar_spacing)
|
126
|
-
# y
|
127
|
-
left_y, right_y = conversion.get_top_bottom_scaled(data_point)
|
128
|
-
|
129
|
-
# create new bar
|
130
|
-
rect_renderer = Gruff::Renderer::Rectangle.new(renderer, color: data_row.color)
|
131
|
-
rect_renderer.render(left_x, left_y - AXIS_MARGIN, right_x, right_y - AXIS_MARGIN)
|
132
124
|
|
133
|
-
|
134
|
-
|
125
|
+
top_y, bottom_y = conversion.get_top_bottom_scaled(bar.point)
|
126
|
+
if bar.point != 0
|
127
|
+
rect_renderer = Gruff::Renderer::Rectangle.new(renderer, color: bar.color)
|
128
|
+
rect_renderer.render(left_x, bottom_y - AXIS_MARGIN, right_x, top_y)
|
129
|
+
end
|
135
130
|
|
136
|
-
|
137
|
-
|
138
|
-
if @show_labels_for_bar_values
|
139
|
-
bar_value_label = Gruff::BarValueLabel::Bar.new([left_x, left_y, right_x, right_y], store.data[row_index].points[point_index])
|
131
|
+
if @show_labels_for_bar_values && bar.value
|
132
|
+
bar_value_label = Gruff::BarValueLabel::Bar.new([left_x, top_y, right_x, bottom_y], bar.value)
|
140
133
|
bar_value_label.prepare_rendering(@label_formatting, proc_text_metrics) do |x, y, text, _text_width, text_height|
|
141
134
|
draw_value_label(bar_width * @bar_spacing, text_height, x, y, text)
|
142
135
|
end
|
143
136
|
end
|
144
137
|
end
|
138
|
+
|
139
|
+
label_center = group_left_x + ((right_x - group_left_x) / 2.0)
|
140
|
+
draw_label(label_center, group_index)
|
141
|
+
|
142
|
+
group_left_x = right_x + padding + @group_spacing
|
145
143
|
end
|
146
144
|
|
147
145
|
# Draw the last label if requested
|
@@ -149,6 +147,10 @@ private
|
|
149
147
|
end
|
150
148
|
|
151
149
|
def calculate_spacing
|
152
|
-
@
|
150
|
+
@group_spacing * (column_count - 1)
|
151
|
+
end
|
152
|
+
|
153
|
+
def proc_text_metrics
|
154
|
+
->(text) { text_metrics(@marker_font, text) }
|
153
155
|
end
|
154
156
|
end
|