require 'al_template' require 'al_graph_scatter' class GraphSampleController < AlController def action_index() AlTemplate.run( 'index.rhtml' ) end # 散布図1 def action_scatter_sample_01 # 竹村彰通(著) 統計 共立出版より引用 data_m = [[172,70],[176,69],[170,70],[174,70],[170,62], [167,50],[175,75],[179,80],[162,60],[169,80]] data_f = [[157,42],[166,68],[160,55],[176,65],[164,51], [168,56],[159,45],[154,44],[168,45],[150,52]] graph = AlGraphScatter.new graph.add_data_pair( data_m, "Male" ) graph.add_data_pair( data_f, "Female" ) graph.add_main_title("散布図(身長、体重)") graph.add_xaxis_title("身長(cm)") graph.add_yaxis_title("体重(kg)") graph.x_axis.at_labels[:format] = "%d" graph.y_axis.at_labels[:format] = "%d" graph.draw end end