代碼,我剛剛發現DotNetHighCharts DLL來生成圖表: http://dotnethighcharts.codeplex.com/使用DOTNET的HighCharts dll文件來生成圖表背後
我添加的dll到我的項目,並把樣本代碼在我的Page_Load事件中得到一個餡餅(我不是用MVC的工作,現在,所以我只是把什麼是演示的控制器)
protected void Page_Load(object sender, EventArgs e)
{
Highcharts chart = new Highcharts("chart")
.InitChart(new Chart { PlotShadow = false })
.SetTitle(new Title { Text = "Browser market shares at a specific website, 2010" })
.SetTooltip(new Tooltip { Formatter = "function() { return '<b>'+ this.point.name +'</b>: '+ this.percentage +' %'; }" })
.SetPlotOptions(new PlotOptions
{
Pie = new PlotOptionsPie
{
AllowPointSelect = true,
Cursor = Cursors.Pointer,
DataLabels = new PlotOptionsPieDataLabels
{
Color = ColorTranslator.FromHtml("#000000"),
ConnectorColor = ColorTranslator.FromHtml("#000000"),
Formatter = "function() { return '<b>'+ this.point.name +'</b>: '+ this.percentage +' %'; }"
}
}
})
.SetSeries(new Series
{
Type = ChartTypes.Pie,
Name = "Browser share",
Data = new Data(new object[]
{
new object[] { "Firefox", 45.0 },
new object[] { "IE", 26.8 },
new DotNet.Highcharts.Options.Point
{
Name = "Chrome",
Y = 12.8,
Sliced = true,
Selected = true
},
new object[] { "Safari", 8.5 },
new object[] { "Opera", 6.2 },
new object[] { "Others", 0.7 }
})
});
}
}
}
的問題是,北距出現在我的頁面,這是 的重新添加任何東西? 在此先感謝
看看我在一個替代方案中使用.NET生成圖表(使用HighCharts)的條目少於5行。 http://stackoverflow.com/questions/12413606/using-highcharts-javascript-in-web-application/12750922#12750922 – CPhelefu 2012-10-05 17:11:25