Pre loader

Tag: Binding error

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

1 vote
4k views

Try to integrate new SciChart.xcframework 4.2.0 instead of SciChart.framework 2.0 to the project and build failed in Xcode 12.4 with the next errors:
RNSciCandlestickChart.swift:
1) 335th line: Editor placeholder in source file
dates.add(date!))
2) 549th line: Cannot convert value of type ‘Bundle.Type’ to expected argument type ‘Bundle’ SCIThemeManager.addTheme(byThemeKey: theme, from: Bundle)
3) 768th line: Method does not override any method from its superclass
override func internalHandleGesture(_ gestureRecognizer: UIGestureRecognizer)
AnnotationDragListener.swift:
1) 4th line: Cannot find type ‘SCIAnnotationDragListener’ in scope
class AnnotationDragListener: SCIAnnotationDragListener
RNSciLineChart.swift:
1) 475th line: Editor placeholder in source file
SCIThemeManager.addTheme(byThemeKey: theme, from: Bundle)
Can you tell me please can I launch SciChart.xcframework 4.2.0 in Xcode 12.4? Any how to solve this issues?

0 votes
8k views

We have a SciChartSurface that displays data, and includes a collection of threshold lines that can be modified by the user by dragging.
To accomplish this, we are using a class that inherits from ChartModifierBase that includes an attached property for binding an IEnumerable:

public static readonly DependencyProperty ThresholdsSourceProperty =
    DependencyProperty.Register
    (
        "ThresholdsSource",
        typeof(IEnumerable),
        typeof(CustomThresholdModifier),
        new PropertyMetadata(null, OnThresholdsSourceChanged)
     );

public IEnumerable ThresholdsSource
{
    get { return (IEnumerable)GetValue(ThresholdsSourceProperty); }
    set { SetValue(ThresholdsSourceProperty, value); }
}

The property includes a callback method (OnThresholdsSourceChanged) which is used to populate the Annotations collection of the parent SciChartSurface:

private static void OnThresholdsSourceChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
    var thresholdAnnotationModifier = d as CustomThresholdModifier;
    if (thresholdAnnotationModifier != null)
    {
        var newValue = e.NewValue as IEnumerable;
        if (newValue == null) return;

        thresholdAnnotationModifier.RebuildAnnotations();
    }
}

private void RebuildAnnotations()
{
    if ((ParentSurface == null) || (ThresholdsSource == null)) return;

    var annotationCollection = ParentSurface.Annotations;
    annotationCollection.Clear();

    foreach (IThresholdViewModel item in ThresholdsSource)
    {
        var threshold = new CustomHorizontalLineAnnotation{ DataContext = item };
        annotationCollection.Add(threshold);
    }
}

When this code is run, a binding exception occurs, but not until all of the code is successful. The exception:

System.Windows.Data Error: 2 : Cannot find governing FrameworkElement
or FrameworkContentElement for target element.
BindingExpression:Path=RotationAngle; DataItem=null; target element is
‘RotateTransform’ (HashCode=28139356); target property is ‘Angle’
(type ‘Double’)

The exception is clearly thrown downstream by some WPF thread, or I’d be able to wrap a try/catch around this and have better details.

If I comment out the line that creates the CustomHorizontalLineAnnotation, no exception.
If I add a short artificial delay before the first creation of CustomHorizontalLineAnnotation, no exception.
If I set “ShowLabel” = False in the HorizontalLineAnnotation, no exception.
If I add a dummy creation of CustomHorizontalLineAnnotation in the constructor of my CustomThresholdModifier, no exception.
If I add a dummy creation of AnnotationLabel in the constructor of my CustomThresholdModifier, no exception.

In short, the root cause of the binding exception seems to be coming from the creation of an AnnotationLabel in HorizontalLineAnnotation, either through setting ShowLabel=True, or adding it to the AnnotationLabels collection of the HorizontalLineAnnotation.

Any thoughts? I’d like to use the dummy creation of AnnotationLabel in the constructor as the solution to the problem, but this feels too much like a hack, and likely wont pass muster for my team. Maybe there’s some “best practice” being violated here, in using the modifier to update the annotation on property change?

Thanks!

1 vote
11k views

I’m attempting to integrate some of the tutorial swift code into my app and I’m getting stuck on this error. Seems like some macro isn’t running.

“Use of unresolved identifier ‘SCIGeneric'”

Code is like this: lineDataSeries.appendX(SCIGeneric(i), y: SCIGeneric(sin(Double(i))*0.01))

I’ve done “import SciChart” and most things seem to work fine except this. Any ideas? Thanks

1 vote
17k views

In my project the output panel showing the following binding errors

System.Windows.Data Error: 40 : BindingExpression path error: 'Exponent' property not found on 'object' ''DefaultTickLabelViewModel' (HashCode=56110932)'. BindingExpression:Path=Exponent; DataItem='DefaultTickLabelViewModel' (HashCode=56110932); target element is 'TextBlock' (Name=''); target property is 'Text' (type 'String')
System.Windows.Data Error: 40 : BindingExpression path error: 'HasExponent' property not found on 'object' ''DefaultTickLabelViewModel' (HashCode=56110932)'. BindingExpression:Path=HasExponent; DataItem='DefaultTickLabelViewModel' (HashCode=56110932); target element is 'TextBlock' (Name='exponent'); target property is 'Visibility' (type 'Visibility')
System.Windows.Data Error: 40 : BindingExpression path error: 'Separator' property not found on 'object' ''DefaultTickLabelViewModel' (HashCode=9331561)'. BindingExpression:Path=Separator; DataItem='DefaultTickLabelViewModel' (HashCode=9331561); target element is 'TextBlock' (Name=''); target property is 'Text' (type 'String')

my Line chart view code is here (I can’t able to make attachment)

<UserControl x:Class="Instron.Database.Presentation.DatabaseViews.Views.Visualization.LineChartView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:SciChart="clr-namespace:Abt.Controls.SciChart;assembly=Abt.Controls.SciChart.Wpf.3.0"
             xmlns:s="http://schemas.abtsoftware.co.uk/scichart" 
             mc:Ignorable="d" Width="Auto" Height="Auto"   
             xmlns:gbl="clr-namespace:Instron.Database.Presentation.DatabaseViews.Globalization">

    <UserControl.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="ContentControlDataTemplate.xaml"/>
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </UserControl.Resources>

    <Grid >

        <TextBlock  FontSize="24" 
                    HorizontalAlignment="Center"
                    VerticalAlignment="Center"
                    TextWrapping="Wrap"   
                    Foreground="DimGray"
                    Visibility="{Binding IsAxisVisible,Converter={StaticResource  NotBooleanToVisibilityConverter}}" >
                    <TextBlock.Text>
                        <gbl:TranslateExtension>
                            <gbl:TranslateExtension.DesignTimeText>Either X or Y axis do not contain sufficient data</gbl:TranslateExtension.DesignTimeText>
                            <gbl:TranslateExtension.StringId>010000123</gbl:TranslateExtension.StringId>
                        </gbl:TranslateExtension>
                    </TextBlock.Text>
        </TextBlock>

        <s:SciChartSurface x:Name="sciChart" ChartTitle="{Binding ChartName}" Style="{StaticResource SciChartSurfaceStyle}"   Visibility="{Binding IsLegendVisible,Converter={StaticResource  BoolToVisibilityConverter}}" 
            GridLinesPanelStyle="{StaticResource GridLinesPanelStyle }"  RenderableSeries="{Binding RenderableSeries}"  Margin="0,-5,0,-10"
               DataContextChanged="sciChart_DataContextChanged" Rendered="sciChart_Rendered"  ViewportManager="{Binding ViewportManager}">

            <s:SciChartSurface.ContextMenu>
                <ContextMenu >
                    <MenuItem  Command="{Binding SaveAsCommand}">
                        <MenuItem.Header>
                            <gbl:TranslateExtension>
                                <gbl:TranslateExtension.DesignTimeText>SaveAs</gbl:TranslateExtension.DesignTimeText>
                                <gbl:TranslateExtension.StringId>010000126</gbl:TranslateExtension.StringId>
                            </gbl:TranslateExtension>
                        </MenuItem.Header>
                    </MenuItem>
                    <MenuItem  Command="{Binding CopyCommand}">
                        <MenuItem.Header>
                            <gbl:TranslateExtension>
                                <gbl:TranslateExtension.DesignTimeText>Copy</gbl:TranslateExtension.DesignTimeText>
                                <gbl:TranslateExtension.StringId>010000127</gbl:TranslateExtension.StringId>
                            </gbl:TranslateExtension>
                        </MenuItem.Header>
                    </MenuItem>
                    <MenuItem  Command="{Binding PrintCommand}">
                        <MenuItem.Header>
                            <gbl:TranslateExtension>
                                <gbl:TranslateExtension.DesignTimeText>Print</gbl:TranslateExtension.DesignTimeText>
                                <gbl:TranslateExtension.StringId>010000128</gbl:TranslateExtension.StringId>
                            </gbl:TranslateExtension>
                        </MenuItem.Header>
                    </MenuItem>
                </ContextMenu>
            </s:SciChartSurface.ContextMenu>

            <s:SciChartSurface.XAxis>
                <s:NumericAxis  AutoTicks="False" GrowBy="0.05, 0.05"  
                                DrawMajorGridLines="{Binding IsLegendVisible}"  DrawMinorGridLines ="False"
                                AxisTitle="{Binding XAxisName}"  TitleStyle="{StaticResource AxisTitleStyle}" TickLabelStyle="{StaticResource AxisLabelStyle}" 
                                LabelProvider="{Binding XLabelFormatter}"
                                MajorDelta="1" MinorDelta="0.2"
                                 />
            </s:SciChartSurface.XAxis>

            <s:SciChartSurface.YAxis>
                <s:NumericAxis  GrowBy="1, 1" TickLabelStyle="{StaticResource AxisLabelStyle}" DrawMajorGridLines="{Binding IsLegendVisible}"
                                AxisAlignment="Left"  DrawMinorGridLines ="False"
                                AxisTitle="{Binding YAxisTitle}" 
                                TitleStyle="{StaticResource AxisTitleStyle}" />
            </s:SciChartSurface.YAxis>

            <!--  Adding the ZoomPanModifier gives SciChart the ability to pan on mouse-drag  -->
            <s:SciChartSurface.ChartModifier>
                <s:ModifierGroup>
                    <s:XAxisDragModifier ClipModeX="ClipAtExtents"/>
                    <s:YAxisDragModifier ClipToBounds="True" />
                    <s:RubberBandXyZoomModifier x:Name="rubberBandZoomModifier" IsEnabled="True" IsXAxisOnly="False" ZoomExtentsY="False" IsAnimated="True"/>
                    <s:ZoomExtentsModifier x:Name="zoomExtentsModifier" ClipToBounds="True" ExecuteOn="MouseDoubleClick"/>
                    <s:LegendModifier x:Name="legendModifier" GetLegendDataFor="AllVisibleSeries" />
                </s:ModifierGroup>
            </s:SciChartSurface.ChartModifier>

        <s:SciChartSurface.Annotations>
                <s:CustomAnnotation>
                    <s:CustomAnnotation.ContentTemplate>
                        <DataTemplate>
                            <s:SciChartLegend  x:Name="legendControl" Margin="2,2" Orientation="Horizontal"  Background="Transparent" BorderThickness="0" ScrollViewer.VerticalScrollBarVisibility="Auto"
                                Visibility="{Binding IsLegendVisible,Converter={StaticResource  BoolToVisibilityConverter}}" 
                                LegendData="{Binding LegendData, ElementName=legendModifier,Mode=OneWay}" >

                                <s:SciChartLegend.Resources>
                                    <SciChart:ColorToBrushConverter x:Key="ColorToBrushConverter"/>
                                </s:SciChartLegend.Resources>
                                <s:SciChartLegend.ItemTemplate>
                                    <DataTemplate DataType="SciChart:XyzSeriesInfo">
                                        <Grid>
                                            <Grid.ColumnDefinitions>
                                                <ColumnDefinition Width="Auto" />
                                                <ColumnDefinition Width="Auto" />
                                            </Grid.ColumnDefinitions>
                                           <Rectangle Grid.Column="0"
                                                VerticalAlignment="Center"
                                                Stretch="Fill"
                                                Width="10"

                                                StrokeThickness="10"
                                                Stroke="{Binding SeriesColor,
                                                Converter={StaticResource ColorToBrushConverter}}" />
                                            <TextBlock Grid.Column="1" Foreground="Black" 
                                                Margin="2,0,15,0"
                                                HorizontalAlignment="Center"
                                                Text="{Binding SeriesName}" FontWeight="Normal"/>
                                            </Grid>
                                    </DataTemplate>
                                </s:SciChartLegend.ItemTemplate>
                            </s:SciChartLegend>
                        </DataTemplate>
                    </s:CustomAnnotation.ContentTemplate>
                </s:CustomAnnotation>
            </s:SciChartSurface.Annotations>
        </s:SciChartSurface>
    </Grid>
</UserControl>
  • Raghupathy asked 9 years ago
  • last active 9 years ago
Showing 4 results

Try SciChart Today

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

Start TrialCase Studies