SciChart® the market leader in Fast WPF Charts, WPF 3D Charts, and iOS Chart & Android Chart Components

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.