Google Chart HtmlHelper for Asp.net Mvc

前端 未结 2 1309
滥情空心
滥情空心 2020-12-25 08:49

Are there any HtmlHelper Extensions for Google Chart Api? (I like to use for some basic charts, e.g. Pie Chart, Bar Chart)

Soe Moe

2条回答
  •  半阙折子戏
    2020-12-25 09:11

    Google says that you insert a chart like this:

    Sample chart
    

    So it should be easy enough to write an HtmlHelper like this (untested):

    namespace System.Web.Mvc.Html
    {
        public static class GoogleChartHelpers
        {
            public static string GoogleChart
                (string cht, string chd, string chs, string chl)
            {
                return ";
            }
        }
    }
    

    and call it like this:

    <%= Html.GoogleChart("P3","t:60,40","250x100","Hello|World") %>
    

    which should insert this into your page:

    alt text

提交回复
热议问题