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
160
XamDataChart with multiple series
posted

Hello,

in our current project, I had to bind multiple series to a XamDataChart. So I ran into an issue, than when the series did not contain the same date time values an the same count of items, only the last series ist displayed. I am using the latest Infragistics 2012.2 Version .Net4.0 on Windows 7.

A short sample:

 public partial class MainWindow : Window
    {
        public List<Data> Series1 = new List<Data>();
        public List<Data> Series2 = new List<Data>();
 
        public MainWindow()
        {
            Series1.Add(new Data { Date = new DateTime(2012, 1, 1), Value = 1 });
            Series1.Add(new Data { Date = new DateTime(2012, 1, 3), Value = 4 });
            Series1.Add(new Data { Date = new DateTime(2012, 1, 5), Value = 9 });
            Series1.Add(new Data { Date = new DateTime(2012, 1, 7), Value = 16 });
 
            Series2.Add(new Data { Date = new DateTime(2012, 1, 2), Value = 4 });
            Series2.Add(new Data { Date = new DateTime(2012, 1, 4), Value = 2 });
            Series2.Add(new Data { Date = new DateTime(2012, 1, 6), Value = 1 });
 
            InitializeComponent();        
 
        }
 
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            xamDataChart.Series[0].DataContext = Series1;
            xamDataChart.Series[1].DataContext = Series2;
 
            xamDataChart.Axes[0].DataContext = Series1;
        }
    }

XAML:

<ig:XamDataChart HorizontalAlignment="Left" Name="xamDataChart" VerticalAlignment="Top" Height="445" Width="606" Margin="12,-4,0,0">
            <ig:XamDataChart.Series>
                <ig:LineSeries Title="L1"
                               XAxis="{Binding ElementName=xAxis}"
                               YAxis="{Binding ElementName=yAxis}"
                               ValueMemberPath="Value" Thickness="1"
                               ItemsSource="{Binding}"                               
                               MarkerType="Diamond"
                               />
                <ig:LineSeries Title="L2"
                               XAxis="{Binding ElementName=xAxis}"
                               YAxis="{Binding ElementName=yAxis}"
                               ValueMemberPath="Value" Thickness="1"
                               ItemsSource="{Binding}"
                               MarkerType="Circle"
                               />
            </ig:XamDataChart.Series>
            <ig:XamDataChart.Axes>
                <ig:CategoryDateTimeXAxis x:Name="xAxis" ItemsSource="{Binding}"
                                           Label="{}{0:dd.MM hh:mm}" DateTimeMemberPath="Date">
                    <ig:CategoryDateTimeXAxis.LabelSettings>
                        <ig:AxisLabelSettings Location="InsideBottom"></ig:AxisLabelSettings>
                    </ig:CategoryDateTimeXAxis.LabelSettings>
                </ig:CategoryDateTimeXAxis>
             
                <ig:NumericYAxis x:Name="yAxis">
                    <ig:NumericYAxis.LabelSettings>
                        <ig:AxisLabelSettings Location="OutsideLeft" Extent="50" VerticalAlignment="Center" Visibility="Visible" />
                    </ig:NumericYAxis.LabelSettings>
                </ig:NumericYAxis>
            </ig:XamDataChart.Axes>
        </ig:XamDataChart>

 

Only Series1 ist displayed. Is there a bug fix? Thanks in advance.

Ansgar