Pre loader

How to bind graph series to scrollviewer content

Welcome to the SciChart Forums!

  • Please read our Question Asking Guidelines for how to format a good question
  • Some reputation is required to post answers. Get up-voted to avoid the spam filter!
  • We welcome community answers and upvotes. Every Q&A improves SciChart for everyone

WPF Forums | JavaScript Forums | Android Forums | iOS Forums

0
0

Dear all,

I have open the DragHorizontalThreshold sample where I need to display at the bottom a scrollvier content bind to graph series.

For that I have the following xaml sample code :

 <s:SciChartSurface x:Name="**sciChart**"
                       Grid.Column="1"
                       BorderThickness="0"
                       Padding="0"
                       ViewportManager="{Binding ViewportManager,
                                                 Mode=OneWay,
                                                 FallbackValue={StaticResource DefaultViewportManager}}">

        <s:SciChartSurface.RenderableSeries>
            <s:FastColumnRenderableSeries DataPointWidth="1" 
                                          **DataSeries="{Binding ColumnDataSeries}"**
                                          PaletteProvider="{Binding ThresholdPaletteProvider}" />
        </s:SciChartSurface.RenderableSeries>

        <s:SciChartSurface.XAxis>
            <s:NumericAxis AxisAlignment="{Binding ElementName=cboXAxisAlignment,
                                                   Path=SelectedItem}"
                           x:Name="XAxis"
                           DrawMajorBands="True"
                           VisibleRange="0.0, 10.0" />
        </s:SciChartSurface.XAxis>

        <s:SciChartSurface.YAxis>
            <s:NumericAxis AxisAlignment="{Binding ElementName=cboYAxisAlignment,
                                                   Path=SelectedItem}"
                           DrawMajorBands="True"
                           VisibleRange="-1.0, 1.0" />
        </s:SciChartSurface.YAxis>

        <s:SciChartSurface.Annotations>
            <s:HorizontalLineAnnotation HorizontalAlignment="Stretch"
                                        FontSize="13"
                                        FontWeight="Bold"
                                        Foreground="White"
                                        IsEditable="True"
                                        LabelPlacement="Axis"
                                        LabelTextFormatting="0.00"
                                        ShowLabel="True"
                                        Stroke="#FF42b649"
                                        StrokeThickness="2"
                                        Y1="{Binding Threshold,
                                                     Mode=TwoWay,
                                                     FallbackValue=0.5}" />
        </s:SciChartSurface.Annotations>

        <s:SciChartSurface.ChartModifier>
            <s:LegendModifier Margin="10"
                              LegendTemplate="{StaticResource LegendTemplate}"
                              ShowLegend="True" />
        </s:SciChartSurface.ChartModifier>
    </s:SciChartSurface>
    <!--  Define the SciChartSurface behind the scrollbar  -->
    <s:SciChartSurface x:Name="**OverviewSurface**" Grid.Column="0" Loaded="OnOverviewSurfaceLoaded" RenderableSeries="{ s:SeriesBinding ColumnDataSeries}">

        <s:SciChartSurface.XAxis>
            <s:NumericAxis DrawMajorGridLines="False" DrawMinorGridLines="False" Visibility="Collapsed"/>
        </s:SciChartSurface.XAxis>

        <s:SciChartSurface.YAxis>

            <s:NumericAxis DrawMajorGridLines="False" DrawMinorGridLines="False" Visibility="Collapsed"/>
        </s:SciChartSurface.YAxis>

    </s:SciChartSurface>

    <s:SciChartScrollbar Grid.Column="1" Height="100" Margin="{Binding ElementName=sciChart, Path=Padding, Mode=OneWay}" Axis="{Binding ElementName=XAxis}"/>

My main chart which is called sciChart, is using s:FastColumnRenderableSeries which is bind to ColumnDataSeries.
Then I have an other chart named OverviewSurface, which used to display the overview of main graph.

The problem I have have is to find out the correct binding syntax to bind it to my main chart ColumnDataSeries.

If I use the syntax RenderableSeries=”{ s:SeriesBinding ColumnDataSeries}”, as in my exemple I get an exception on the binding.

How the binding should be define here ?

Thanks for help

regards

Version
4
  • Andrew Burnett-Thompson
    what is the exception message?
  • sc sc
    here is the exception I get at application start: Dear Support, I was running the SciChart v4.2.5.10565 examples and saw this Unhandled Exception. Can you help? Thank you! ArgumentException: The SciChart.Charting.Model.DataSeries.XyDataSeries`2[System.Double,System.Double] argument value must implement IEnumerable ——————————————- Stack Trace: at SciChart.Charting.Common.Databinding.ToRenderableSeriesCollectionConverter.Convert(Object value, Type targetType, Object parameter, CultureInfo culture) at System.Windows.Data.BindingExpression.TransferValue(Object newValue, Boolean isASubPropertyChange) at System.Windows.Data.BindingExpression.Activate(Object item) at System.Windows.Data.BindingExpression.AttachToContext(AttachAttempt attempt) at System.Windows.Data.BindingExpression.MS.Internal.Data.IDataBindEngineClient.AttachToContext(Boolean lastChance) at MS.Internal.Data.DataBindEngine.Task.Run(Boolean lastChance) at MS.Internal.Data.DataBindEngine.Run(Object arg) at System.Windows.ContextLayoutManager.fireLayoutUpdateEvent() at System.Windows.ContextLayoutManager.UpdateLayout() at System.Windows.Interop.HwndSource.SetLayoutSize() at System.Windows.Interop.HwndSource.set_RootVisualInternal(Visual value) at System.Windows.Window.SetRootVisual() at System.Windows.Window.SetRootVisualAndUpdateSTC() at System.Windows.Window.SetupInitialState(Double requestedTop, Double requestedLeft, Double requestedWidth, Double requestedHeight) at System.Windows.Window.CreateSourceWindow(Boolean duringShow) at System.Windows.Window.ShowHelper(Object booleanBox) at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs) at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
  • You must to post comments
0
0

My guess is (without seeing the code in your ViewModel) that you are binding from Xaml to a single XyDataSeries,e.g.

XAML

     SciChartSurface RenderableSeries=”{ s:SeriesBinding ColumnDataSeries}”/>

ViewModel

public XyDataSeries<double,double> ColumnDataSeries { get ; }

Correct me if I’m wrong, I’m going off limited information …

SeriesBinding should bind to an ObservableCollection or List of IRenderableSeriesViewModel. Check out our documentation and examples which show how to use this API correctly.

Best regards,
Andrew

  • sc sc
    correct . thks
  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.

Try SciChart Today

Start a trial and discover why we are the choice
of demanding developers worldwide

Start TrialCase Studies