Class: Rchart

Inherits:
Object
  • Object
show all
Includes:
GD2, Graph
Defined in:
lib/rchart.rb

Constant Summary collapse

SCALE_NORMAL =
1
SCALE_ADDALL =
2
SCALE_START0 =
3
SCALE_ADDALLSTART0 =
4
PIE_PERCENTAGE =
1
PIE_LABELS =
2
PIE_NOLABEL =
3
PIE_PERCENTAGE_LABEL =
4
TARGET_GRAPHAREA =
1
TARGET_BACKGROUND =
2
ALIGN_TOP_LEFT =
1
ALIGN_TOP_CENTER =
2
ALIGN_TOP_RIGHT =
3
ALIGN_LEFT =
4
ALIGN_CENTER =
5
ALIGN_RIGHT =
6
ALIGN_BOTTOM_LEFT =
7
ALIGN_BOTTOM_CENTER =
8
ALIGN_BOTTOM_RIGHT =
9
FONT_PATH =
File.expand_path(File.join(File.dirname(__FILE__),"..","fonts"))

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from ColorPalette

#create_color_gradient_palette, #load_color_palette, #load_color_palette_from_file, #set_color_palette

Methods included from Scale

#clear_scale, #draw_right_scale, #draw_scale, #draw_xy_scale, #set_fixed_scale

Methods included from Legend

#draw_legend, #draw_pie_legend, #draw_text_box, #draw_title, #get_legend_box_size, #set_label

Methods included from Layout

#add_border, #draw_area, #draw_graph_area, #draw_grid, #draw_treshold, #report_warnings, #set_graph_area, #write_values

Methods included from GraphHelper

#add_to_image_map, #draw_alpha_pixel, #draw_antialias_pixel, #draw_background, #draw_circle, #draw_dotted_line, #draw_ellipse, #draw_filled_circle, #draw_filled_ellipse, #draw_filled_rectangle, #draw_filled_rounded_rectangle, #draw_graph_area_gradient, #draw_line, #draw_rectangle, #draw_rounded_rectangle, #set_image_map

Methods included from RchartHelper

#allocate_color, #clear_shadow, #deg2rad, #draw_from_jpg, #draw_from_picture, #draw_from_png, #is_real_int, #print_errors, #raise_fatal, #resize_image, #round_of, #set_currency, #set_date_format, #set_font_properties, #set_line_style, #set_shadow_properties, #to_currency, #to_date, #to_metric, #to_time, #validate_color, #validate_data, #validate_data_description

Methods included from PieChart

#draw_basic_pie_graph, #draw_flat_pie_graph, #draw_flat_pie_graph_with_shadow, #draw_pie_graph

Methods included from PlotChart

#draw_limits_graph, #draw_plot_graph, #draw_xy_plot_graph

Methods included from LineChart

#draw_filled_line_graph, #draw_line_graph, #draw_xy_graph

Methods included from BarChart

#draw_bar_graph, #draw_overlay_bar_graph, #draw_stacked_bar_graph

Methods included from CubicChart

#draw_cubic_curve, #draw_filled_cubic_curve

Methods included from GD2

#add_point, #export_image, #gd2, #get_image_size, #image_color_allocate, #image_color_at, #image_color_transparent, #image_copy, #image_copy_merge, #image_create_from_gif, #image_create_from_jpeg, #image_create_from_png, #image_create_true_color, #image_destroy, #image_filled_polygon, #image_filled_rectangle, #image_ftb_box, #image_line, #image_set_pixel, #image_ttf_text, #render_gd_str, #render_gif_str, #render_jepeg_str, #render_jpeg, #render_png, #render_png_str, #render_wbmp_str, #rgb_color

Constructor Details

#initialize(x_size, y_size, options = {}) ⇒ Rchart

This function create a new chart object. This object will be used during all the steps of the graph creation. This object will embed all the pChart functions



32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
# File 'lib/rchart.rb', line 32

def initialize(x_size,y_size,options={})
	# Initialize variables
	# q    raise ArgumentError if (options[:x_size].nil? && options[:y_size].nil?)
	# Error management
	@error_reporting = false
	@error_interface = "cli"
	@errors         = []
	@error_font_name  = "#{FONT_PATH}/pf_arma_five.ttf"
	@error_font_size  = 6
	@x_size = x_size
	@antialias_quality=0
	@y_size = y_size
	@error_reporting = false
	@error_font_name =  "#{FONT_PATH}/pf_arma_five.ttf"
	@error_font_size = 6
	@currency = "Rs."
	@date_format = "%d/%m/%Y"
	@line_width = 1
	@line_dot_size = 0
	@anti_alias_quality = 0
	@shadow_active = false
	@shadow_x_distance = 1
	@shadow_y_distance = 1
	@shadow_r_color = 60
	@shadow_g_color = 60
	@shadow_b_color = 60
	@shadow_alpha = 50
	@shadow_blur = 0
	@tmp_dir = '/tmp'
	@font_size =8
	@font_name = "#{FONT_PATH}/tahoma.ttf"
	@divisions= 0

	@division_count = 0
	@division_height = 0
	@x_division_ratio =0
	@x_division_count = 0
	@x_division_height = 0
	@x_division_ratio = 0
	@palette = []
	@layers = []
	@g_area_x_offset =0
	@division_width = 0
	@vmin = nil
	@vmax = nil
	@v_x_min =nil
	@v_x_max=nil

	@x_divisions=0
	@data_count=nil
	@g_area_x1 = 0
	@g_area_y1 = 0
	@g_area_x2 = 0
	@g_area_y2 = 0
	@image_map = []
	# /* Image Map settings */
	@build_map=false
	@map_function      = nil
	@tmp_folder        = "tmp/"
	@map_id            = nil

	@palette =[{"r"=>188,"g"=>224,"b"=>46},
	           {"r"=>224,"g"=>100,"b"=>46},
	           {"r"=>224,"g"=>214,"b"=>46},
	           {"r"=>46,"g"=>151,"b"=>224},
	           {"r"=>176,"g"=>46,"b"=>224},
	           {"r"=>224,"g"=>46,"b"=>117},
	           {"r"=>92,"g"=>224,"b"=>46},
	           {"r"=>224,"g"=>176,"b"=>46}]
   
	@picture =  image_create_true_color(@x_size, @y_size)
	@c_white =  allocate_color(@picture,255,255,255)
	image_filled_rectangle(@picture, 0, 0, @x_size, @y_size, 255,255,255)
	#image_color_transparent(@picture, 255,255,255)
	set_font_properties("tahoma.ttf",8)
end

Instance Attribute Details

#antialias_qualityObject

Returns the value of attribute antialias_quality.



28
29
30
# File 'lib/rchart.rb', line 28

def antialias_quality
  @antialias_quality
end

#pictureObject

Returns the value of attribute picture.



28
29
30
# File 'lib/rchart.rb', line 28

def picture
  @picture
end