jj 05.10 frmDiagrams
This commit is contained in:
95
app/DD-Record-Organiser/frmDiagrams.vb
Normal file
95
app/DD-Record-Organiser/frmDiagrams.vb
Normal file
@@ -0,0 +1,95 @@
|
||||
Imports DevExpress.XtraCharts
|
||||
|
||||
Public Class frmDiagrams
|
||||
|
||||
Private Sub frmDiagrams_Load(sender As Object, e As EventArgs) Handles MyBase.Load
|
||||
Try
|
||||
Dim CHART_ENTITY_SQL As String = "SELECT * FROM TBPMO_CHART_ENTITY WHERE ENTITY_ID = " & CURRENT_FORM_ID
|
||||
Dim CHART_ENTITY_DT As DataTable = ClassDatabase.Return_Datatable(CHART_ENTITY_SQL)
|
||||
|
||||
' Check if Bottom Chart containers are needed
|
||||
Select Case CHART_ENTITY_DT.Rows.Count
|
||||
Case 0
|
||||
MsgBox("No Diagrams found")
|
||||
Case 1
|
||||
' Show only ChartTopLeft
|
||||
SplitContainerTop.Panel2Collapsed = True
|
||||
' Collapse SplitContainerBottom
|
||||
SplitContainerMain.Panel2Collapsed = True
|
||||
Case 2
|
||||
' Collapse SplitContainerBottom
|
||||
SplitContainerMain.Panel2Collapsed = True
|
||||
Case 3
|
||||
' Collapse ChartBottomRight
|
||||
SplitContainerBottom.Panel2Collapsed = True
|
||||
' Show SplitContainerBottom
|
||||
SplitContainerMain.Panel2Collapsed = False
|
||||
Case 4
|
||||
' Show SplitContainerBottom
|
||||
SplitContainerMain.Panel2Collapsed = False
|
||||
End Select
|
||||
|
||||
'Adjust With and Height of containers
|
||||
Dim containerW = Me.Width / 2
|
||||
SplitContainerTop.SplitterDistance = containerW
|
||||
SplitContainerBottom.SplitterDistance = containerW
|
||||
|
||||
Dim containerH = Me.Height / 2
|
||||
SplitContainerMain.SplitterDistance = containerH
|
||||
|
||||
' Create Charts
|
||||
For Each row As DataRow In CHART_ENTITY_DT.Rows
|
||||
Dim series As Series
|
||||
Dim chart As ChartControl
|
||||
|
||||
Dim i As Integer = CHART_ENTITY_DT.Rows.IndexOf(row)
|
||||
|
||||
Dim type = row.Item("TYPE_CHART")
|
||||
Dim title = row.Item("TITLE")
|
||||
Dim guid = row.Item("GUID")
|
||||
Dim value = row.Item("VALUE")
|
||||
Dim argument = row.Item("ARGUMENT")
|
||||
Dim sql = row.Item("SQL_COMMAND")
|
||||
|
||||
Dim DATA_DT As DataTable = ClassDatabase.Return_Datatable(sql)
|
||||
|
||||
' Create series based on type
|
||||
Select Case type
|
||||
Case "BAR"
|
||||
series = New Series(title, ViewType.Bar)
|
||||
Case "LINE"
|
||||
series = New Series(title, ViewType.Line)
|
||||
Case "AREA"
|
||||
series = New Series(title, ViewType.Area)
|
||||
Case Else
|
||||
Throw New Exception("Unknown Chart type for id " & title)
|
||||
End Select
|
||||
|
||||
' Select Current Chart
|
||||
Select Case i
|
||||
Case 0
|
||||
chart = ChartTopLeft
|
||||
Case 1
|
||||
chart = ChartTopRight
|
||||
Case 2
|
||||
chart = ChartBottomLeft
|
||||
Case Else
|
||||
chart = ChartBottomRight
|
||||
End Select
|
||||
|
||||
' Set DataSource
|
||||
chart.DataSource = DATA_DT
|
||||
|
||||
' Set shown Columns for Chart
|
||||
series.ArgumentDataMember = argument
|
||||
series.ValueDataMembers.AddRange(New String() {value})
|
||||
|
||||
' Show Data
|
||||
chart.Series.Add(series)
|
||||
Next
|
||||
|
||||
Catch ex As Exception
|
||||
MsgBox("Error While loading Diagram Data: " & vbNewLine & ex.Message, MsgBoxStyle.Critical)
|
||||
End Try
|
||||
End Sub
|
||||
End Class
|
||||
Reference in New Issue
Block a user