我最近发现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();
答案 0 :(得分:0)
除非您在外部托管并将其加载到webBrowser控件中,否则不会。
答案 1 :(得分:0)
将此更改为webBrowser1.DocumentText = chart.ToHtmlString();
至chart1 = chart.ToHtmlString();
在Aspx页面上,执行以下操作:
<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>