Dynamically adding and removing data poitns from a scatter series

2 posts, 1 answers
  1. Jason
    Jason avatar
    6 posts
    Member since:
    Jul 2016

    Posted 25 Jul Link to this post

    I was hoping on just using "this.chart.DataContext = { ... };" to refresh the data in my chart, however, I'm running into two issues with this:

    1. Data only displays in the chart if the x-axis is categorical

    2. I'm using up to 2048 data points and a categorical x-axis makes the tick marks illegible.

     

    Unless there's a way to make the categorical axis to only display every hundredth tick mark, it looks like I'm forced into using linear axis for both the horizontal and vertical.

     

    In referencing the newly released examples, the chart is bound to the "Source" collection in the separate ViewModelScatterSeries class. What would be the easiest way to update this information?

    Using a different charting tool, I would create a new Observable collection, populate it, then assign it as the new item source. Is it possible to do this with the RadCartesian chart?

  2. Answer
    Lance | Tech Support Engineer, Sr.
    Admin
    Lance | Tech Support Engineer, Sr. avatar
    137 posts

    Posted 26 Jul Link to this post

    Hello Jason,

    Can you share the model for your data points, a small sample of what your data looks like and summarize what you want the outcome to be (a mockup would be best)? With this I'll be able to better suggest what axes to use that would visualize your data the best.

    Regarding the updating of the Charts' data source, you can indeed bind/set an ObservableCollection to the ScatterSeries.ItemsSource property and update the ObservableCollection directly. The ScatterSeries will render any changes to the ObservableCollection's items.

    Note that if you replace the ObservableColleciton entirely, make sure you have PropertyChanged implemented. For example:

    private ObservableCollection<T> chartData;
     
    public ObservableCollection<T> ChartData
    {
         get { return chartData ?? ( chartData = new ObservableCollection<T>()); }
         set { chartData= value; OnPropertyChanged();}
    }


    Regards,
    Lance | Tech Support Engineer, Sr.
    Telerik by Progress
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  3. DevCraft banner
Back to Top