是否有任何 HtmlHelper 扩展谷歌图表API? (我喜欢使用一些基本图表,例如饼图、条形图)
Soe Moe
谷歌说你插入一个像这样的图表:
<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") %>
应该将其插入到您的页面中:
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)