Soe*_*Moe 10 c# asp.net-mvc google-visualization
Google Chart Api是否有任何HtmlHelper Extensions ?(我喜欢用于一些基本图表,例如饼图,条形图)
Soe Moe
Rob*_*vey 17
谷歌说你插入这样的图表:
<img src="http://chart.apis.google.com/chart?
chs=250x100
&chd=t:60,40
&cht=p3
&chl=Hello|World"
alt="Sample chart"
/>
Run Code Online (Sandbox Code Playgroud)
所以编写像这样的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 + "' />;
}
}
}
Run Code Online (Sandbox Code Playgroud)
并称之为:
<%= Html.GoogleChart("P3","t:60,40","250x100","Hello|World") %>
Run Code Online (Sandbox Code Playgroud)
应将此插入您的页面:
Dav*_*vid 12
适用于Google Chart API的AC#wrapper.
http://code.google.com/p/googlechartsharp/
用法示例
http://code.google.com/p/googlechartsharp/wiki/UsageExamples
我相信你可以创建一个包含这个包装类的HTMLHelper,以使它更容易.
| 归档时间: |
|
| 查看次数: |
8326 次 |
| 最近记录: |