2024-05-29 12:58:15 +02:00

54 lines
1.6 KiB
VB.net

Imports DevExpress.XtraCharts
Imports EnvelopeGenerator.Common
Public Class EnvelopeListController
Inherits BaseController
Public Sub New(pState As State)
MyBase.New(pState)
End Sub
Public Function ListEnvelopes() As IEnumerable(Of Envelope)
Return EnvelopeModel.List()
End Function
Public Function ListCompleted() As Object
Return EnvelopeModel.ListCompleted()
End Function
Public Overloads Function DeleteEnvelope(pEnvelope As Envelope, pReason As String) As Boolean
Return MyBase.DeleteEnvelope(pEnvelope, pReason)
End Function
Public Function GetPieChart() As ChartControl
Dim oChartControl As ChartControl = New ChartControl With {
.Name = "ChartControl1",
.Dock = DockStyle.Fill
}
Dim oSerie As Series = New Series("PIE Title", ViewType.Pie3D) With {
.LegendTextPattern = "{A}"
}
Dim pieLabel As PieSeriesLabel = TryCast(oSerie.Label, PieSeriesLabel)
If pieLabel IsNot Nothing Then
pieLabel.Position = PieSeriesLabelPosition.Outside
End If
Dim xAxisTitle As String = "Argument"
Dim yAxisTitle As String = "Value"
Dim oTable As DataTable = ChartModel.LoadPIEExample()
For Each oRow In oTable.Rows
Dim value1 As String = CStr(oRow.Item(xAxisTitle))
Dim value2 As String = CStr(oRow.Item(yAxisTitle))
oSerie.Points.Add(New SeriesPoint(value1, value2))
Next
oSerie.ArgumentScaleType = ScaleType.Qualitative
oChartControl.Series.Add(oSerie)
Return oChartControl
End Function
End Class