Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
610
XamDataChart Throws System.NullReferenceException When Mousing Over Legend Value Tips
posted
We have a XamDataChart integrated with a XamPivotGrid (see xaml Code Snippets below)5
When the OlapXAxis.SeriesCreating event of the XamDataChart fires, we create
legend value tips for points on the points on the x data series using a
a stack panel. ( See CreateXSeriesTips in the Program Code Behind section below. )

When the mouse hovers over the databars of the datachart, the legend value tips show.
This functionality worked with Infragistics versions 16.1 and up untill versions
16.2.20162.1006.

As of Infragistics versions 16.2.20162.2045, a System.NullReferenceException is thrown in
InfragisticsWPF4.Controls.Charts.XamDataChart.v16.2.dll immediately when the mouse
hovers over the databars on the datachart.
The only other error information provided is: "Object reference not set to an instance of an object"

XAML Code Snippets
------------------

 EnableAdvancedFiltering="True" AllowCompactLayout="True"
 AllowHeaderColumnsSorting="True" Margin="0,0,0,0" Padding="0"
 CellStyle="{StaticResource PivotCellStyle}"
 TotalColumnStyle="{StaticResource TotalColumnCellsStyle}"
 TotalRowStyle="{StaticResource TotalRowCellsStyle}"
 CellClicked="xpvgPivotGrid_CellClicked">
  
        AllowRowHeaderSelection="True" CellSelection="Single"
 CellSelectionAction="SelectRow" RowSelection="Single" />
       
           
               AllowMultipleColumnSorting="True"
   MultiSortingKey="Control" />
           
        
            
         
 

 
 Legend="{Binding ElementName=xdclLegend}"
 VerticalZoombarVisibility="Visible"
 VerticalZoomable="True"
 HorizontalZoombarVisibility="Visible"
 HorizontalZoomable="True">
 
          
               
                       HorizontalAlignment="Right" Margin="0,0,2,0" >
                   
               
           
              DataSource="{Binding ElementName=xpvgPivotGrid, Path=DataSource}"
  OlapAxisSource="Columns"
  DefaultSeries="ColumnSeries"  
  YAxis="{Binding ElementName=xmYAxis}"
  SeriesCreating="OlapXAxis_SeriesCreating"/>
 

 IsExpanded="False" Header="Data Chart Legend"
 ToolTip="Data chart legend " >
  HorizontalAlignment="Right" VerticalAlignment="Top"
 Margin="10,10,10,10" >
 
  
  
 

 

Program Code Behind
-------------------
Private Sub OlapXAxis_SeriesCreating(sender As Object,
 e As Infragistics.Controls.Charts.SeriesCreatingEventArgs)
 'handles the series creating event on the x axis of the xamdatachart
 ' create legend value tips for points on the data series 
 Me.CreateXSeriesTips(sender, e)
End Sub

Private Sub CreateXSeriesTips(sender As Object,
 e As Infragistics.Controls.Charts.SeriesCreatingEventArgs)
 Dim loTitleTB As System.Windows.Controls.TextBlock
 Dim loValueTB As System.Windows.Controls.TextBlock
 Dim loPanel As System.Windows.Controls.StackPanel
 Dim loSeriesBinding As System.Windows.Controls.Binding
 Dim loCellValueBinding As System.Windows.Controls.Binding
 loTitleTB = New System.Windows.Controls.TextBlock
 loValueTB = New System.Windows.Controls.TextBlock
 loPanel = New System.Windows.Controls.StackPanel
 loSeriesBinding = New Binding("Series.Title")
 loCellValueBinding = New Binding("Item.Cell.FormattedValue")
 loTitleTB.SetBinding(TextBlock.TextProperty, loSeriesBinding)
 loCellValueBinding.StringFormat = ": {0}"
 loValueTB.SetBinding(TextBlock.TextProperty, loCellValueBinding)
 loPanel.Orientation = Orientation.Horizontal
 loPanel.Children.Add(loTitleTB)
 loPanel.Children.Add(loValueTB)
 If TypeOf e.Series Is LineSeries OrElse TypeOf e.Series Is PointSeries _
  OrElse TypeOf e.Series Is StepLineSeries Then
  e.Series.MarkerType = MarkerType.Circle
 End If
 e.Series.ToolTip = loPanel
End Sub
Parents
  • 34810
    Offline posted

    Hello,

    I have been investigating into this issue, and I have created a sample project using version 16.2.20162.2045 and very much based on the sample code that you have provided. However, I am currently unable to reproduce this NullReferenceException that you are seeing on my end after hovering over the columns in the XamDataChart.

    I have attached the sample project I have used to test this issue. Please test this project on your machine, as its behavior may help to indicate the nature of this problem. If the project does not work correctly, this indicates either a problem possibly specific to your environment.

    If the project does show the product feature working correctly, this indicates a possible problem in the code of your application.  It will help if you can provide a small, isolated sample application that demonstrates the behavior you are seeing.

    Or, if this sample project is not an accurate demonstration of what you're trying to do, please feel free to modify it and send it back, or send a small sample project of your own if you have one. I have noticed that there are a couple of things that I am missing related to the XamPivotGrid related to styles and event handlers, but I am unsure what is happening in your application regarding those at the moment. It may also be helpful if you could provide a stack trace of the NullReferenceException you are seeing.

    Please let me know if you have any other questions or concerns on this matter.

    Sincerely,
    Andrew
    Associate Developer

    XamDataChartOlapPivotBug.zip
Reply Children