Pre loader

Tag: code behind

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 votes
4k views

We’re using ReactiveUI and bindings in code-behind. We’re now upgrading from SciChart v3 to v6 and we’re wondering how to use the SeriesBinding in code-behind like this:

public partial class BarChartView : ReactiveUserControl<sBarChartViewModel>
{
    public BarChartView()
    {
        InitializeComponent();

        this.WhenActivated(disposable =>
        {
            this.OneWayBind(ViewModel,
                            vm => vm.SeriesSource,
                            view => view.BarChart.SeriesSource)
                .DisposeWith(disposable);

            this.OneWayBind(ViewModel,
                            vm => vm.LabelProvider,
                            view => view.FaciesAxis.LabelProvider)
                .DisposeWith(disposable);

            this.OneWayBind(ViewModel,
                            vm => vm.TooltipDataContext,
                            view => view.TooltipModifier.TooltipLabelDataContextSelector)
                .DisposeWith(disposable);

            this.OneWayBind(ViewModel,
                            vm => vm.XAxisRange,
                            view => view.FaciesAxis.VisibleRange)
                .DisposeWith(disposable);
        });
    }
}

Now the IChartSeriesViewModel and SciChartSurface.SeriesSource is deprecated so we have to move to IRenderableSeriesViewModel instead and then bind to SciChartSurface.RenderableSeries. But how can we convert from IRenderableSeriesViewModel to IRenderableSeries here?

  • Tore Munch asked 3 years ago
  • last active 2 years ago
0 votes
5k views

Hi,
I am trying to create a new FastUniformHeatMap at runtime and bind it to a dataset, everything needs to be done in the code behind and I am not using MVVM.
I can create the HeatMap in the code behind with:

        SciChartSurface g2d = new SciChartSurface();
        FastUniformHeatmapRenderableSeries fuhrs = new FastUniformHeatmapRenderableSeries();
        HeatmapColorPalette hcp = new HeatmapColorPalette();
        NumericAxis xaxis = new NumericAxis();
        NumericAxis yaxis = new NumericAxis();
        g2d.RenderableSeries = new ObservableCollection<IRenderableSeries>() { fuhrs };
        g2d.XAxis = xaxis;
        g2d.YAxis = yaxis;

I can set the DataSeries with:

       g2d.RenderableSeries[0].DataSeries = myDataSeries;

(Where myDataSeries is a property returning a UniformHeatMapDataSeries object)

and I get my image, however, it is not bound to the property and if myDataSeries changes the image will not change.

How do I bind the DataSeries instead of just setting it, in this case?

I can make it work easily from the Xaml:

< sciChart:FastUniformHeatmapRenderableSeries DataSeries=”{Binding Path=myDataSeries, Mode=OneWay}” />

but I cannot figure out how to do it from the code behind.

0 votes
10k views

I’m trying to switch RolloverMarker template at runtime from code behind, with no luck.
I have ControlTemplate definitions in XAML.
I create FastLineRenderableSeries objects and assign RolloverTemplates to them dymanically in code behind.
I add the series into sciChartSurface.RenderableSeries.
All this works.

When user clicks a series, a selectionChanged eventHandler method tries to switch the RolloverMarkerTemplate of the selected series

ControlTemplate ylbl = (ControlTemplate)Application.Current.Resources["RolloverLabelTopTemplate"];
 flrseries.RolloverMarkerTemplate = ylbl;

The template object is created from Resources and assigned to the series, but the visible presentation is not changed.

Is there a better ( = working) way to do this or is it even possible ?

Showing 3 results

Try SciChart Today

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

Start TrialCase Studies