【问题标题】:Integrate Google Chart Interactive with ASP.NET and C#将 Google Chart Interactive 与 ASP.NET 和 C# 集成
【发布时间】:2010-11-15 04:10:33
【问题描述】:

我想使用带有 ASP.NET 和 C# 的 Google Chart Interactive 创建图表 我发现了这个例子http://code.google.com/apis/visualization/documentation/using_overview.html,但我发现如何将它与c#集成以及如何将数据从c#集成到javascript.. 有人可以提示我该怎么做吗?

【问题讨论】:

    标签: c# javascript asp.net google-visualization


    【解决方案1】:

    您需要做的是将命令发送到谷歌图表 api 并将响应转换为如下图所示的图像,然后您可以获取图像对象并将其写入文件或执行任何您想要的操作:

     string ChartURL = "http://chart.apis.google.com/chart?";
                ChartURL += "chxr=0,0," + MaxX + "";
                ChartURL += "&chxt=y";
                ChartURL += "&chbh=a";
                ChartURL += "&chs=" + ChartWidth + "x" + ChartHeight + "";
                ChartURL += "&cht=bvg";
                ChartURL += "&chco=" + ChartColors + "";
                ChartURL += "&chds=" + ChartDataRange + "";
                ChartURL += "&chd=t:" + ChartValues + "";
                ChartURL += "&chdl=" + ChartLegend + "";
                ChartURL += "&chtt=" + ChartTitle + "";
    
                HttpWebRequest myRequest = WebRequest.Create(ChartURL) as HttpWebRequest;
                HttpWebResponse ServerResponse = myRequest.GetResponse() as HttpWebResponse;
                Stream ResponseStream = myRequest.GetResponse().GetResponseStream();
                return System.Drawing.Image.FromStream(ResponseStream);
    

    【讨论】:

      猜你喜欢
      • 2021-06-12
      • 1970-01-01
      • 2016-08-29
      • 2015-09-02
      • 2012-02-21
      • 2011-09-23
      • 1970-01-01
      • 1970-01-01
      • 2014-07-13
      相关资源
      最近更新 更多