Jump to content
Software FX Community

prayaggandhi

Members
  • Posts

    15
  • Joined

  • Last visited

Posts posted by prayaggandhi

  1. Something interesting happened when I was browsing ChratFX 6.2 resource center on my computer. I got the exact same exception(Null reference exception) when I navigated to example Annotation Group Sample under Annotations in Interactive Samples.

    I have been trying to figure out why I get this exception in my application for long time now. Hope this gives you enough information to take it to your developers.

    I have attached the screen shot of the exception.

    Please review it and let us know what the fix is

  2. Dear SoftwareFX,

    We are using ChartFX for .NET version 6.2 with all the latest updates in our application. We have been struggling with the following error for a year now and we cannot seem to trace the problem. Based on exception we know that it's an internal error to ChartFX. It is expecting us to supply something concrete and we are not doing that. Please note that though this exception only happens on Windows 7 and Windows Vista. On Windows XP we never see this issue. No code change happens between different versions.

    Here is the stack trace of an error and an exception. Any help on this issue is greatly appreciated.

    ************** Exception Text **************

    System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.NullReferenceException: Object reference not set to an instance of an object.

    at SoftwareFX.ChartFX.Annotation.AnnotationList.0O(IGraphicsEx AQ, Rectangle AR, Boolean AS, Boolean AT, Int32 AU, Int32 AV)

    at SoftwareFX.ChartFX.Annotation.AnnotationX.24(IGraphicsEx F3, Rectangle F4, Boolean F5, Int32 F6, Int32 F7)

    --- End of inner exception stack trace ---

    at System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)

    at System.RuntimeMethodHandle.InvokeMethodFast(Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)

    at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)

    at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)

    at SoftwareFX.ChartFX.ExtensionManager.MI(19 2CA, Enum 2CB, Object[] 2CC)

    at SoftwareFX.ChartFX.ChartCore.EP(1R 1T1, Boolean 1T2, Boolean 1T3)

    at SoftwareFX.ChartFX.ChartCore.EO(1R 1SY, Rectangle& 1SZ, Int32& 1T0)

    at SoftwareFX.ChartFX.ChartCore.EN(PaintBar 1SV, IGraphicsEx 1SW, Rectangle& 1SX)

    at SoftwareFX.ChartFX.0X.OnPaint(PaintEventArgs e)

    at System.Windows.Forms.Control.PaintWithErrorHandling(PaintEventArgs e, Int16 layer, Boolean disposeEventArgs)

    at System.Windows.Forms.Control.WmPaint(Message& m)

    at System.Windows.Forms.Control.WndProc(Message& m)

    at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)

    at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)

    at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

    Thanks,

  3.  Hi Juan,

    Thanks for the quick reply.  Here is the code...

    • Sub Routine That draws the chart
      Public Sub DrawCharts(ByVal uDate As String)
      If mLocked Then Return
      Try

      GetAdditionInfo()
      poly = Nothing
      CurrentDate = uDate
      UserPointSerie = CInt(IIf(UserPoints.Count > 0, 1, 0))
      'Chart.ClearData(
    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
    -
  4. When I set my AxisY Inverted property to true and set the LogBase to 10 Chart looses Labels and tick marks for Y axis. Is it a known bug? Is there a workaround for this problem?

    Any help is appreciated. I tried this on Chart in the design mode and programmatically and same results both times.

    Thanks,Prayag Gandhi

×
×
  • Create New...