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 Reply Children