Hi, I'm using DataPresenter in my WPF application. In that same application i'm using xamlChart. I passing the same dataview to both the controls as datasourceWhen the user did the filter in xamldatapresenter, how to get that filtered data and refresh the xamlchart in the application. Can i get the filtered data in RecordFilterChanged or Changing event ? If yes can you provide the sample code for that . Thanks in advance
Hello,
I have been looking into your requirement and the XamDataGrid has exposed methods just for that, that you can use right away:
xamDataGrid1.RecordManager.GetFilteredInDataRecords();
xamDataGrid1.RecordManager.GetFilteredOutDataRecords();
I suppose you are going to need the Records’ underlying data class objects in order to use in the chart. You can get them by casting the Record class to DataRecord and access its DataItem property.
Please let me know if you require any further assistance on the matter.
Sincerely,
Petar Monov
Developer Support Engineer
Infragistics Bulgaria
www.infragistics.com/support
Thanks Peter,
Can i get the filtered data in dataview in RecordFilterChanged event ? Can you give a example regarding the filtered data in data view in RecordFilterChanged ?
Thanks
I ended up using GetFilteredInDataRecords(). It's working for me now. Thanks.
I am just checking the progress of this issue and was wondering if you managed to achieve your goal or if you need any further assistance on the matter.
If the above suggestion helped you solve your issue please verify the thread as answered so other users may take better advantage of it.
Sincerely,Petar MonovDeveloper Support EngineerInfragistics Bulgariawww.infragistics.com/support
Hi,
I have been looking into your issue and I actually couldn’t find any reference that the XamDataChart is meant to work with DataViews, however here is link from our online documentation describing what data types the XamDataChart can map to: http://help.infragistics.com/Help/NetAdvantage/WPFDV/2010.3/CLR4.0/html/Resources_DataTypeModels.html . Please let me know if you have seen any reference regarding such functionality.
Regarding your second question: If you try out my suggestion you will see that the GetFiltered methods return, as I previously said, an IEnumerable<DataRecord> so if you want to use a different collection you will have to cast it yourself. E.g. you have populated your XamDataGrid with data items of type Person you can get easily do this:
IEnumerable<Person> filtered = xamDataGrid1.RecordManager.GetFilteredInDataRecords().Select(record => record.DataItem as Person);
after which you can easily create an ObservableCollection<Person> out of that.
Regarding your third question I know what you mean, this will fire on every click, however since the XamDataChart is meant for displaying huge amounts of data, its Markers have intentionally been modified to be irresponsive to many events in order to keep up performance. Using the XamDataChart’s MouseLeftButtonDown even seems to be your best option at the moment.
Please let me know if you require any further clarification on the matter.
Peter ,
I need some help regarding the binding data to the chart. I'm using xamdatachart(scatter series) binding to dataview and binding xaxis xmemberpath and ymemberpath to the fields. how come its not working that way.
Then i tried to use the obervablecollection using a x,y values in theat class and passing to that . its working fine.
my question why can't i pass the sql data view bind to xamdatachart, is there any limitation.
My second question is you answer to me about the filtering datagrid and then pass the filtered to the xamdatachart. If i understood correctly , I will receive the oberservable collection from the filter method . can i pass that collection directly to the xamdatachart . do i need to convert to any data type for binding to the xamdatachart.
My Third question is you answer my question in another support activity. regarding the chart control interactivity.
In order to get the data behind the DataPoin on a mouse click you can handle the XamDataChart's MouseLeftButtonDown event like so:
private
void xamDataChart1_MouseLeftButtonDown(object sender, MouseButtonEventArgs e){Marker marker= Utilities.GetAncestorFromType(e.OriginalSource as DependencyObject, typeof(Marker), false) as Marker;if (marker != null){var data = ((e.OriginalSource as FrameworkElement).DataContext as infragistics.Controls.Charts.DataContext).Item;
THis event fires for every click on the chart. i need to fire a event for data point click on scatter series chart . i tested your code that you send, every time the marker is null. i need to debug more with your code.
I appreciate your help peter, we bought the infragistics control last few months back, thats why lot of question regardint the binding and simple question.
I attached the xaml that i'm using for chart control and c# binding
quoteChart.DataContext = d; chartScatterSeries.XMemberPath = xAxis1; chartScatterSeries.YMemberPath = yAxis1;
d is the sql dataview. xaxis1 and yaxis1 are the string with the field names.
Thanks for you help