This is a migrated thread and some comments may be shown as answers.

Interactivity Effects for Collections of DataObjects

4 Answers 42 Views
Chart
This is a migrated thread and some comments may be shown as answers.
Jeff
Top achievements
Rank 1
Jeff asked on 02 Sep 2010, 05:32 PM

I'm using the chart control to display a List<ObservableCollection<ResultPoint>> where the ResultPoint object has two properties - Data and Time.  The list has three collections within it.

The following code (for one of the collections) displays the data correctly, but none of the interactivity effects seem to work. 

// Create the Series Mapping for the Voltage Data

SeriesMapping voltageSeriesMapping = new SeriesMapping();

voltageSeriesMapping.CollectionIndex = 0;

voltageSeriesMapping.LegendLabel = "Voltage";

voltageSeriesMapping.ItemMappings.Add(new ItemMapping("Time", DataPointMember.XValue));

voltageSeriesMapping.ItemMappings.Add(new ItemMapping("Data", DataPointMember.YValue));

 


// Create the Series Definition for the Voltage Data

voltageSeriesMapping.SeriesDefinition = new LineSeriesDefinition();

voltageSeriesMapping.SeriesDefinition.AxisName = "Voltage";

voltageSeriesMapping.SeriesDefinition.ShowItemLabels = false;

(voltageSeriesMapping.SeriesDefinition as LineSeriesDefinition).ShowPointMarks = false;

voltageSeriesMapping.SeriesDefinition.InteractivitySettings = new InteractivitySettings();

voltageSeriesMapping.SeriesDefinition.InteractivitySettings.HoverScope = InteractivityScope.Series;

voltageSeriesMapping.SeriesDefinition.InteractivitySettings.SelectionScope = InteractivityScope.Series;

voltageSeriesMapping.SeriesDefinition.InteractivitySettings.SelectionMode = ChartSelectionMode.Single;

 


By looking at an example provided on the forum, I’ve postulated that the interactivity effects only work when the data is a single data object (not a collection as I'm doing) with many properties.  Is this true or am I missing something?

BTW, I'm using a list of Observable objects because the data collections have different numbers of ResultPoints (some have several thousand data points and some have tens of points).

 

Thanks,

Jeff

4 Answers, 1 is accepted

Sort by
0
Velin
Telerik team
answered on 08 Sep 2010, 08:04 AM
Hi Jeff,

The interactivity effects do not depend on the type or number of data objects in use. You can find a working online example here. Please, note that the interactivity feature is not available for the WPF3.5 build of the control. Hope this will help.

Sincerely yours,
Ryan
the Telerik team
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 Public Issue Tracking system and vote to affect the priority of the items
0
Jeff
Top achievements
Rank 1
answered on 08 Sep 2010, 03:14 PM

My question was not about the number of point in the collection by but the number of collections used to generate the chart.  In one case I used a List of Observable objects to create a chart having three data series.  In this case the interactivity effects don’t appear to work.  However, if I change the input data format to be a single observable collection with multiple data columns, the interactivity effects appear to work.

So the question the question is; what am I missing to get the interactivity effects to work if my input data is a list of observable objects like this:

data = new List<ObservableCollection<ResultPoint>>();

 


instead of a single collection like this:

otherdata = ObservableCollection<OtherResultPoint>>()

 


In these snippets, the result point has two properties x and y and the OtherResultPoint has 5 properties, x, y1, y2, y3, y4.

Does that make more sense?

Jeff

0
Velin
Telerik team
answered on 10 Sep 2010, 04:56 PM
Hello Jeff,

The interactivity effects have nothing in common with the items source of the chart control. The feature is configured at SeriesDefinition level and should work once it is configured properly. Please, have a look at the code below:
public partial class MainWindow : Window
   {
       public MainWindow()
       {
           InitializeComponent();
 
           SeriesMapping sm1 = new SeriesMapping();
           sm1.ItemMappings.Add(new ItemMapping("Y", DataPointMember.YValue));
           SeriesDefinition definition1 = new AreaSeriesDefinition();
           sm1.CollectionIndex = 1;
           definition1.InteractivitySettings.HoverScope = InteractivityScope.Series;
           definition1.InteractivitySettings.SelectionScope = InteractivityScope.Series;
           sm1.SeriesDefinition = definition1;
           RadChart1.SeriesMappings.Add(sm1);
 
           SeriesMapping sm = new SeriesMapping();
           sm.ItemMappings.Add(new ItemMapping("Y", DataPointMember.YValue));
           SeriesDefinition definition = new LineSeriesDefinition();
           sm.CollectionIndex = 0;
           definition.InteractivitySettings.HoverScope = InteractivityScope.Series;
           definition.InteractivitySettings.SelectionScope = InteractivityScope.Series;
           sm.SeriesDefinition = definition;
           RadChart1.SeriesMappings.Add(sm);
 
           ObservableCollection<A> a1 = new ObservableCollection<A>(A.Get());
           ObservableCollection<A> a2 = new ObservableCollection<A>(A.Get());
 
           List<ObservableCollection<A>> l = new List<ObservableCollection<A>>() { a1, a2 };
 
           RadChart1.ItemsSource = l;
       }
   }
 
   public class A
   {
       public int Y { get; set; }
 
       public static IEnumerable<A> Get()
       {
           for (int i = 0; i < 5; i++)
           {
               yield return new A() { Y = i };
           }
       }
   }


Kind regards,
Ryan
the Telerik team
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 Public Issue Tracking system and vote to affect the priority of the items
0
Jeff
Top achievements
Rank 1
answered on 15 Sep 2010, 03:42 PM
After working on this a little more, I found that the problem had nothing to do with the chart control.  For so reason when I upgraded from the demo version to our purchased version, some of the .desgin files did not get updated so I had a version problem between the files.  Once I re-installed the purchased controls, everything worked fine.

Thanks for all the help

Jeff
Tags
Chart
Asked by
Jeff
Top achievements
Rank 1
Answers by
Velin
Telerik team
Jeff
Top achievements
Rank 1
Share this question
or