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
1105
Using LineChart.ErrorBarSettings.DataCaulculator on CategoryDateTimeXAxis
posted

Hello.

I have a chart with multiple LineSeries.

The chart contains CategoryDateTimeXAxis and a numeric axis for the Y value.

I need to display error bar with diferent height for each point by using the custom DataCalculator.

this is based on the samples application. when using a fixed calculator, the error bar is displayed as expected, but when using the custom data calculator - it will not. also when changing the x axis to category - it also works.

this is my xaml :

<ig:XamDataChart Grid.Row="1" x:Name="LineChart" Tag="LineChart" Margin="0,0,0,0"
                        HorizontalZoomable="True" 
                        VerticalZoomable="True" >
            <ig:XamDataChart.Axes>
                <ig:CategoryDateTimeXAxis x:Name="ctxAxis" 
                                  Label="{}{Date}" DateTimeMemberPath="Date" />
                <ig:NumericYAxis x:Name="nryAxis" MinimumValue="0" MaximumValue="140" />
            </ig:XamDataChart.Axes>
            <ig:XamDataChart.Series>
 
 
                <ig:LineSeries x:Name="LineSeries1" Thickness="1" MarkerType="Circle"  Visibility="Collapsed"
                              
                              ValueMemberPath="Value"
                              XAxis="{Binding ElementName=ctxAxis}"
                              YAxis="{Binding ElementName=nryAxis}" IsHighlightingEnabled="True" IsTransitionInEnabled="True">
                    <ig:LineSeries.ErrorBarSettings>
                        <ig:CategoryErrorBarSettings EnableErrorBars="Both" ErrorBarCapLength="10"
                                                    Stroke="Green" StrokeThickness="1">
                            <ig:CategoryErrorBarSettings.Calculator>
                                <ig:DataCalculator ValueMemberPath="ErrorBar">
                                    <ig:DataCalculator.ItemsSource>
                                        <local:ErrorBarDataSample />
                                    </ig:DataCalculator.ItemsSource>
                                </ig:DataCalculator>
                            </ig:CategoryErrorBarSettings.Calculator>
                        </ig:CategoryErrorBarSettings>
                    </ig:LineSeries.ErrorBarSettings>
                </ig:LineSeries>
            </ig:XamDataChart.Series>
        </ig:XamDataChart>

and this is the code behind :

/// <summary>
   /// Interaction logic for MainWindow.xaml
   /// </summary>
   public partial class MainWindow : Window
   {
       public MainWindow()
       {
           InitializeComponent();
           SimpleDataCollection sd = new SimpleDataCollection();
           LineSeries1.Visibility = System.Windows.Visibility.Visible;
           LineSeries1.ItemsSource = sd;
         //  ((DataCalculator)LineSeries1.ErrorBarSettings.Calculator).ItemsSource = sd;
           LineSeries1.ErrorBarSettings.Calculator = new FixedValueCalculator() { Value=5 };
           ctxAxis.ItemsSource = sd;
 
       }
   }
 
   public class SimpleDataCollection : ObservableCollection<SimpleDataPoint>
   {
       public SimpleDataCollection()
       {
           this.Add(new SimpleDataPoint() { Date = DateTime.Today.AddHours(1), Label = "1", Value = 13.0, ErrorBar = 1 });
           this.Add(new SimpleDataPoint() { Date = DateTime.Today.AddHours(2), Label = "2", Value = 12.0, ErrorBar = 1 });
           this.Add(new SimpleDataPoint() { Date = DateTime.Today.AddHours(3), Label = "3", Value = 13.0, ErrorBar = 11 });
           this.Add(new SimpleDataPoint() { Date = DateTime.Today.AddHours(4), Label = "4", Value = 14.0, ErrorBar = 21 });
           this.Add(new SimpleDataPoint() { Date = DateTime.Today.AddHours(5), Label = "5", Value = 15.0, ErrorBar = 31 });
           this.Add(new SimpleDataPoint() { Date = DateTime.Today.AddHours(6), Label = "6", Value = 16.0, ErrorBar = 41 });
           this.Add(new SimpleDataPoint() { Date = DateTime.Today.AddHours(7), Label = "7", Value = 15.0, ErrorBar = 51 });
       }
   }
   /// <summary>
   /// Simple storage class for pair of string and double value
   /// </summary>
   public class SimpleDataPoint
   {
       public double Value { getset; }
       public string Label { getset; }
       public int ErrorBar { getset; }
       public DateTime Date { getset; }
   }
 
 
   public class ErrorBarDataSample : ErrorBarDataCollection
   {
       public ErrorBarDataSample()
           : this(0.1)
       { }
       public ErrorBarDataSample(double variable)
       {
           int items = 100;
           double value = 0;
           for (int i = 0; i < items - 1; i++)
           {
               this.Add(new ErrorBarDataPoint { ErrorBar = i });
               if (i < (items / 2)) value += variable; else value -= variable;
           }
       }
   }
 
   public class ErrorBarDataCollection : ObservableCollection<ErrorBarDataPoint>
   { }
   public class ErrorBarDataPoint
   {
       public double ErrorBar { getset; }
   }


 

Parents
No Data
Reply
  • 34510
    Offline posted

    Hi eligazit,

    Thank you for bringing this to our attention.  I was able to reproduce this issue in the latest Infragistics builds and it seems we have some code that is not executing for CategoryDateTimeXAxis specifically which is necessary for the error bars to be calculated correctly.  As such I have logged a development issue so that our engineering staff may take a look at this.  The dev issue ID is 219439.  Also I have created a private support case for you so that you may track the status of this dev issue.  The case number is CAS-173301-B9R9Z0 and you can view it here.

Children
No Data