technical_graph 0.3.1 → 0.3.2

Sign up to get free protection for your applications and to get access to all the features.
data/DOCUMENTATION.md ADDED
@@ -0,0 +1,93 @@
1
+
2
+
3
+ Options Hash
4
+
5
+ Default ranges:
6
+
7
+ options[:x_min]
8
+ options[:x_max]
9
+ options[:y_min]
10
+ options[:y_max]
11
+
12
+ Ranges calculation mode:
13
+
14
+ options[:xy_behaviour] = :default - ranges can be enlarged
15
+ options[:xy_behaviour] = :fixed - fixed ranges
16
+
17
+ Axis can be calculated using fixed interval or fixed count per graph.
18
+
19
+ options[:x_axis_fixed_interval] = true
20
+ options[:y_axis_fixed_interval] = true
21
+
22
+ If fixed interval is set you should specify interval:
23
+
24
+ options[:y_axis_interval] = 1.0
25
+ options[:x_axis_interval] = 1.0
26
+
27
+ ...else, count of axis:
28
+
29
+ options[:y_axis_count] = 10
30
+ options[:x_axis_count] = 10
31
+
32
+ Axis labels:
33
+
34
+ options[:x_axis_label] = 'x'
35
+ options[:y_axis_label] = 'y'
36
+
37
+ Labels has truncate string to define precision. Default it is "%.2f".
38
+
39
+ options[:truncate_string] = "%.2f"
40
+
41
+ Graph image size:
42
+
43
+ options[:width]
44
+ options[:height]
45
+
46
+ Colors:
47
+
48
+ Possible #RRGGBB or color names (ex. 'white').
49
+
50
+ options[:background_color] - background color of image
51
+ options[:background_hatch_color] - background hatch color
52
+ options[:axis_color] - color of axis
53
+
54
+ Anti-aliasing:
55
+
56
+ options[:axis_antialias] - use anti-aliasing for axis, default false
57
+ options[:layers_antialias] - use anti-aliasing for data layers, default false, can be override using layer option
58
+ options[:font_antialias] - use anti-aliasing for all fonts, default false
59
+
60
+ Font size:
61
+
62
+ options[:layers_font_size] - size of font used for values in graph
63
+ options[:axis_font_size] - size of font used in axis
64
+ options[:axis_label_font_size] - size of font used in options[:x_axis_label] and options[:y_axis_label]
65
+
66
+ Sometime because of axis options and large amount of data, axis can be put densely on graph. Turning this option graph size will be enlarged to maintain set distanced between axis.
67
+
68
+ options[:axis_density_enlarge_image] - turn this options on
69
+ options[:x_axis_min_distance] - minimum distance between X axis, default 30 pixels
70
+ options[:y_axis_min_distance] - minimum distance between X axis, default 50 pixels
71
+
72
+ Legend options:
73
+
74
+ options[:legend] - do you want to draw legend?, default false
75
+ options[:legend_auto] - let legend position to be chosen by algorithm, default true
76
+ options[:legend_width] - width used for setting proper distance while drawing on right, default 100, legend height is calculated
77
+ options[:legend_margin] - graph margin used not to draw legend on border, default 50
78
+ options[:legend_x] - legend X position, used when options[:legend_auto] is false, default 50
79
+ options[:legend_y] - legend Y position, used when options[:legend_auto] is false, default 50
80
+
81
+ Layer options Hash
82
+
83
+ layer_options[:label] - label used in legend
84
+ layer_options[:color] - color of graph layer, ex.: 'red', 'green', '#FFFF00'
85
+ layer_options[:antialias] - use anti-aliasing for this, default false, override options[:layers_antialias]
86
+ layer_options[:value_labels] - write values near 'dots', default true
87
+ layer_options[:simple_smoother] - 'smooth' data, default false
88
+ layer_options[:simple_smoother_level] - strength of smoothing, this is level of window used for processing, default 3
89
+ layer_options[:simple_smoother_strategy] - strategy used for smoothing data, you can choose between :rectangular or :gauss, default :rectangular
90
+ layer_options[:simple_smoother_x] - consider X axis distance when smoothing, slowest but more accurate, default false
91
+ layer_options[:noise_removal] - enable removal of noises/peaks, default false
92
+ layer_options[:noise_removal_level] - tolerance level, higher - less points will be removes, default 3
93
+ layer_options[:noise_removal_window_size] - how many near values check for determining what is noise, default 10
@@ -371,4 +371,4 @@ h2. TODO
371
371
  # Legend with set position
372
372
  # Legend with auto position
373
373
  # Smoother:
374
- # Noise removal
374
+ # Noise removal
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.1
1
+ 0.3.2
@@ -4,11 +4,11 @@
4
4
  # http://stackoverflow.com/questions/1341271/average-from-a-ruby-array
5
5
 
6
6
  class Array
7
- def sum
7
+ def float_sum
8
8
  inject(0.0) { |result, el| result + el }
9
9
  end
10
10
 
11
- def mean
12
- sum / size
11
+ def float_mean
12
+ float_sum / size
13
13
  end
14
14
  end
@@ -73,7 +73,7 @@ module DataLayerProcessorNoiseRemoval
73
73
  part_array << data[current_i]
74
74
 
75
75
  end
76
- y_mean = part_array.collect { |p| p.y }.mean
76
+ y_mean = part_array.collect { |p| p.y }.float_mean
77
77
 
78
78
  # another algorithm
79
79
  noise_strength = (data[i].y - y_mean).abs / y_mean
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: technical_graph
3
3
  version: !ruby/object:Gem::Version
4
- hash: 17
4
+ hash: 23
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 3
9
- - 1
10
- version: 0.3.1
9
+ - 2
10
+ version: 0.3.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Aleksander Kwiatkowski
@@ -114,6 +114,7 @@ extra_rdoc_files:
114
114
  - LICENSE.txt
115
115
  - README.md
116
116
  files:
117
+ - DOCUMENTATION.md
117
118
  - DOCUMENTATION.textile
118
119
  - Gemfile
119
120
  - Gemfile.lock