Google Chart Api用の HtmlHelper 拡張機能はありますか? (円グラフ、棒グラフなど、いくつかの基本的なグラフに使用するのが好きです)
萌え萌え
Google Chart Api用の HtmlHelper 拡張機能はありますか? (円グラフ、棒グラフなど、いくつかの基本的なグラフに使用するのが好きです)
萌え萌え
Google は、次のようにグラフを挿入すると言っています。
<img src="http://chart.apis.google.com/chart?
chs=250x100
&chd=t:60,40
&cht=p3
&chl=Hello|World"
alt="Sample chart"
/>
したがって、次のように HtmlHelper を記述するのは簡単なはずです (未テスト):
namespace System.Web.Mvc.Html
{
public static class GoogleChartHelpers
{
public static string GoogleChart
(string cht, string chd, string chs, string chl)
{
return "<img source='http://chart.apis.google.com/chart?cht=" + cht
+ "&chd=" + chd
+ "&chs=" + chs
+ "&chl=" + chl + "' />;
}
}
}
次のように呼び出します。
<%= Html.GoogleChart("P3","t:60,40","250x100","Hello|World") %>
これにより、これがページに挿入されます。
Google Chart API の AC# ラッパー。
http://code.google.com/p/googlechartsharp/
使用例
http://code.google.com/p/googlechartsharp/wiki/UsageExamples
このラッパー クラスを組み込んだ HTMLHelper を作成して、さらに簡単にすることができると確信しています。