how to plot multiple scatter spline lines in scatter splot in telerik:RadCartesianChart?

4 posts, 0 answers
  1. steven
    steven avatar
    32 posts
    Member since:
    Aug 2014

    Posted 15 Mar Link to this post

    There is a comment in  Example.xaml file which clearly summarizes what I am trying to.

    This file is included in the attach zip file.

    Iam having trouble finding and easy way to plot multiple scatter spline lines in a scattor plot.

    I am using version 4.5  telerick controls , and specifically the telerik:RadCartesianChart

    I gutted out the galley scatter example code in the terlerik examples wpf source project into a simple WPF project.

    The project in the example uses telerik:LinearAxis which requires a dependency objext and a half million other things that is needed in this project.

    The WPF project just retrieves the data from the same csv file and stores the data in the two same list in the corresponding viewmodel.

    public class ExampleViewModel : DataSourceViewModelBase

    {

     private IEnumerable<HourlyEarnings> _privateData;
            private IEnumerable<HourlyEarnings> _publicData;

     

    How can simply just databind these two lists in the view model to the chart in the xaml to produce to scatter spline lines in the chart.

    I have a attached the project.

    I spent days searching the web for a simple example and everything i found either requires some serviceprovider object that seem not to be for wpf apps, or just information that is worthless or code that does not compile or shown one line.

  2. steven
    steven avatar
    32 posts
    Member since:
    Aug 2014

    Posted 15 Mar in reply to steven Link to this post

    I forgot to attach the source code.

    I had to change to zip extension to png  to post the sour code.

    Change the extension to zip after downloading .

    The source code project was developed in visual studio 2015

  3. steven
    steven avatar
    32 posts
    Member since:
    Aug 2014

    Posted 15 Mar Link to this post

    you can email me direct at stevensrf@mail.com with any suggestion.

    And below is the Example.xaml code with the comment .

    <UserControl x:Class="ScatterWpfApp.ScatterPoint.Example"
                 xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                 xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
                 xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
                 xmlns:local="clr-namespace:ScatterWpfApp.ScatterPoint"
                 xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
                 mc:Ignorable="d" 
                 d:DesignHeight="300" d:DesignWidth="300">
        <UserControl.DataContext>
            <local:ExampleViewModel />
        </UserControl.DataContext>
        <Grid>
            <telerik:RadCartesianChart>
                <!--What do I put in here to data bind IEnumerable<HourlyEarnings> PrivateData and
                 IEnumerable<HourlyEarnings> PublicData iin the ExampleViewModel class to produce
                to scatter spline lines in a scatter chart-->
            </telerik:RadCartesianChart>       
        </Grid>
    </UserControl>

  4. steven
    steven avatar
    32 posts
    Member since:
    Aug 2014

    Posted 15 Mar in reply to steven Link to this post

    And yes I tired binding per enumerable list as show below that there a some exception wierd ass thrown in the telerik control at runtime

     

           <telerik:RadCartesianChart Name="RadCartesianChart">
                <!--What do I put in here to data bind IEnumerable<HourlyEarnings> PrivateData and
                 IEnumerable<HourlyEarnings> PublicData iin the ExampleViewModel class to produce
                to scatter spline lines in a scatter chart-->
                <telerik:RadCartesianChart.VerticalAxis>
                    <telerik:LinearAxis/>
                </telerik:RadCartesianChart.VerticalAxis>
                <telerik:RadCartesianChart.HorizontalAxis>
                    <telerik:LinearAxis/>
                </telerik:RadCartesianChart.HorizontalAxis>

                <!--This does not work. Why who knows. Binding like this at compile time throws some weird ass exception-->
                <telerik:ScatterSplineSeries ItemsSource="{Binding PublicData}" XValueBinding="XYal" YValueBinding="YVal">
                    
                </telerik:ScatterSplineSeries>
                <telerik:ScatterSplineSeries ItemsSource="{Binding PrivateData}" XValueBinding="XYal" YValueBinding="YVal">

                </telerik:ScatterSplineSeries>
            </telerik:RadCartesianChart>  

  5. steven
    steven avatar
    32 posts
    Member since:
    Aug 2014

    Posted 15 Mar in reply to steven Link to this post

    But this binding works

         <telerik:RadCartesianChart Name="RadCartesianChart">
                <!--What do I put in here to data bind IEnumerable<HourlyEarnings> PrivateData and
                 IEnumerable<HourlyEarnings> PublicData iin the ExampleViewModel class to produce
                to scatter spline lines in a scatter chart-->
                <telerik:RadCartesianChart.VerticalAxis>
                    <telerik:LinearAxis/>
                </telerik:RadCartesianChart.VerticalAxis>
                <telerik:RadCartesianChart.HorizontalAxis>
                    <telerik:LinearAxis/>
                </telerik:RadCartesianChart.HorizontalAxis>
                <telerik:ScatterSplineSeries ItemsSource="{Binding PublicData}" XValueBinding="Age" YValueBinding="Wage">
                    
                </telerik:ScatterSplineSeries>
                <telerik:ScatterSplineSeries ItemsSource="{Binding PrivateData}" XValueBinding="Age" YValueBinding="Wage">

                </telerik:ScatterSplineSeries>
            </telerik:RadCartesianChart>    

Back to Top