ユーザ用ツール

サイト用ツール


algraph:散布図

差分

このページの2つのバージョン間の差分を表示します。

この比較画面へのリンク

両方とも前のリビジョン前のリビジョン
algraph:散布図 [2019/12/18 15:53] hirohitoalgraph:散布図 [2019/12/18 15:59] (現在) hirohito
行 58: 行 58:
  
   graph.add_data( [x1,x2,..], [y1, y2,...] )   graph.add_data( [x1,x2,..], [y1, y2,...] )
 +
 +
 +====== サンプル ======
 +
 +リリースファイルでサンプルとして提供しているものです。
 +
 +
 +===== バブルチャートにアレンジ =====
 +
 +{{:algraph:scatter_sample_02.png?320 |}}
 +
 +
 +<code ruby>
 +  def action_scatter_sample_02
 +    group_A_x =    [ 23,  24,  62   ,9]
 +    group_A_y =    [ -4,   5,  12, -10]
 +    group_A_size = [ 50,  40,  90,  20]
 +
 +    group_B_x =    [ 39,  20,   5,  85]
 +    group_B_y =    [  0,  10, -14,  -6]
 +    group_B_size = [ 40,  50,  10,  40]
 +    group_label = ["農林", "製造", "建築土木", "その他"]
 +
 +    graph = AlGraphScatter.new(800,600)
 +    graph.color_list = ["#88f", "#f88"]
 +    graph.shape_list = [:circle, :circle]
 +
 +    graph.add_xaxis_title("X軸タイトル")
 +    graph.add_yaxis_title("Y軸タイトル")
 +    graph.x_axis.at_labels[:format] = "%.0f%%"
 +    graph.x_axis.min = 0
 +    graph.x_axis.max = 90
 +    graph.y_axis.at_labels[:format] = "%.0f%%"
 +    graph.y_axis.min = -15
 +    graph.y_axis.max = 25
 +
 +    data = graph.add_data( group_A_x, group_A_y, "男性" )
 +    data.add_data_labels(:CENTER)
 +    data.labels = group_label
 +    data.at_data_labels[:font_size] = 20
 +    group_A_size.each_with_index {|sz,i|
 +      data.at_marker_several[i] = {:size=>sz, :stroke_width=>3,:stroke=>"#fff"}
 +    }
 +
 +    data = graph.add_data( group_B_x, group_B_y, "女性" )
 +    data.add_data_labels(:CENTER)
 +    data.labels = group_label
 +    data.at_data_labels[:font_size] = 20
 +    group_B_size.each_with_index {|sz,i|
 +      data.at_marker_several[i] = {:size=>sz, :stroke_width=>3,:stroke=>"#fff"}
 +    }
 +
 +    graph.draw
 +  end
 +</code>
  
algraph/散布図.txt · 最終更新: 2019/12/18 15:59 by hirohito