====== 円グラフ ====== ===== 基本的な使い方 ===== テンプレートファイル コード require 'alone' require 'al_graph_pie' class GraphSampleController < AlController def action_index() AlTemplate.run( 'index.rhtml' ) end def action_graph_sample() ydata1 = [5, 3, 6, 3, 2, 5, 6] labels = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'] graph = AlGraphPie.new graph.add_data(ydata1, labels) graph.draw end end {{ :algraph:pie_sample_01.png?nolink&200|}} 折れ線グラフ、棒グラフと違い、requireが'al_graph'から'al_graph_pie'に、クラスが AlGraphからAlGraphPie等に変わる点にご注意ください。 ====== サンプル ====== リリースファイルでサンプルとして提供しているものです。 ===== デフォルト(再掲) ===== {{:algraph:pie_sample_01.png?nolink |}} def action_pie_sample_01 ydata1 = [5, 3, 6, 3, 2, 5, 6] labels = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'] graph = AlGraphPie.new graph.add_data(ydata1, labels) graph.draw end ===== セパレートして強調 ===== {{:algraph:pie_sample_02.png?nolink |}} def action_pie_sample_02 ydata1 = [5, 3, 6, 3, 2, 5, 6] labels = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'] graph = AlGraphPie.new ds = graph.add_data(ydata1, labels) ds[2].separate graph.draw end