We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Chart is displaying the same data twice.

We have a very involved data collection system.  Our main data source is an object that holds 2 kinds of data.  The first is an ObservableCollection of raw data objects.  The second is an array of ObservableCollections each holding filtered data objects. Some striped down code should help explain.

ObservableCollection<rawData> _rawData = new ObservableCollection<rawData>();

TsDataSourceFltrd [] _fltrdDataAry = new fltrdData [10];

 

Our main data source object has properties to expose both the raw data and each of the filtered data objects.  We are trying to figure out how to chart this data using the XDateTime value from the rawData object as the X value and some other value from the filtered data as the Y value.  For testing everything is held inside of a Tab control with its data context set. DataContext="{StaticResource MainDS}"

 

This is what we have so far.  Below is the code and a screen shot (see ListBox.jpg file) of our data bound into list boxes and is used as a reference and for verification.

<DockPanel Margin="0" Name="dockPanel1" >

    <ListBox Name="listBox1" ItemsSource="{Binding Path=RawData}" DockPanel.Dock="Left" Width="200" HorizontalAlignment="Left">

        <ListBox.ItemTemplate>

            <DataTemplate>

                <StackPanel Orientation="Horizontal">

                    <TextBlock Text="{Binding Path=XDateTime}" />

                    <TextBlock Text="   " />

                    <TextBlock Text="{Binding Path=Value1}" />

                </StackPanel>

            </DataTemplate>

        </ListBox.ItemTemplate>

    </ListBox>

    <ListBox Name="listBox2" ItemsSource="{Binding Path=FltrdData01}" DockPanel.Dock="Left" Width="100" HorizontalAlignment="Left">

        <ListBox.ItemTemplate>

            <DataTemplate>

                <StackPanel Orientation="Horizontal">

                    <TextBlock Text="{Binding Path= Value2}" />

                </StackPanel>

            </DataTemplate>

        </ListBox.ItemTemplate>

    </ListBox>

</DockPanel>

 

You can see in the ListBox.jpg image that everything looks good here.  Our data processing engine is working and we are getting the correct raw and filtered data.

Now the chart.

 <sf:Chart Name="chart1" >

    <sf:ChartArea ZoomInCoefficient="0.5" ZoomOutCoefficient="2" Foreground="White" Background="Gray" EnableMouseDragZooming="True">

        <!--Primary Axis(X)-->

        <sf:ChartArea.PrimaryAxis>

            <sf:ChartAxis Name="Xaxis" EdgeLabelsDrawingMode="Shift" LabelFontSize="11" Header="Time" IsAutoSetRange="True" LabelDateTimeFormat="HH:mm" ValueType="DateTime" />

        </sf:ChartArea.PrimaryAxis>

        <!--Secondary Axis(Y)-->

        <sf:ChartArea.SecondaryAxis>

            <sf:ChartAxis Name="Yaxis" LabelFontSize="11" Header="Middle Price" Interval="1" MinimumInterval="0.25" OpposedPosition="True" />

        </sf:ChartArea.SecondaryAxis>

 

        <sf:ChartSeries Name="Value1" Label="Value 1" Type="Line" BindingPathX="XDateTime" BindingPathsY="Value1"

                        DataSource="{Binding RawData, diagnostics:PresentationTraceSources.TraceLevel=High}" Interior="BurlyWood" StrokeThickness="4"/>

 

        <sf:ChartSeries Name=" Value2" Label=" Value 2" Type="Line" BindingPathX="XDateTime" BindingPathsY=" Value2"

                        DataSource="{Binding FltrdData01, diagnostics:PresentationTraceSources.TraceLevel=High}" Interior="Blue" />

 

    </sf:ChartArea>

</sf:Chart>

 

When run we have both plots on top of each other, but when we are in VS2010 design mode the series plot correctly (sometimes).  See the Chart Bad and Chart Good .jpg images.

We believe that the issue is with our attempt to use the BindingPathX="XDataTime" value from the RawData object when plotting the filtered data from one of the FltrdDataXX sources.  See the red highlight in the above code.

Any assistance in getting this working will be greatly appreciated.

it kunj



Screen Shots_321633a7.rar

1 Reply

KV Karthikeyan V Syncfusion Team December 12, 2012 11:27 AM UTC

Dear Customer,

 

Thanks for using Syncfusion products.

We are analyzed the reported issue. We are unable to access the one series data source object to another series. Because each series have a separate data source. For your verification see your list box example. It gives the two separate item source of each list boxes and accessing the object of each separate collection. So as the same behavior of the chart series. We are created a sample based on this. Please find the sample in the following link below.

 

Please let us know, if you have any concerns

 

Regards,

Karthikeyan V.



sample_dc56b2e4.zip

Loader.
Live Chat Icon For mobile
Up arrow icon