I have read up the guide on getting SciChart to render chart to memory on the support forums. However, the example there uses FastLineRenderableSeries
whereas in my project, I am using IRenderableSeriesViewModel
with series binding in XAML using ObservableCollection<IRenderableSeriesViewModel>
.
When I try to follow the guide at SciChart Knowledgebase, it uses FastLineRenderableSeries
as RenderableSeries
, and it doesn't work when I try to assign my pre-existing ObservableCollection<IRenderableSeriesViewModel>
to RenderableSeries
property under SciChartSurface
.
I'd like to know if I could simply just use my existing ObservableCollection<IRenderableSeriesViewModel>
when I am trying to export my existing plots to bitmap memory. I could just extract the DataSeries
again from the IRenderableSeriesViewModel
but if there is a faster way to do this, it would be great to know.
Thank you.
EDIT: I am trying to do the export this way, as seen in the Knowledgebase.
My ViewModel currently has this:
private ObservableCollection<IRenderableSeriesViewModel> seriesViewModels =
new ObservableCollection<IRenderableSeriesViewModel>();
public ObservableCollection<IRenderableSeriesViewModel> SeriesViewModels
{
get
{
return this.seriesViewModels;
}
}
And as seen in the Knowledgebase,
var series = new FastLineRenderableSeries()
{
SeriesColor = Colors.Red,
DataSeries = GetDataSeries()
};
var surface = new SciChartSurface()
{
ChartTitle = "Rendered In Memory",
XAxes = xAxes,
YAxes = yAxes,
// Here, if I try to use "RenderableSeries = seriesViewModels" it doesn't work.
RenderableSeries = new ObservableCollection() { series }
};
surface.Width = 1000;
surface.Height = 1000;
// Export to bitmap
var bitmapSource = surface.ExportToBitmapSource();
Visual studio will show this error message:
Cannot implicitly convert type Cannot implicitly convert type > System.Collections.ObjectModel.ObservableCollection
<SciChart.Charting.Model.ChartSeries.IRenderableSeriesViewModel>
to System.Collections.ObjectModel.ObservableCollection<SciChart.Charting.Visuals.RenderableSeries.IRenderableSeries>
Would you have any suggestion regarding the relation between IRenderableSeries
and IRenderableSeriesViewModel
?