Pre loader

Binding to DataSeries in XAML

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

I’m trying to build an entire chart in XAML but I’m unsure how I would bind to DataSeries.

For example…

<sci:SciChartSurface>

        <sci:SciChartSurface.XAxis>
            <sci:NumericAxis />
        </sci:SciChartSurface.XAxis>

        <sci:SciChartSurface.YAxis>
            <sci:NumericAxis />
        </sci:SciChartSurface.YAxis>

        <sci:SciChartSurface.RenderableSeries>
            <sci:FastImpulseRenderableSeries>

                <sci:FastImpulseRenderableSeries.DataSeries>

                    <!-- Completely made up "DataSeries" XAML tag, but this is the general idea of what I'm wanting to do -->

                    <DataSeries X="0" Y="{Binding Path=MyObject1.Value}" />
                    <DataSeries X="1" Y="{Binding Path=MyObject2.Value}" />
                    <DataSeries X="2" Y="{Binding Path=MyObject3.Value}" />
                    <DataSeries X="3" Y="{Binding Path=MyObject4.Value}" />

                </sci:FastImpulseRenderableSeries.DataSeries>

            </sci:FastImpulseRenderableSeries>
        </sci:SciChartSurface.RenderableSeries>

    </sci:SciChartSurface>

Is it possible to do something along those lines?

If something along those lines were possible I could probably even build out a DataTemplate to just generate the “DataSeries” tags.

Thanks!

Version
6.0.2.13028
  • You must to post comments
1
0

Hi Greg,

One Renderableseries has one DataSeries, so the binding must like this:

    <sci:SciChartSurface.RenderableSeries>
        <sci:FastImpulseRenderableSeries DataSeries="{Binding Path=ADataSeriesInYourViewModel}}>
        </sci:FastImpulseRenderableSeries>
    </sci:SciChartSurface.RenderableSeries>

It’s not possible to build the X,Y values in XAML for a dataseries, as DataSeries is not a DependencyObject and must be declared entirely in code behind or in your ViewModel, but you could if you wanted to write an attached property to do a custom action such as build a DataSeries.

More on attached properties can be found at the microsoft documentation here:
https://docs.microsoft.com/en-us/dotnet/framework/wpf/advanced/attached-properties-overview

Best regards,
Andrew

  • 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