Hi,
I am using a MVVM pattern with wpf, I am exploring a XamReportViewer but can't find any sample on "How to bind Data with chart in Report" .
Kindly looking forward for any samples/tutorial or details
You can bind the data in your view model to your report using the DataSources collection of the ClientRenderSettings. Check this document for sample code of how to bind a data sources through the viewer API.
Essentially what you need to do is:
(1) Create a report, define a data source (let’s call it ChartDS) and associate it to the chart you want to render.
(2) In your App, add the XamReportViewer and configure it to render the report you have created
(3) Configure the DataSources property to bind ChartDS to data in your view model. E.g.
<ig:XamReportViewer>
<ig:XamReportViewer.RenderSettings>
<ig:ClientRenderSettings DefinitionUri="MyApp;component/Report.igr, MyApp" >
<ig:ClientRenderSettings.DataSources>
<ig:DataSource TargetDataSource="ChartDS" ItemsSource="{Binding chartData}" />
</ig:ClientRenderSettings.DataSources>
</ig:ClientRenderSettings>
</ig:XamReportViewer>
Assuming that “chartData” is a property in your view model.
You can check these two documents (one and two) for how to work with Charts.
Does this answer your question?
Best,
Leo
Thanks , Its really helpful
i want to ask you one more thing, after exporting my chart to excel file, can I change the bar chart (it seems a snap after export in excel file ), Basically i need to analyse my chart on different value. (like if we use charts feature in excel, after drawing a chart we can still change the value and analyse the chart on different input ).
Hope the above explanation my requirement.
Is we have this type of any provision in IG-Reporting.
Thanks,
Kashif Mujeeb
Right now the chart is exported as an image, so you will not be able to do that. I will make sure being able to export the chart as an actual Excel chart is in our backlog so implement it for a future version.