rchart 1.0.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/examples/example1.rb +2 -2
- data/lib/rchart.rb +11 -5
- metadata +2 -3
- data/lib/version.rb +0 -19
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.
|
1
|
+
1.1.0
|
data/examples/example1.rb
CHANGED
@@ -9,7 +9,7 @@ p.add_all_series()
|
|
9
9
|
p.set_abscise_label_serie
|
10
10
|
p.set_serie_name("January","Serie1")
|
11
11
|
p.set_serie_name("February","Serie2")
|
12
|
-
|
12
|
+
puts "HELO"
|
13
13
|
#Initialise the graph
|
14
14
|
ch = Rchart.new(700,230)
|
15
15
|
ch.set_fixed_scale(-2,8)
|
@@ -22,7 +22,7 @@ ch.draw_scale(p.get_data,p.get_data_description,Rchart::SCALE_NORMAL,150,150,150
|
|
22
22
|
ch.draw_grid(4,true,230,230,230,50)
|
23
23
|
|
24
24
|
#Draw the 0 line
|
25
|
-
ch.set_font_properties("tahoma.ttf",6)
|
25
|
+
#ch.set_font_properties("tahoma.ttf",6)
|
26
26
|
ch.draw_treshold(0,143,55,72,true,true)
|
27
27
|
|
28
28
|
#Draw the cubic curve graph
|
data/lib/rchart.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
require "GD"
|
2
2
|
require 'rdata'
|
3
|
-
require '
|
3
|
+
require 'ruby-debug'
|
4
4
|
class Rchart
|
5
5
|
SCALE_NORMAL = 1
|
6
6
|
SCALE_ADDALL = 2
|
@@ -21,7 +21,7 @@ class Rchart
|
|
21
21
|
ALIGN_BOTTOM_LEFT = 7
|
22
22
|
ALIGN_BOTTOM_CENTER = 8
|
23
23
|
ALIGN_BOTTOM_RIGHT = 9
|
24
|
-
FONT_PATH =
|
24
|
+
FONT_PATH = File.expand_path(File.join(File.dirname(__FILE__),"..","fonts"))
|
25
25
|
attr_accessor :antialias_quality
|
26
26
|
# This function create a new chart object.
|
27
27
|
# This object will be used during all the steps of the graph creation.
|
@@ -903,7 +903,7 @@ class Rchart
|
|
903
903
|
max_height = 8
|
904
904
|
data_description["description"].each do |key,value|
|
905
905
|
position = image_ftb_box(@font_size,0,@font_name,value)
|
906
|
-
text_width = position[2]-position[
|
906
|
+
text_width = position[2]-position[6].abs
|
907
907
|
text_height = position[1]-position[7]
|
908
908
|
max_width = text_width if ( text_width > max_width)
|
909
909
|
max_height = max_height + text_height + 4
|
@@ -914,13 +914,16 @@ class Rchart
|
|
914
914
|
rs = r-30
|
915
915
|
gs = g-30
|
916
916
|
bs = b-30
|
917
|
-
|
917
|
+
end
|
918
|
+
|
918
919
|
if ( border )
|
920
|
+
|
919
921
|
self.draw_filled_rounded_rectangle(x_pos+1,y_pos+1,x_pos+max_width+1,y_pos+max_height+1,5,rs,gs,bs)
|
920
922
|
self.draw_filled_rounded_rectangle(x_pos,y_pos,x_pos+max_width,y_pos+max_height,5,r,g,b)
|
921
923
|
end
|
922
924
|
y_offset = 4 + @font_size
|
923
925
|
id = 0
|
926
|
+
|
924
927
|
data_description["description"].each do |key,value|
|
925
928
|
self.draw_filled_rounded_rectangle(x_pos+10,y_pos+y_offset-4 , x_pos+14, y_pos+y_offset-4, 2, @palette[id]["r"], @palette[id]["g"], @palette[id]["b"])
|
926
929
|
image_ttf_text(@picture, @font_size,0, x_pos+22, y_pos+y_offset, c_text_color, @font_name, value)
|
@@ -2692,9 +2695,12 @@ class Rchart
|
|
2692
2695
|
self.draw_antialias_pixel(xi2,yi2,r,g,b)
|
2693
2696
|
self.draw_antialias_pixel(xi3,yi3,r,g,b)
|
2694
2697
|
self.draw_antialias_pixel(xi4,yi4,r,g,b)
|
2698
|
+
|
2695
2699
|
i=i+step
|
2696
|
-
|
2700
|
+
end
|
2701
|
+
|
2697
2702
|
image_filled_rectangle(@picture,x1,y1+radius,x2,y2-radius,r,g,b)
|
2703
|
+
|
2698
2704
|
image_filled_rectangle(@picture,x1+radius,y1,x2-radius,y2,r,g,b)
|
2699
2705
|
|
2700
2706
|
x1=x1-0.2
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rchart
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- amardaxini
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2010-
|
12
|
+
date: 2010-09-02 00:00:00 +05:30
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -70,7 +70,6 @@ files:
|
|
70
70
|
- fonts/tahoma.ttf
|
71
71
|
- lib/rchart.rb
|
72
72
|
- lib/rdata.rb
|
73
|
-
- lib/version.rb
|
74
73
|
- test/helper.rb
|
75
74
|
- test/test_rchart.rb
|
76
75
|
has_rdoc: true
|
data/lib/version.rb
DELETED
@@ -1,19 +0,0 @@
|
|
1
|
-
require 'rubygems'
|
2
|
-
require 'ruby-debug'
|
3
|
-
class Version
|
4
|
-
MAJOR = 1
|
5
|
-
MINOR = 0
|
6
|
-
RELEASE = 0
|
7
|
-
def self.current
|
8
|
-
"#{MAJOR}.#{MINOR}.#{RELEASE}"
|
9
|
-
end
|
10
|
-
def self.font_path
|
11
|
-
Gem.path.each do |gem_path|
|
12
|
-
path= gem_path+"/gems/rchart-#{MAJOR}.#{MINOR}.#{RELEASE}/fonts"
|
13
|
-
if File.exists?(path+"/tahoma.ttf")
|
14
|
-
return path
|
15
|
-
break
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|