What is a RenderableSeries and what is a DataSeries
Posted by Admin - on 08 April 2014 06:01 PM
|
|
Q: What is a RenderableSeries?The RenderableSeries in SciChart are visual representations of X-Y numeric, or date data. Some RenderableSeries render simple X-Y values (2D points in space), while some render additional information (such as X-Y0-Y1 values, or X-Y-Z values). RenderableSeries are defined in XAML (or in code) in the SciChartSurface.RenderableSeries collection. This collection supports multiple RenderableSeries of differing types. Each RenderableSeries is rendered to the screen, from data from an associated DataSeries. <s:SciChartSurface s:ThemeManager.Theme="BlackSteel"> <!-- Create Renderable Series, which bind to DataSeries --> <s:SciChartSurface.RenderableSeries> <!-- It is possible to have N RenderableSeries bound to the same DataSeries --> <!-- and toggle their visibility --> <s:FastCandlestickRenderableSeries DataSeries="{Binding PriceData}" /> <s:FastOhlcRenderableSeries DataSeries="{Binding PriceData}" /> <s:FastMountainRenderableSeries DataSeries="{Binding PriceData}" /> <s:FastLineRenderableSeries DataSeries="{Binding PriceData}" /> <s:FastColumnRenderableSeries DataSeries="{Binding PriceData}" /> <!-- Or, it is possible to bind each RenderableSeries to a DataSeries separately --> <s:FastLineRenderableSeries DataSeries="{Binding Sma50Series}" /> <s:FastLineRenderableSeries DataSeries="{Binding Sma200Series}" /> </s:SciChartSurface.RenderableSeries> <s:SciChartSurface> Some Notes on RenderableSeries and WPF Standard FeaturesRenderableSeries are derived from the WPF ContentControl and such can be styled, themed, however they are not truly visual UIElements in the sense that WPF visuals are. The RenderableSeries are included in the Visual Tree so that styling and RelativeSource binding works, however they are not rendered using the WPF composition engine. Instead, SciChart uses an alternate, Raster (bitmap) rendering engine to draw the RenderableSeries as quickly as possible. The alternate rendering engine means some WPF concepts we are used to no longer apply, however, the designers of the SciChart API have done their best to ensure that as many intuitive concepts as possible carry over from vanilla WPF to SciChart. Q: What is a DataSeries?SciChart separates out the data from the presentation by providing RenderableSeries and DataSeries. The DataSeries are optimized data structures that hold the arrays you are going to draw in SciChart. For instance, in our Create a Simple Line Chart example, the code to append to a DataSeries and assign to a RenderableSeries is like this: LineChartExampleView.xaml <s:SciChartSurface Name="sciChart" Grid.Row="1" s:ThemeManager.Theme="Oscilloscope"> <!-- Declare RenderableSeries --> <s:SciChartSurface.RenderableSeries> <s:FastLineRenderableSeries x:Name="lineRenderSeries" SeriesColor="#FF99EE99" StrokeThickness="2" /> </s:SciChartSurface.RenderableSeries> <!-- Create an X Axis --> <s:SciChartSurface.XAxis> <s:NumericAxis /> </s:SciChartSurface.XAxis> <!-- Create a Y Axis --> <s:SciChartSurface.YAxis> <s:NumericAxis /> </s:SciChartSurface.YAxis> </s:SciChartSurface> LineChartExampleView.xaml.cs public partial class LineChartExampleView : UserControl { public LineChartExampleView() { InitializeComponent(); } private void LineChartExampleView_OnLoaded(object sender, RoutedEventArgs e) { // Create a DataSeries of type X=double, Y=double var dataSeries = new XyDataSeries<double, double>(); lineRenderSeries.DataSeries = dataSeries; var data = DataManager.Instance.GetFourierSeries(1.0, 0.1); // Append data to series. SciChart automatically redraws dataSeries.Append(data.XData, data.YData); sciChart.ZoomExtents(); } } Q: Why do we require that you use DataSeries?Many WPF charts allow you to bind your chart to any data, for instance, an IEnumerable, or ObservableCollection. This is great for flexibility but not so great for speed! Our DataSeries are highly optimized data-structures for indexing, searching and iterating over data, enabling SciChart to achieve its record performance! | |
|