我试图在vb.net项目中实现LiveCharts但不成功。尝试搜索互联网,但幸运的是没有找到示例代码。我的代码中可能存在哪些问题?sample code
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
答案 0 :(得分:1)
我认为样本需要更多信息给某人尝试帮助...
什么是PIE控件名称?
您是在进口图书馆吗?
Imports LiveCharts.WinForms
Imports LiveCharts.Wpf
Imports LiveCharts
在最后一个PieChart命令之后,尝试强制重绘。例如,在Gauge控件中,如果使用:
,我会获得成功Gauge.resumelayout
因此,尝试REFRESH以及控件上的RESUMELAYOUT