gpt4 book ai didi

c# - 将 Google Chart Interactive 与 ASP.NET 和 C# 集成

转载 作者:塔克拉玛干 更新时间:2023-11-02 21:22:12 25 4
gpt4 key购买 nike

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

最佳答案

您需要做的是将命令发送到 google charts 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);

关于c# - 将 Google Chart Interactive 与 ASP.NET 和 C# 集成,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4181323/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com