jj 19.10 improve diagrams, add export options
This commit is contained in:
139
app/DD-Record-Organiser/frmDiagrams.Designer.vb
generated
139
app/DD-Record-Organiser/frmDiagrams.Designer.vb
generated
@@ -26,10 +26,20 @@ Partial Class frmDiagrams
|
||||
Me.SplitContainerMain = New System.Windows.Forms.SplitContainer()
|
||||
Me.SplitContainerTop = New System.Windows.Forms.SplitContainer()
|
||||
Me.ChartTopLeft = New DevExpress.XtraCharts.ChartControl()
|
||||
Me.ToolStripTopLeft = New System.Windows.Forms.ToolStrip()
|
||||
Me.ChartTopRight = New DevExpress.XtraCharts.ChartControl()
|
||||
Me.ToolStripTopRight = New System.Windows.Forms.ToolStrip()
|
||||
Me.SplitContainerBottom = New System.Windows.Forms.SplitContainer()
|
||||
Me.ChartBottomLeft = New DevExpress.XtraCharts.ChartControl()
|
||||
Me.ToolStripBottomLeft = New System.Windows.Forms.ToolStrip()
|
||||
Me.ChartBottomRight = New DevExpress.XtraCharts.ChartControl()
|
||||
Me.ToolStripBottomRight = New System.Windows.Forms.ToolStrip()
|
||||
Me.ToolStripMain = New System.Windows.Forms.ToolStrip()
|
||||
Me.ToolStripButton1 = New System.Windows.Forms.ToolStripButton()
|
||||
Me.saveDialog = New System.Windows.Forms.SaveFileDialog()
|
||||
Me.ToolStripLabel1 = New System.Windows.Forms.ToolStripLabel()
|
||||
Me.txtExportTitle = New System.Windows.Forms.ToolStripTextBox()
|
||||
Me.ToolStripSeparator1 = New System.Windows.Forms.ToolStripSeparator()
|
||||
CType(Me.SplitContainerMain, System.ComponentModel.ISupportInitialize).BeginInit()
|
||||
Me.SplitContainerMain.Panel1.SuspendLayout()
|
||||
Me.SplitContainerMain.Panel2.SuspendLayout()
|
||||
@@ -46,12 +56,15 @@ Partial Class frmDiagrams
|
||||
Me.SplitContainerBottom.SuspendLayout()
|
||||
CType(Me.ChartBottomLeft, System.ComponentModel.ISupportInitialize).BeginInit()
|
||||
CType(Me.ChartBottomRight, System.ComponentModel.ISupportInitialize).BeginInit()
|
||||
Me.ToolStripMain.SuspendLayout()
|
||||
Me.SuspendLayout()
|
||||
'
|
||||
'SplitContainerMain
|
||||
'
|
||||
Me.SplitContainerMain.Dock = System.Windows.Forms.DockStyle.Fill
|
||||
Me.SplitContainerMain.Location = New System.Drawing.Point(0, 0)
|
||||
Me.SplitContainerMain.Anchor = CType((((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Bottom) _
|
||||
Or System.Windows.Forms.AnchorStyles.Left) _
|
||||
Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
|
||||
Me.SplitContainerMain.Location = New System.Drawing.Point(0, 28)
|
||||
Me.SplitContainerMain.Name = "SplitContainerMain"
|
||||
Me.SplitContainerMain.Orientation = System.Windows.Forms.Orientation.Horizontal
|
||||
'
|
||||
@@ -62,8 +75,8 @@ Partial Class frmDiagrams
|
||||
'SplitContainerMain.Panel2
|
||||
'
|
||||
Me.SplitContainerMain.Panel2.Controls.Add(Me.SplitContainerBottom)
|
||||
Me.SplitContainerMain.Size = New System.Drawing.Size(1160, 671)
|
||||
Me.SplitContainerMain.SplitterDistance = 386
|
||||
Me.SplitContainerMain.Size = New System.Drawing.Size(1160, 643)
|
||||
Me.SplitContainerMain.SplitterDistance = 369
|
||||
Me.SplitContainerMain.TabIndex = 0
|
||||
'
|
||||
'SplitContainerTop
|
||||
@@ -75,32 +88,52 @@ Partial Class frmDiagrams
|
||||
'SplitContainerTop.Panel1
|
||||
'
|
||||
Me.SplitContainerTop.Panel1.Controls.Add(Me.ChartTopLeft)
|
||||
Me.SplitContainerTop.Panel1.Controls.Add(Me.ToolStripTopLeft)
|
||||
'
|
||||
'SplitContainerTop.Panel2
|
||||
'
|
||||
Me.SplitContainerTop.Panel2.Controls.Add(Me.ChartTopRight)
|
||||
Me.SplitContainerTop.Size = New System.Drawing.Size(1160, 386)
|
||||
Me.SplitContainerTop.Panel2.Controls.Add(Me.ToolStripTopRight)
|
||||
Me.SplitContainerTop.Size = New System.Drawing.Size(1160, 369)
|
||||
Me.SplitContainerTop.SplitterDistance = 386
|
||||
Me.SplitContainerTop.TabIndex = 0
|
||||
'
|
||||
'ChartTopLeft
|
||||
'
|
||||
Me.ChartTopLeft.Dock = System.Windows.Forms.DockStyle.Fill
|
||||
Me.ChartTopLeft.Location = New System.Drawing.Point(0, 0)
|
||||
Me.ChartTopLeft.Location = New System.Drawing.Point(0, 25)
|
||||
Me.ChartTopLeft.Name = "ChartTopLeft"
|
||||
Me.ChartTopLeft.SeriesSerializable = New DevExpress.XtraCharts.Series(-1) {}
|
||||
Me.ChartTopLeft.Size = New System.Drawing.Size(386, 386)
|
||||
Me.ChartTopLeft.TabIndex = 0
|
||||
Me.ChartTopLeft.Size = New System.Drawing.Size(386, 344)
|
||||
Me.ChartTopLeft.TabIndex = 2
|
||||
'
|
||||
'ToolStripTopLeft
|
||||
'
|
||||
Me.ToolStripTopLeft.GripStyle = System.Windows.Forms.ToolStripGripStyle.Hidden
|
||||
Me.ToolStripTopLeft.Location = New System.Drawing.Point(0, 0)
|
||||
Me.ToolStripTopLeft.Name = "ToolStripTopLeft"
|
||||
Me.ToolStripTopLeft.Size = New System.Drawing.Size(386, 25)
|
||||
Me.ToolStripTopLeft.TabIndex = 1
|
||||
Me.ToolStripTopLeft.Text = "ToolStrip1"
|
||||
'
|
||||
'ChartTopRight
|
||||
'
|
||||
Me.ChartTopRight.Dock = System.Windows.Forms.DockStyle.Fill
|
||||
Me.ChartTopRight.Location = New System.Drawing.Point(0, 0)
|
||||
Me.ChartTopRight.Location = New System.Drawing.Point(0, 25)
|
||||
Me.ChartTopRight.Name = "ChartTopRight"
|
||||
Me.ChartTopRight.SeriesSerializable = New DevExpress.XtraCharts.Series(-1) {}
|
||||
Me.ChartTopRight.Size = New System.Drawing.Size(770, 386)
|
||||
Me.ChartTopRight.Size = New System.Drawing.Size(770, 344)
|
||||
Me.ChartTopRight.TabIndex = 1
|
||||
'
|
||||
'ToolStripTopRight
|
||||
'
|
||||
Me.ToolStripTopRight.GripStyle = System.Windows.Forms.ToolStripGripStyle.Hidden
|
||||
Me.ToolStripTopRight.Location = New System.Drawing.Point(0, 0)
|
||||
Me.ToolStripTopRight.Name = "ToolStripTopRight"
|
||||
Me.ToolStripTopRight.Size = New System.Drawing.Size(770, 25)
|
||||
Me.ToolStripTopRight.TabIndex = 0
|
||||
Me.ToolStripTopRight.Text = "ToolStrip2"
|
||||
'
|
||||
'SplitContainerBottom
|
||||
'
|
||||
Me.SplitContainerBottom.Dock = System.Windows.Forms.DockStyle.Fill
|
||||
@@ -110,37 +143,92 @@ Partial Class frmDiagrams
|
||||
'SplitContainerBottom.Panel1
|
||||
'
|
||||
Me.SplitContainerBottom.Panel1.Controls.Add(Me.ChartBottomLeft)
|
||||
Me.SplitContainerBottom.Panel1.Controls.Add(Me.ToolStripBottomLeft)
|
||||
'
|
||||
'SplitContainerBottom.Panel2
|
||||
'
|
||||
Me.SplitContainerBottom.Panel2.Controls.Add(Me.ChartBottomRight)
|
||||
Me.SplitContainerBottom.Size = New System.Drawing.Size(1160, 281)
|
||||
Me.SplitContainerBottom.Panel2.Controls.Add(Me.ToolStripBottomRight)
|
||||
Me.SplitContainerBottom.Size = New System.Drawing.Size(1160, 270)
|
||||
Me.SplitContainerBottom.SplitterDistance = 386
|
||||
Me.SplitContainerBottom.TabIndex = 0
|
||||
'
|
||||
'ChartBottomLeft
|
||||
'
|
||||
Me.ChartBottomLeft.Dock = System.Windows.Forms.DockStyle.Fill
|
||||
Me.ChartBottomLeft.Location = New System.Drawing.Point(0, 0)
|
||||
Me.ChartBottomLeft.Location = New System.Drawing.Point(0, 25)
|
||||
Me.ChartBottomLeft.Name = "ChartBottomLeft"
|
||||
Me.ChartBottomLeft.SeriesSerializable = New DevExpress.XtraCharts.Series(-1) {}
|
||||
Me.ChartBottomLeft.Size = New System.Drawing.Size(386, 281)
|
||||
Me.ChartBottomLeft.TabIndex = 0
|
||||
Me.ChartBottomLeft.Size = New System.Drawing.Size(386, 245)
|
||||
Me.ChartBottomLeft.TabIndex = 1
|
||||
'
|
||||
'ToolStripBottomLeft
|
||||
'
|
||||
Me.ToolStripBottomLeft.GripStyle = System.Windows.Forms.ToolStripGripStyle.Hidden
|
||||
Me.ToolStripBottomLeft.Location = New System.Drawing.Point(0, 0)
|
||||
Me.ToolStripBottomLeft.Name = "ToolStripBottomLeft"
|
||||
Me.ToolStripBottomLeft.Size = New System.Drawing.Size(386, 25)
|
||||
Me.ToolStripBottomLeft.TabIndex = 0
|
||||
Me.ToolStripBottomLeft.Text = "ToolStrip4"
|
||||
'
|
||||
'ChartBottomRight
|
||||
'
|
||||
Me.ChartBottomRight.Dock = System.Windows.Forms.DockStyle.Fill
|
||||
Me.ChartBottomRight.Location = New System.Drawing.Point(0, 0)
|
||||
Me.ChartBottomRight.Location = New System.Drawing.Point(0, 25)
|
||||
Me.ChartBottomRight.Name = "ChartBottomRight"
|
||||
Me.ChartBottomRight.SeriesSerializable = New DevExpress.XtraCharts.Series(-1) {}
|
||||
Me.ChartBottomRight.Size = New System.Drawing.Size(770, 281)
|
||||
Me.ChartBottomRight.TabIndex = 0
|
||||
Me.ChartBottomRight.Size = New System.Drawing.Size(770, 245)
|
||||
Me.ChartBottomRight.TabIndex = 1
|
||||
'
|
||||
'ToolStripBottomRight
|
||||
'
|
||||
Me.ToolStripBottomRight.GripStyle = System.Windows.Forms.ToolStripGripStyle.Hidden
|
||||
Me.ToolStripBottomRight.Location = New System.Drawing.Point(0, 0)
|
||||
Me.ToolStripBottomRight.Name = "ToolStripBottomRight"
|
||||
Me.ToolStripBottomRight.Size = New System.Drawing.Size(770, 25)
|
||||
Me.ToolStripBottomRight.TabIndex = 0
|
||||
Me.ToolStripBottomRight.Text = "ToolStrip3"
|
||||
'
|
||||
'ToolStripMain
|
||||
'
|
||||
Me.ToolStripMain.GripStyle = System.Windows.Forms.ToolStripGripStyle.Hidden
|
||||
Me.ToolStripMain.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.ToolStripButton1, Me.ToolStripSeparator1, Me.ToolStripLabel1, Me.txtExportTitle})
|
||||
Me.ToolStripMain.Location = New System.Drawing.Point(0, 0)
|
||||
Me.ToolStripMain.Name = "ToolStripMain"
|
||||
Me.ToolStripMain.Size = New System.Drawing.Size(1160, 25)
|
||||
Me.ToolStripMain.TabIndex = 1
|
||||
Me.ToolStripMain.Text = "ToolStrip1"
|
||||
'
|
||||
'ToolStripButton1
|
||||
'
|
||||
Me.ToolStripButton1.Image = Global.DD_Record_Organiser.My.Resources.Resources.pdf
|
||||
Me.ToolStripButton1.ImageTransparentColor = System.Drawing.Color.Magenta
|
||||
Me.ToolStripButton1.Name = "ToolStripButton1"
|
||||
Me.ToolStripButton1.Size = New System.Drawing.Size(101, 22)
|
||||
Me.ToolStripButton1.Text = "Export als PDF"
|
||||
'
|
||||
'ToolStripLabel1
|
||||
'
|
||||
Me.ToolStripLabel1.Name = "ToolStripLabel1"
|
||||
Me.ToolStripLabel1.Size = New System.Drawing.Size(87, 22)
|
||||
Me.ToolStripLabel1.Text = "Titel für Export:"
|
||||
'
|
||||
'txtExportTitle
|
||||
'
|
||||
Me.txtExportTitle.Name = "txtExportTitle"
|
||||
Me.txtExportTitle.Size = New System.Drawing.Size(150, 25)
|
||||
'
|
||||
'ToolStripSeparator1
|
||||
'
|
||||
Me.ToolStripSeparator1.Name = "ToolStripSeparator1"
|
||||
Me.ToolStripSeparator1.Size = New System.Drawing.Size(6, 25)
|
||||
'
|
||||
'frmDiagrams
|
||||
'
|
||||
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
|
||||
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
|
||||
Me.ClientSize = New System.Drawing.Size(1160, 671)
|
||||
Me.Controls.Add(Me.ToolStripMain)
|
||||
Me.Controls.Add(Me.SplitContainerMain)
|
||||
Me.Icon = CType(resources.GetObject("$this.Icon"), System.Drawing.Icon)
|
||||
Me.Name = "frmDiagrams"
|
||||
@@ -150,25 +238,42 @@ Partial Class frmDiagrams
|
||||
CType(Me.SplitContainerMain, System.ComponentModel.ISupportInitialize).EndInit()
|
||||
Me.SplitContainerMain.ResumeLayout(False)
|
||||
Me.SplitContainerTop.Panel1.ResumeLayout(False)
|
||||
Me.SplitContainerTop.Panel1.PerformLayout()
|
||||
Me.SplitContainerTop.Panel2.ResumeLayout(False)
|
||||
Me.SplitContainerTop.Panel2.PerformLayout()
|
||||
CType(Me.SplitContainerTop, System.ComponentModel.ISupportInitialize).EndInit()
|
||||
Me.SplitContainerTop.ResumeLayout(False)
|
||||
CType(Me.ChartTopLeft, System.ComponentModel.ISupportInitialize).EndInit()
|
||||
CType(Me.ChartTopRight, System.ComponentModel.ISupportInitialize).EndInit()
|
||||
Me.SplitContainerBottom.Panel1.ResumeLayout(False)
|
||||
Me.SplitContainerBottom.Panel1.PerformLayout()
|
||||
Me.SplitContainerBottom.Panel2.ResumeLayout(False)
|
||||
Me.SplitContainerBottom.Panel2.PerformLayout()
|
||||
CType(Me.SplitContainerBottom, System.ComponentModel.ISupportInitialize).EndInit()
|
||||
Me.SplitContainerBottom.ResumeLayout(False)
|
||||
CType(Me.ChartBottomLeft, System.ComponentModel.ISupportInitialize).EndInit()
|
||||
CType(Me.ChartBottomRight, System.ComponentModel.ISupportInitialize).EndInit()
|
||||
Me.ToolStripMain.ResumeLayout(False)
|
||||
Me.ToolStripMain.PerformLayout()
|
||||
Me.ResumeLayout(False)
|
||||
Me.PerformLayout()
|
||||
|
||||
End Sub
|
||||
Friend WithEvents SplitContainerMain As System.Windows.Forms.SplitContainer
|
||||
Friend WithEvents SplitContainerTop As System.Windows.Forms.SplitContainer
|
||||
Friend WithEvents SplitContainerBottom As System.Windows.Forms.SplitContainer
|
||||
Friend WithEvents ChartTopLeft As DevExpress.XtraCharts.ChartControl
|
||||
Friend WithEvents ToolStripTopLeft As System.Windows.Forms.ToolStrip
|
||||
Friend WithEvents ChartTopRight As DevExpress.XtraCharts.ChartControl
|
||||
Friend WithEvents ToolStripTopRight As System.Windows.Forms.ToolStrip
|
||||
Friend WithEvents ChartBottomLeft As DevExpress.XtraCharts.ChartControl
|
||||
Friend WithEvents ToolStripBottomLeft As System.Windows.Forms.ToolStrip
|
||||
Friend WithEvents ChartBottomRight As DevExpress.XtraCharts.ChartControl
|
||||
Friend WithEvents ToolStripBottomRight As System.Windows.Forms.ToolStrip
|
||||
Friend WithEvents ToolStripMain As System.Windows.Forms.ToolStrip
|
||||
Friend WithEvents saveDialog As System.Windows.Forms.SaveFileDialog
|
||||
Friend WithEvents ToolStripButton1 As System.Windows.Forms.ToolStripButton
|
||||
Friend WithEvents ToolStripSeparator1 As System.Windows.Forms.ToolStripSeparator
|
||||
Friend WithEvents ToolStripLabel1 As System.Windows.Forms.ToolStripLabel
|
||||
Friend WithEvents txtExportTitle As System.Windows.Forms.ToolStripTextBox
|
||||
End Class
|
||||
|
||||
@@ -117,6 +117,24 @@
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<metadata name="ToolStripTopLeft.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>128, 17</value>
|
||||
</metadata>
|
||||
<metadata name="ToolStripTopRight.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>270, 17</value>
|
||||
</metadata>
|
||||
<metadata name="ToolStripBottomLeft.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>591, 17</value>
|
||||
</metadata>
|
||||
<metadata name="ToolStripBottomRight.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>421, 17</value>
|
||||
</metadata>
|
||||
<metadata name="ToolStripMain.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>753, 17</value>
|
||||
</metadata>
|
||||
<metadata name="saveDialog.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>
|
||||
|
||||
@@ -1,6 +1,131 @@
|
||||
Imports DevExpress.XtraCharts
|
||||
Imports System.IO
|
||||
Imports System.Drawing.Imaging
|
||||
Imports DevExpress.XtraCharts
|
||||
Imports DevExpress.XtraPrinting
|
||||
Imports DevExpress.XtraPrintingLinks
|
||||
|
||||
Public Class frmDiagrams
|
||||
Private toolbars As List(Of ToolStrip)
|
||||
Private charts As List(Of ChartControl)
|
||||
Private groupCount As Integer
|
||||
|
||||
Private CHART_TITLE_STRING As String
|
||||
|
||||
Private Sub frmDiagrams_Load(sender As Object, e As EventArgs) Handles MyBase.Load
|
||||
Dim CHART_ENTITY_SQL, CHART_GROUPS_SQL, CHART_TITLE_SQL As String
|
||||
Dim CHART_ENTITY_DT, CHART_GROUPS_DT As DataTable
|
||||
|
||||
CHART_TITLE_SQL = String.Format("SELECT NAME FROM TBPMO_FORM WHERE GUID = {0}", CURRENT_FORM_ID)
|
||||
CHART_ENTITY_SQL = String.Format("SELECT * FROM TBPMO_CHART_ENTITY WHERE ENTITY_ID = {0}", CURRENT_FORM_ID)
|
||||
CHART_GROUPS_SQL = String.Format("SELECT DISTINCT GROUP_ID FROM TBPMO_CHART_ENTITY WHERE ENTITY_ID = {0} ORDER BY GROUP_ID", CURRENT_FORM_ID)
|
||||
CHART_TITLE_STRING = ClassDatabase.Execute_Scalar(CHART_TITLE_SQL)
|
||||
CHART_ENTITY_DT = ClassDatabase.Return_Datatable(CHART_ENTITY_SQL)
|
||||
CHART_GROUPS_DT = ClassDatabase.Return_Datatable(CHART_GROUPS_SQL)
|
||||
|
||||
Dim Groups As DataRowCollection = CHART_GROUPS_DT.Rows
|
||||
groupCount = Groups.Count
|
||||
toolbars = New List(Of ToolStrip) From {ToolStripTopLeft, ToolStripTopRight, ToolStripBottomLeft, ToolStripBottomRight}
|
||||
charts = New List(Of ChartControl) From {ChartTopLeft, ChartTopRight, ChartBottomLeft, ChartBottomRight}
|
||||
|
||||
If groupCount = 0 Then
|
||||
MsgBox("No Diagrams found")
|
||||
Me.Close()
|
||||
End If
|
||||
|
||||
Load_Settings()
|
||||
|
||||
Configure_Chart_Tool_Bars()
|
||||
Configure_Split_Containers(groupCount)
|
||||
|
||||
If groupCount > 1 Then
|
||||
For Each gRow As DataRow In Groups
|
||||
Dim groupIndex As Integer = Groups.IndexOf(gRow)
|
||||
Dim groupName As String = gRow.Item("GROUP_ID")
|
||||
|
||||
Dim groupCharts = CHART_ENTITY_DT.Select(String.Format("GROUP_ID = '{0}'", groupName))
|
||||
Dim chart As ChartControl
|
||||
|
||||
For Each cRow As DataRow In groupCharts
|
||||
|
||||
Dim type = cRow.Item("TYPE_CHART")
|
||||
Dim title = cRow.Item("TITLE")
|
||||
Dim guid = cRow.Item("GUID")
|
||||
Dim value = cRow.Item("VALUE")
|
||||
Dim argument = cRow.Item("ARGUMENT")
|
||||
Dim sql = cRow.Item("SQL_COMMAND")
|
||||
|
||||
Dim DATA_DT As DataTable = ClassDatabase.Return_Datatable(sql)
|
||||
|
||||
Dim series As Series = Create_Series(title, type)
|
||||
|
||||
' Select Current Chart
|
||||
chart = Select_Chart(groupIndex)
|
||||
chart = charts.Item(groupIndex)
|
||||
|
||||
' Set DataSource
|
||||
chart.DataSource = DATA_DT
|
||||
|
||||
' Set shown Columns for Chart
|
||||
series.ArgumentDataMember = argument
|
||||
series.ValueDataMembers.AddRange(New String() {value})
|
||||
|
||||
'set some options
|
||||
chart.Legend.Visibility = DevExpress.Utils.DefaultBoolean.True
|
||||
|
||||
' Show Data
|
||||
chart.Series.Add(series)
|
||||
|
||||
Next ' End Charts
|
||||
Next 'End Groups
|
||||
Else
|
||||
' Create Charts
|
||||
For Each row As DataRow In CHART_ENTITY_DT.Rows
|
||||
|
||||
Dim chart As ChartControl
|
||||
|
||||
Dim chartIndex 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
|
||||
Dim series As Series = Create_Series(title, type)
|
||||
|
||||
' Select Current Chart
|
||||
chart = Select_Chart(chartIndex)
|
||||
|
||||
' Set DataSource
|
||||
chart.DataSource = DATA_DT
|
||||
|
||||
' Set shown Columns for Chart
|
||||
series.ArgumentDataMember = argument
|
||||
series.ValueDataMembers.AddRange(New String() {value})
|
||||
|
||||
'set some options
|
||||
chart.Legend.Visibility = DevExpress.Utils.DefaultBoolean.True
|
||||
chart.OptionsPrint.SizeMode = Printing.PrintSizeMode.Stretch
|
||||
|
||||
' Show Data
|
||||
chart.Series.Add(series)
|
||||
Next
|
||||
End If
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub frmDiagrams_FormClosing(sender As Object, e As FormClosingEventArgs) Handles Me.FormClosing
|
||||
Dim XMLPath As String = Get_Splitter_Layout_Filename()
|
||||
Dim layout As New ClassLayout(XMLPath)
|
||||
Dim settings As New List(Of ClassSetting)
|
||||
|
||||
settings = Get_Settings(settings)
|
||||
layout.Save(settings)
|
||||
End Sub
|
||||
|
||||
Private Function Get_Splitter_Layout_Filename() As String
|
||||
Dim Filename As String = String.Format("{0}-Diagram-SplitterLayout.xml", CURRENT_FORM_ID)
|
||||
@@ -57,8 +182,6 @@ Public Class frmDiagrams
|
||||
|
||||
Private Sub Configure_Split_Containers(VisibleContainers As Integer)
|
||||
Select Case VisibleContainers
|
||||
Case 0
|
||||
MsgBox("No Diagrams found")
|
||||
Case 1
|
||||
' Show only ChartTopLeft
|
||||
SplitContainerTop.Panel2Collapsed = True
|
||||
@@ -78,15 +201,6 @@ Public Class frmDiagrams
|
||||
End Select
|
||||
End Sub
|
||||
|
||||
Private Sub frmDiagrams_FormClosing(sender As Object, e As FormClosingEventArgs) Handles Me.FormClosing
|
||||
Dim XMLPath As String = Get_Splitter_Layout_Filename()
|
||||
Dim layout As New ClassLayout(XMLPath)
|
||||
Dim settings As New List(Of ClassSetting)
|
||||
|
||||
settings = Get_Settings(settings)
|
||||
layout.Save(settings)
|
||||
End Sub
|
||||
|
||||
Private Function Create_Series(title As String, type As String) As Series
|
||||
Dim series As Series
|
||||
|
||||
@@ -123,97 +237,144 @@ Public Class frmDiagrams
|
||||
End Select
|
||||
End Function
|
||||
|
||||
Private Sub frmDiagrams_Load(sender As Object, e As EventArgs) Handles MyBase.Load
|
||||
Dim CHART_ENTITY_SQL, CHART_GROUPS_SQL As String
|
||||
Dim CHART_ENTITY_DT, CHART_GROUPS_DT As DataTable
|
||||
Private Sub Configure_Chart_Tool_Bars()
|
||||
ToolStripTopLeft.Tag = ChartTopLeft
|
||||
ToolStripTopRight.Tag = ChartTopRight
|
||||
ToolStripBottomLeft.Tag = ChartBottomLeft
|
||||
ToolStripBottomRight.Tag = ChartBottomRight
|
||||
|
||||
CHART_ENTITY_SQL = String.Format("SELECT * FROM TBPMO_CHART_ENTITY WHERE ENTITY_ID = {0}", CURRENT_FORM_ID)
|
||||
CHART_GROUPS_SQL = String.Format("SELECT DISTINCT GROUP_ID FROM TBPMO_CHART_ENTITY WHERE ENTITY_ID = {0} ORDER BY GROUP_ID", CURRENT_FORM_ID)
|
||||
CHART_ENTITY_DT = ClassDatabase.Return_Datatable(CHART_ENTITY_SQL)
|
||||
CHART_GROUPS_DT = ClassDatabase.Return_Datatable(CHART_GROUPS_SQL)
|
||||
For Each toolbar As ToolStrip In toolbars
|
||||
toolbar.Items.Add("Export to Excel", My.Resources.xls, AddressOf ExportToExcel_Click)
|
||||
toolbar.Items.Add("Export to PDF", My.Resources.pdf, AddressOf ExportToPdf_Click)
|
||||
toolbar.Items.Add("Export to Image", My.Resources.bmp, AddressOf ExportToImage_Click)
|
||||
Next
|
||||
End Sub
|
||||
|
||||
Dim Groups As DataRowCollection = CHART_GROUPS_DT.Rows
|
||||
Dim GroupCount As Integer = Groups.Count
|
||||
Private Sub Confirm_Open_File(filepath As String)
|
||||
Dim filename As String = New FileInfo(filepath).Name
|
||||
Dim message As String
|
||||
|
||||
Load_Settings()
|
||||
Configure_Split_Containers(GroupCount)
|
||||
|
||||
If GroupCount > 1 Then
|
||||
For Each gRow As DataRow In Groups
|
||||
Dim groupIndex As Integer = Groups.IndexOf(gRow)
|
||||
Dim groupName As String = gRow.Item("GROUP_ID")
|
||||
|
||||
Dim groupCharts = CHART_ENTITY_DT.Select(String.Format("GROUP_ID = '{0}'", groupName))
|
||||
Dim chart As ChartControl
|
||||
|
||||
For Each cRow As DataRow In groupCharts
|
||||
|
||||
Dim type = cRow.Item("TYPE_CHART")
|
||||
Dim title = cRow.Item("TITLE")
|
||||
Dim guid = cRow.Item("GUID")
|
||||
Dim value = cRow.Item("VALUE")
|
||||
Dim argument = cRow.Item("ARGUMENT")
|
||||
Dim sql = cRow.Item("SQL_COMMAND")
|
||||
|
||||
Dim DATA_DT As DataTable = ClassDatabase.Return_Datatable(sql)
|
||||
|
||||
Dim series As Series = Create_Series(title, type)
|
||||
|
||||
' Select Current Chart
|
||||
chart = Select_Chart(groupIndex)
|
||||
|
||||
' Set DataSource
|
||||
chart.DataSource = DATA_DT
|
||||
|
||||
' Set shown Columns for Chart
|
||||
series.ArgumentDataMember = argument
|
||||
series.ValueDataMembers.AddRange(New String() {value})
|
||||
|
||||
'set some options
|
||||
chart.Legend.Visibility = DevExpress.Utils.DefaultBoolean.True
|
||||
|
||||
' Show Data
|
||||
chart.Series.Add(series)
|
||||
|
||||
Next ' End Charts
|
||||
Next 'End Groups
|
||||
If USER_LANGUAGE = "de_DE" Then
|
||||
message = String.Format("Datei {0} erstellt. Jetzt öffnen?", filename)
|
||||
Else
|
||||
' Create Charts
|
||||
For Each row As DataRow In CHART_ENTITY_DT.Rows
|
||||
|
||||
Dim chart As ChartControl
|
||||
|
||||
Dim chartIndex 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
|
||||
Dim series As Series = Create_Series(title, type)
|
||||
|
||||
' Select Current Chart
|
||||
chart = Select_Chart(chartIndex)
|
||||
|
||||
' Set DataSource
|
||||
chart.DataSource = DATA_DT
|
||||
|
||||
' Set shown Columns for Chart
|
||||
series.ArgumentDataMember = argument
|
||||
series.ValueDataMembers.AddRange(New String() {value})
|
||||
|
||||
'set some options
|
||||
chart.Legend.Visibility = DevExpress.Utils.DefaultBoolean.True
|
||||
|
||||
' Show Data
|
||||
chart.Series.Add(series)
|
||||
Next
|
||||
message = String.Format("File {0} created. Open now?", filename)
|
||||
End If
|
||||
|
||||
|
||||
Dim successResult As DialogResult = MessageBox.Show(message, "Success", MessageBoxButtons.YesNo)
|
||||
If successResult = Windows.Forms.DialogResult.Yes Then
|
||||
Process.Start(filepath)
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub ExportToPdf_Click(sender As ToolStripItem, e As EventArgs)
|
||||
Dim item As ToolStripItem = sender
|
||||
Dim toolbar As ToolStrip = item.GetCurrentParent()
|
||||
Dim chart As ChartControl = toolbar.Tag
|
||||
ExportCharts(New List(Of ChartControl) From {chart}, "pdf")
|
||||
End Sub
|
||||
|
||||
Private Sub ExportToExcel_Click(sender As ToolStripItem, e As EventArgs)
|
||||
Dim item As ToolStripItem = sender
|
||||
Dim toolbar As ToolStrip = item.GetCurrentParent()
|
||||
Dim chart As ChartControl = toolbar.Tag
|
||||
ExportCharts(New List(Of ChartControl) From {chart}, "xls")
|
||||
End Sub
|
||||
|
||||
Private Sub ExportToImage_Click(sender As ToolStripItem, e As EventArgs)
|
||||
Dim item As ToolStripItem = sender
|
||||
Dim toolbar As ToolStrip = item.GetCurrentParent()
|
||||
Dim chart As ChartControl = toolbar.Tag
|
||||
ExportCharts(New List(Of ChartControl) From {chart}, "img")
|
||||
End Sub
|
||||
|
||||
Private Sub ToolStripButton1_Click(sender As Object, e As EventArgs) Handles ToolStripButton1.Click
|
||||
ExportCharts(charts, "pdf")
|
||||
End Sub
|
||||
|
||||
Private Sub ExportCharts(_charts As List(Of ChartControl), Optional ext As String = "pdf")
|
||||
Try
|
||||
' Setup the 'page'
|
||||
Dim printingSystem As New PrintingSystem
|
||||
Dim compositeLink As New CompositeLink(printingSystem)
|
||||
Dim count = 1 ' chart counter
|
||||
compositeLink.Landscape = True ' set to landscape
|
||||
AddHandler compositeLink.CreateMarginalHeaderArea, AddressOf compositeLink_CreateMarginalHeaderArea
|
||||
|
||||
' Create Title
|
||||
Dim titleLink As New Link()
|
||||
AddHandler titleLink.CreateDetailHeaderArea, AddressOf titleLink_CreateDetailHeaderArea
|
||||
compositeLink.Links.Add(titleLink)
|
||||
|
||||
' Loop through charts
|
||||
For Each chart As ChartControl In _charts
|
||||
chart.OptionsPrint.SizeMode = Printing.PrintSizeMode.Zoom
|
||||
|
||||
Dim link As New PrintableComponentLink()
|
||||
link.Component = chart
|
||||
compositeLink.Links.Add(link)
|
||||
|
||||
If groupCount <= count Then
|
||||
Exit For
|
||||
Else
|
||||
count = count + 1
|
||||
End If
|
||||
Next
|
||||
|
||||
Select Case ext
|
||||
Case "img"
|
||||
saveDialog.Filter = "PNG Images|*.png"
|
||||
Case "xls"
|
||||
saveDialog.Filter = "Excel Files|*.xlsx"
|
||||
Case Else
|
||||
saveDialog.Filter = "PDF Files|*.pdf"
|
||||
End Select
|
||||
|
||||
saveDialog.FileName = String.Format("ADDI_Report_Export_{0}", Date.Now().ToString("dd-MM-yyyy"))
|
||||
|
||||
Dim result As DialogResult = saveDialog.ShowDialog()
|
||||
|
||||
If result = Windows.Forms.DialogResult.OK Then
|
||||
Dim filename As String = saveDialog.FileName
|
||||
|
||||
Select Case ext
|
||||
Case "img"
|
||||
compositeLink.ExportToImage(filename)
|
||||
Case "xls"
|
||||
compositeLink.ExportToXlsx(filename)
|
||||
Case Else
|
||||
compositeLink.ExportToPdf(filename)
|
||||
End Select
|
||||
|
||||
Application.DoEvents()
|
||||
Confirm_Open_File(filename)
|
||||
End If
|
||||
Catch ex As Exception
|
||||
MsgBox("Error while exporting Charts: " & vbNewLine & ex.Message, MsgBoxStyle.Critical)
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
Private Sub compositeLink_CreateMarginalHeaderArea(sender As Object, e As CreateAreaEventArgs)
|
||||
e.Graph.Font = New Font("Segoe UI", 10)
|
||||
e.Graph.DrawPageInfo(PageInfo.DateTime, "{0:dd.MM.yyyy hhhh:mmmm}", Color.Black, New RectangleF(0, 0, 200, 50), BorderSide.None)
|
||||
End Sub
|
||||
|
||||
Private Sub titleLink_CreateDetailHeaderArea(sender As Object, e As CreateAreaEventArgs)
|
||||
Dim tbTitle As New TextBrick
|
||||
Dim title As String
|
||||
|
||||
If txtExportTitle.Text.Trim <> String.Empty Then
|
||||
title = txtExportTitle.Text
|
||||
Else
|
||||
title = CHART_TITLE_STRING
|
||||
End If
|
||||
|
||||
tbTitle.Text = title
|
||||
tbTitle.Font = New Font("Segoe UI", 18)
|
||||
tbTitle.Rect = New RectangleF(0, 0, 300, 40)
|
||||
tbTitle.BorderWidth = 0
|
||||
tbTitle.BackColor = Color.Transparent
|
||||
tbTitle.HorzAlignment = DevExpress.Utils.HorzAlignment.Near
|
||||
|
||||
e.Graph.DrawBrick(tbTitle)
|
||||
End Sub
|
||||
End Class
|
||||
Reference in New Issue
Block a user