rchart 1.1.3 → 1.1.4

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.1.3
1
+ 1.1.4
data/lib/rchart.rb CHANGED
@@ -586,7 +586,7 @@ class Rchart
586
586
  while(!scale_ok)
587
587
  scale1 = ( @vmax - @vmin )*1.0 / factor
588
588
  scale2 = ( @vmax - @vmin )*1.0 /factor / 2
589
- scale4 = ( @vmax - @vmin )*1.0 / factor / 4
589
+ # scale4 = ( @vmax - @vmin )*1.0 / factor / 4
590
590
 
591
591
  if ( scale1 > 1 && scale1 <= max_divs && !scale_ok)
592
592
  scale_ok = true
@@ -681,7 +681,7 @@ class Rchart
681
681
  end
682
682
 
683
683
  data_range = @vmax - @vmin
684
- data_range = 0.1 if (data_range == 0 )
684
+ data_range = 0.1 if (data_range.to_f == 0.0)
685
685
 
686
686
  # Compute automatic scaling
687
687
  scale_ok = false
@@ -720,7 +720,7 @@ class Rchart
720
720
 
721
721
  if ( (@v_x_max*1.0 / scale / factor).floor != @v_x_max / scale / factor)
722
722
  grid_id = ( @v_x_max*1.0 / scale / factor).floor + 1
723
- @v_x_max = grid_id * scale * factor;
723
+ @v_x_max = grid_id * scale * factor
724
724
  x_divisions+=1
725
725
  end
726
726
 
@@ -788,10 +788,10 @@ class Rchart
788
788
  i=i+1
789
789
  xpos = xpos + @division_width
790
790
  end
791
- #Write the Y Axis caption if set
791
+ # Write the Y Axis caption if set
792
792
  if ((!data_description["axis"].nil? && !data_description["axis"]["y"].nil?) )
793
793
  position = image_ftb_box(@font_size,90,@font_name,data_description["axis"]["y"])
794
- text_height = (position[1]).abs+(position[3]).abs
794
+ # text_height = (position[1]).abs+(position[3]).abs
795
795
  text_top = ((@g_area_y2 - @g_area_y1) / 2) + @g_area_y1 + (text_width/2)
796
796
  image_ttf_text(@picture,@font_size,90,xmin-@font_size,text_top,c_text_color,@font_name,data_description["axis"]["y"].to_s)
797
797
  end
@@ -1802,7 +1802,7 @@ class Rchart
1802
1802
  a_points << layer_height;
1803
1803
 
1804
1804
  if ( around_zero == false )
1805
- c_graph = allocate_color(@layers[0],@palette[color_id]["r"],@palette[color_id]["g"],@palette[color_id]["b"])
1805
+ # c_graph = allocate_color(@layers[0],@palette[color_id]["r"],@palette[color_id]["g"],@palette[color_id]["b"])
1806
1806
  image_filled_polygon(@layers[0],a_points,@palette[color_id]["r"],@palette[color_id]["g"],@palette[color_id]["b"],points_count);
1807
1807
  end
1808
1808
 
@@ -2124,8 +2124,8 @@ class Rchart
2124
2124
  poly_plots.each_with_index do |value,key|
2125
2125
  image_filled_polygon(@picture, poly_plots[key], @palette[key]["r"],@palette[key]["g"],@palette[key]["b"])
2126
2126
  end
2127
- self. draw_circle(x_pos-0.5,y_pos-0.5,radius,r,g,b)
2128
- self. draw_circle(x_pos-0.5,y_pos-0.5,radius+0.5,r,g,b)
2127
+ self.draw_circle(x_pos-0.5,y_pos-0.5,radius,r,g,b)
2128
+ self.draw_circle(x_pos-0.5,y_pos-0.5,radius+0.5,r,g,b)
2129
2129
  # Draw Top polygons
2130
2130
  top_plots.each_with_index do |value,key|
2131
2131
  j = 0
@@ -2209,6 +2209,7 @@ class Rchart
2209
2209
  atop_plots = []
2210
2210
  abot_plots = []
2211
2211
  i_values.each_with_index do |value,key|
2212
+
2212
2213
  x_cent_pos = Math.cos((angle-c_dev+(value*splice_ratio+splice_distance_ratio)/2) * 3.1418 / 180 ) * splice_distance + x_pos
2213
2214
  y_cent_pos = Math.sin((angle-c_dev+(value*splice_ratio+splice_distance_ratio)/2) * 3.1418 / 180 ) * splice_distance + y_pos
2214
2215
  x_cent_pos2 = Math.cos((angle+c_dev+(value*splice_ratio+splice_distance_ratio)/2) * 3.1418 / 180 ) * splice_distance + x_pos
@@ -2285,7 +2286,7 @@ class Rchart
2285
2286
 
2286
2287
  # Draw Bottom polygons
2287
2288
  i_values.each_with_index do |val,key|
2288
- c_graph_lo = allocate_color(@picture,@palette[key]["r"]-20,@palette[key]["g"]-20,@palette[key]["b"]-20)
2289
+ #c_graph_lo = allocate_color(@picture,@palette[key]["r"]-20,@palette[key]["g"]-20,@palette[key]["b"]-20)
2289
2290
  image_filled_polygon(@picture,bot_plots[key],@palette[key]["r"]-20,@palette[key]["g"]-20,@palette[key]["b"]-20)
2290
2291
  if (enhance_colors)
2291
2292
  en = -10
@@ -2308,7 +2309,7 @@ class Rchart
2308
2309
  i = splice_height-1
2309
2310
  while(i>=1)
2310
2311
  i_values.each_with_index do |val,key|
2311
- c_graph_lo = allocate_color(@picture,@palette[key]["r"]-10,@palette[key]["g"]-10,@palette[key]["b"]-10)
2312
+ # c_graph_lo = allocate_color(@picture,@palette[key]["r"]-10,@palette[key]["g"]-10,@palette[key]["b"]-10)
2312
2313
  plots =[]
2313
2314
  plot = 0
2314
2315
  top_plots[key].each_with_index do |value2,key2|
@@ -2336,7 +2337,7 @@ class Rchart
2336
2337
  #Draw Top polygons
2337
2338
  key = i_values.length-1
2338
2339
  while(key>=0)
2339
- c_graph_lo = allocate_color(@picture,@palette[key]["r"],@palette[key]["g"],@palette[key]["b"])
2340
+ # c_graph_lo = allocate_color(@picture,@palette[key]["r"],@palette[key]["g"],@palette[key]["b"])
2340
2341
  image_filled_polygon(@picture,top_plots[key],@palette[key]["r"],@palette[key]["g"],@palette[key]["b"])
2341
2342
 
2342
2343
  if ( enhance_colors )
@@ -2411,11 +2412,12 @@ class Rchart
2411
2412
  splice_ratio = 360.0 / pie_sum
2412
2413
  splice_percent = 100.0 / pie_sum
2413
2414
  # Calculate all polygons
2414
- angle = 0;
2415
+ angle = 0
2415
2416
  top_plots = []
2416
2417
  i_values.each_with_index do |value,key|
2417
- x_offset = Math.cos((angle+(value/2*splice_ratio)) * Math::PI / 180 ) * splice_distance
2418
- y_offset = Math.sin((angle+(value/2*splice_ratio)) * Math::PI / 180 ) * splice_distance
2418
+
2419
+ x_offset = Math.cos((angle+(value*1.0/2*splice_ratio)) * Math::PI / 180 ) * splice_distance
2420
+ y_offset = Math.sin((angle+(value*1.0/2*splice_ratio)) * Math::PI / 180 ) * splice_distance
2419
2421
 
2420
2422
  top_plots[key] = [(x_pos + x_offset).round]
2421
2423
  top_plots[key] << (y_pos + y_offset).round
@@ -2491,7 +2493,7 @@ class Rchart
2491
2493
  # Draw Top polygons
2492
2494
  poly_plots.each_with_index do |value,key|
2493
2495
  if ( !all_black )
2494
- image_filled_polygon(@picture,poly_plots[key],@palette[key]["r"],@palette[key]["g"],@palette[key]["b"]);
2496
+ image_filled_polygon(@picture,poly_plots[key],@palette[key]["r"],@palette[key]["g"],@palette[key]["b"])
2495
2497
  else
2496
2498
  image_filled_polygon(@picture,poly_plots[key],@shadow_r_color,@shadow_g_color,@shadow_b_color)
2497
2499
  end
@@ -2631,7 +2633,7 @@ class Rchart
2631
2633
  def draw_rounded_rectangle(x1, y1, x2, y2, radius,r, g, b)
2632
2634
  b, g, r = validate_color(b, g, r)
2633
2635
 
2634
- c_rectangle = allocate_color(@picture,r,g,b)
2636
+ #c_rectangle = allocate_color(@picture,r,g,b)
2635
2637
 
2636
2638
  step = 90 / ((3.1418 * radius)/2)
2637
2639
  i=0
@@ -2718,8 +2720,6 @@ class Rchart
2718
2720
  def draw_circle(xc,yc,height,r,g,b,width=0)
2719
2721
  width = height if ( width == 0 )
2720
2722
  b, g, r = validate_color(b, g, r)
2721
-
2722
- c_circle = allocate_color(@picture,r,g,b);
2723
2723
  step = 360 / (2 * 3.1418 * [width,height].max)
2724
2724
  i =0
2725
2725
  while(i<=360)
@@ -2910,13 +2910,13 @@ class Rchart
2910
2910
  def add_border(size=3,r=0,g=0,b=0)
2911
2911
  width = @x_size+2*size
2912
2912
  height = @y_size+2*size
2913
- resampled = image_create_true_color(width,height);
2913
+ resampled = image_create_true_color(width,height)
2914
2914
  image_filled_rectangle(resampled,0,0,width,height, r, g, b)
2915
2915
  image_copy(@picture,resampled,size,size,0,0,@x_size,@y_size)
2916
2916
  image_destroy(@picture)
2917
- @x_size = width;
2918
- @y_size = height;
2919
- @picture = image_create_true_color(@x_size,@y_size);
2917
+ @x_size = width
2918
+ @y_size = height
2919
+ @picture = image_create_true_color(@x_size,@y_size)
2920
2920
  image_filled_rectangle(@picture,0,0,@x_size,@y_size,255,255,255)
2921
2921
  image_color_transparent(@picture,255,255,255)
2922
2922
  image_copy(resampled,@picture,0,0,0,0,@x_size,@y_size)
@@ -2969,7 +2969,7 @@ class Rchart
2969
2969
  def validate_data_description(function_name,data_description,description_required=true)
2970
2970
  if (data_description["position"].nil?)
2971
2971
  @errors << "[Warning] #{function_name} - Y Labels are not set."
2972
- data_description["position"] = "name";
2972
+ data_description["position"] = "name"
2973
2973
  end
2974
2974
 
2975
2975
  if (description_required)
@@ -3123,7 +3123,7 @@ class Rchart
3123
3123
  ypos = @y_size - (18 + ((@errors.count)-1) * (@error_font_size + 4))
3124
3124
  @errors.each do |value|
3125
3125
  image_ttf_text(@picture,@error_font_size,0,@x_size-(max_width+15),ypos,c_text_color,@error_font_name,value)
3126
- ypos = ypos + (@error_font_size + 4);
3126
+ ypos = ypos + (@error_font_size + 4)
3127
3127
  end
3128
3128
  end
3129
3129
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rchart
3
3
  version: !ruby/object:Gem::Version
4
- hash: 21
4
+ hash: 27
5
5
  prerelease: false
6
6
  segments:
7
7
  - 1
8
8
  - 1
9
- - 3
10
- version: 1.1.3
9
+ - 4
10
+ version: 1.1.4
11
11
  platform: ruby
12
12
  authors:
13
13
  - amardaxini
@@ -63,16 +63,13 @@ files:
63
63
  - examples/example17.rb
64
64
  - examples/example18.rb
65
65
  - examples/example19.rb
66
- - examples/example2
67
66
  - examples/example2.rb
68
67
  - examples/example20.rb
69
68
  - examples/example21.rb
70
- - examples/example3
71
69
  - examples/example3.rb
72
70
  - examples/example4.rb
73
71
  - examples/example5.rb
74
72
  - examples/example6.rb
75
- - examples/example7
76
73
  - examples/example7.rb
77
74
  - examples/example8.rb
78
75
  - examples/example9.rb
data/examples/example2 DELETED
Binary file
data/examples/example3 DELETED
Binary file
data/examples/example7 DELETED
Binary file