Highcharts,有什么方法可以在Winform应用程序中使用它吗
本文关键字:应用程序 Winform 什么 方法 Highcharts | 更新日期: 2023-09-27 18:00:58
i最近发现了DotNet.HighCharts项目,有没有办法在winform应用程序中使用它并在webBrowser中查看图表。
我试过了,但不起作用,
DotNet.Highcharts.Highcharts chart = new DotNet.Highcharts.Highcharts("chart")
.SetXAxis(new XAxis
{
Categories = new[] { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" }
})
.SetSeries(new Series
{
Data = new Data(new object[] { 29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4 })
}).SetTitle(new Title { Text = "12223" });
webBrowser1.DocumentText = chart.ToHtmlString();
除非您在外部托管它并在webBrowser控件内部加载它,否则不会。
将其更改为:webBrowser1.DocumentText = chart.ToHtmlString();
到chart1 = chart.ToHtmlString();
在Apsx页面上,执行以下操作:
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title></title>
<script src="YOURFOLDERPROJECT/jquery-1.5.1.min.js" type="text/javascript"></script>
<script src="YOURFOLDERPROJECT/highcharts.js" type="text/javascript"></script>
<script src="YOURFOLDERPROJECT/exporting.js" type="text/javascript"></script>
</head>
<body>
<form id="form1" runat="server">
<div><asp:Literal id="chart1" runat="server"></asp:Literal>
</div>
</form>
</body>