内容へ移動
alone-doc
ユーザ用ツール
ログイン
サイト用ツール
検索
ツール
文書の表示
バックリンク
メディアマネージャー
サイトマップ
ログイン
>
メディアマネージャー
サイトマップ
現在位置:
start
»
algraph
»
円グラフ
トレース:
algraph:円グラフ
この文書は読取専用です。文書のソースを閲覧することは可能ですが、変更はできません。もし変更したい場合は管理者に連絡してください。
====== 円グラフ ====== ===== 基本的な使い方 ===== テンプレートファイル <code html index.html> <!DOCTYPE html> <img src="<%= Alone.make_uri(action:'graph_sample') %>"> </code> コード <code ruby main.rb> 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 </code> {{ :algraph:pie_sample_01.png?nolink&200|}} 折れ線グラフ、棒グラフと違い、requireが'al_graph'から'al_graph_pie'に、クラスが AlGraphからAlGraphPie等に変わる点にご注意ください。 ====== サンプル ====== リリースファイルでサンプルとして提供しているものです。 ===== デフォルト(再掲) ===== {{:algraph:pie_sample_01.png?nolink |}} <code ruby> 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 </code> ===== セパレートして強調 ===== {{:algraph:pie_sample_02.png?nolink |}} <code ruby> 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 </code>
algraph/円グラフ.txt
· 最終更新:
2019/04/07 19:37
by
hirohito
ページ用ツール
文書の表示
バックリンク
文書の先頭へ