ClearDataFlag.AllData)
Chart.Extensions.Clear()
ClearChartStuff()
'ClearChart()
Try
Dim obj As Object = CType(Graph.Axis(1), snAxis).curves(0)
Catch tEx As Exception
MsgBox(tEx.ToString())
Exit Sub
End Try
' Chart.Style = ChartStyle.All
Chart.DataEditor = IIf(mWorkNormalize, False, Graph.DataEditor)
Chart.ShowTips = True
Chart.Highlight.Enabled = bHighlight
Chart.ToolBar = False
Chart.Gallery = Gallery.Lines
SetAttributes()
PassData()
Set3DView()
' SetAttributes()
DrawBorder()
DrawBackground()
DrawBorder()
DrawTitles()
DrawLegend()
DrawGridLines()
DrawAnnotations()
DrawLines()
DrawStripes()
DrawTrendPoints()
DrawDynamicAnnotations()
Catch ex As Exception
Console.WriteLine("Epa: " & ex.Message)
End Try
UpdateToolbar()
End Sub
- Sub Routine to clear chart.
Public Sub ClearChartStuff()
Chart.ClearData(ClearDataFlag.Data)
'Chart.ClearData(ClearDataFlag.Extensions)
Chart.ClearData(ClearDataFlag.IniValues)
Chart.ClearData(ClearDataFlag.Stripes)
Chart.ClearData(ClearDataFlag.XValues)
Chart.ClearData(ClearDataFlag.Values)
'Chart.ClearData(ClearDataFlag.ConstantLines)
Chart.ClearData(ClearDataFlag.Labels)
'Chart.ClearData(ClearDataFlag.ColorsAndPatterns)
'Chart.ClearData(ClearDataFlag.Commands)
Chart.ClearData(ClearDataFlag.Other)
Chart.ClearData(ClearDataFlag.Strings)
Chart.ClearData(ClearDataFlag.Titles)
End Sub
- Following Sub Routine draws the Annotations...
Public Sub DrawAnnotations()
Try
If Not (Graph.AnnotationsShow Or Graph.StickyNoteShow) Then
Exit Sub
End If
Dim i As Integer
'#If _cfx70 Then
'Dim annotations As Annotations = New Annotations
'#Else
Dim annotations As AnnotationX = New AnnotationX
'#End If
Dim balloon As AnnotationBalloon
Dim note As snStickyNote
Dim anno As snAnnotation
Dim text As String
Dim x1, x2 As Double
'poly = New AnnotationPolygon
'' this hold the polygon to draw Lines and Rects when zooming
'jnaPts = New ArrayList
'poly.Border.Color = Color.Black
'poly.Border.Style = Drawing2D.DashStyle.Dash
'poly.Border.Width = 0
'annotations.List.Add(poly)
If Graph.StickyNoteShow Then
For i = 0 To Graph.StickyNotes.Count - 1
Try
note = Graph.StickyNotes(i)
If note.Text <> "" Then
text = note.Text
text = ReplaceText(text)
balloon = New AnnotationBalloon
balloon.Text = text
balloon.Shadow = 3
note.balloon = balloon
If note.ValueOption.StartsWith("P") Then
balloon.Left = CInt(note.x)
balloon.Top = CInt(note.y)
Else
Dim x As Double
If bIsDate Then
x = jnaUtil.DateFns.StringToDate(note.x).ToOADate
Else
x = jnaUtil.StringFns.Number(note.x, 0.0)
End If
balloon.Attach(x, jnaUtil.StringFns.Number(note.y, 0.0))
End If
balloon.TextColor = plotStuff.GetColor(note.TextColor)
balloon.TailCorner = CInt(plotStuff.TailPosition(note.TailPosition))
#If Not _cfx70 Then
balloon.ArrowFactor = CInt(plotStuff.TailSize(note.TailSize))
#End If
balloon.Border.Color = System.Drawing.Color.Black
balloon.Color = plotStuff.GetColor(note.BGColor)
balloon.SizeToFit()
annotations.List.Add(balloon)
End If
Catch e As Exception
MsgBox("jna 111 " & e.Message)
End Try
Next i
End If
Dim label As AnnotationText
If Graph.AnnotationsShow Then
Dim bWidth As Boolean
For i = 0 To Graph.Annotations.Count - 1
anno = CType(Graph.Annotations(i), snAnnotation)
Try
If anno.Text.StartsWith("OVS:") And anno.X1.StartsWith("OVS:") And anno.Y1.StartsWith("OVS:") Then
Dim n, j As Integer
Dim dt As DataTable
Dim dc As New DataCenter.DataCenter.clsDC
Dim vText, vXValue, vYValue As String
Dim xx, yy, ttext As Object
vText = anno.Text.Substring(4)
vXValue = anno.X1.Substring(4)
vYValue = anno.Y1.Substring(4)
dt = dc.SelectData("", vText, vXValue, vYValue)
n = dt.Rows.Count
If n > 0 Then
For j = 0 To n - 1
Try
label = New AnnotationText
anno.label = label
xx = dc.GetValue(dt, vXValue, j, Now)
yy = dc.GetValue(dt, vYValue, j, 0.0)
ttext = dc.GetValue(dt, vText, j, "")
label.Text = ttext
label.TextColor = plotStuff.GetColor(anno.Color)
label.Color = System.Drawing.Color.Transparent
label.Border.Color = System.Drawing.Color.Transparent
label.Orientation = plotStuff.AnnoOrientation(anno.Orientation)
label.Align = StringAlignment.Near
label.WordWrap = anno.WordWrap
If bIsDate Then
x1 = jnaUtil.DateFns.StringToDate(xx).ToOADate
Else
x1 = xx
End If
label.SizeToFit()
label.Attach(x1, yy)
annotations.List.Add(label)
Catch
End Try
Next
End If
Else
label = New AnnotationText
anno.label = label
label.Text = ReplaceText(anno.Text)
label.TextColor = plotStuff.GetColor(anno.Color)
label.Color = System.Drawing.Color.Transparent
label.Border.Color = System.Drawing.Color.Transparent
label.Orientation = CInt(plotStuff.AnnoOrientation(anno.Orientation))
label.WordWrap = anno.WordWrap
bWidth = True
If anno.x2 = "" Then
label.Width = 200
label.Height = 100
bWidth = False
End If
If anno.ValueOption.StartsWith("P") Then
label.Left = jnaUtil.StringFns.Number(anno.X1, 0)
label.Top = jnaUtil.StringFns.Number(anno.Y1, 0)
If bWidth Then
label.Width = jnaUtil.StringFns.Number(anno.x2, 0)
label.Height = jnaUtil.StringFns.Number(anno.Y2, 0)
End If
Else
If bIsDate Then
x1 = jnaUtil.DateFns.StringToDate(anno.X1).ToOADate
If bWidth Then x2 = jnaUtil.DateFns.StringToDate(anno.x2).ToOADate
Else
x1 = anno.X1
x2 = anno.x2
End If
If bWidth Then
label.Attach(x1, jnaUtil.StringFns.Number(anno.Y1, 0.0), x2, jnaUtil.StringFns.Number(anno.Y2, 0.0))
Else
label.Attach(x1, jnaUtil.StringFns.Number(anno.Y1, 0.0))
End If
End If
label.SizeToFit()
annotations.List.Add(label)
End If
Catch e As Exception
MsgBox("show ")
End Try
Next
End If
mUserAnnotations = annotations.List.Count
'The following might not be necessary after we upgrade to Chart FX 6.2 version 6.2.3188.*
' looking to fix vista
If mUserAnnotations > 0 Then
Chart.Extensions.Add(annotations)
End If
Catch ex As Exception
MsgBox(ex.ToString())
End Try
End Sub