我曾尝试 vb.net 项目中实现LiveCharts,但没有成功。尝试搜索互联网,但没有找到示例代码。我的代码中可能存在什么问题?示例代码
Private Sub InitializeChart()
Dim labelPoint As Func(Of ChartPoint, String) = Function(chartPoint) String.Format("{0} ({1:P})", chartPoint.Y, chartPoint.Y, chartPoint.Participation)
'pieChartMain = New LiveCharts.WinForms.PieChart
Dim seriesCollection As SeriesCollection = New SeriesCollection
Dim pieSeries1 As PieSeries = New PieSeries
Dim pieSeries2 As PieSeries = New PieSeries
pieSeries1.Title = "MALE"
pieSeries1.Values = New ChartValues(Of Double) From {3}
pieSeries1.PushOut = 15
pieSeries1.DataLabels = True
pieSeries1.LabelPoint = labelPoint
pieSeries2.Title = "FEMALE"
pieSeries2.Values = New ChartValues(Of Double) From {6}
pieSeries2.DataLabels = True
pieSeries2.LabelPoint = labelPoint
seriesCollection.Add(pieSeries1)
seriesCollection.Add(pieSeries2)
pieChartMain.Series.Add(seriesCollection)
pieChartMain.LegendLocation = LegendLocation.Bottom
pieChartMain.Show()
End Sub
我认为该示例需要更多信息才能有人尝试帮助...
PIE 控件名称是什么?
您要导入库吗?
Imports LiveCharts.WinForms
Imports LiveCharts.Wpf
Imports LiveCharts
在最后一个饼图命令之后,尝试强制重绘。例如,在仪表控件中,如果使用以下方法,我将获得成功:
Gauge.resumelayout
因此,请尝试刷新并恢复控件上的布局