Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
945
empty chart but the object appears to be populated
posted

Have the following XAML code for a ToolWindow, the window appears but the chart is blank...Using the debugger to examine the xamDataChart object all Itemsources and setting are correct. Can't understand what is out of alignment.

 

<Window x:Class="PaddockGRASP.Views.GraphWindow"

xmlns:ig="http://schemas.infragistics.com/xaml"

xmlns:System="clr-namespace:System;assembly=mscorlib"

Title="Results Graph Window" Height="300" Width="600"

ShowInTaskbar="False" WindowStyle="ToolWindow"

DataContext="{Binding Main, Source={StaticResource Locator}}">

<Window.Resources>

<ig:StringFormatConverter x:Key="StringFormatConverter" />

<DataTemplate DataType="{x:Type System:DateTime}">

<TextBlock Text="{Binding StringFormat={}{0:MMM yyyy}}"/>

</DataTemplate>

<SolidColorBrush x:Key="StripBrush" Color="#7FC1C1C1" />

<SolidColorBrush x:Key="StrokeBrush" Color="LightGray" />

<Style x:Key="CategoryXAxisElementStyle" TargetType="ig:CategoryDateTimeXAxis">

<Setter Property="Interval" Value="12" />

<Setter Property="StrokeThickness" Value="1" />

<Setter Property="Strip" Value="{StaticResource StripBrush}" />

<Setter Property="Stroke" Value="{StaticResource StrokeBrush}" />

<Setter Property="StrokeThickness" Value="12" />

<Setter Property="MajorStroke" Value="{StaticResource StrokeBrush}" />

<Setter Property="MajorStrokeThickness" Value="0.5" />

<Setter Property="MinorStroke" Value="{StaticResource StrokeBrush}" />

<Setter Property="MinorStrokeThickness" Value="0.075" />

</Style>

<Style x:Key="NumericYAxisElementStyle" TargetType="ig:NumericYAxis">

<Setter Property="Strip" Value="Transparent" />

<Setter Property="Stroke" Value="{StaticResource StrokeBrush}" />

<Setter Property="StrokeThickness" Value="2.5" />

<Setter Property="MajorStroke" Value="{StaticResource StrokeBrush}" />

<Setter Property="MajorStrokeThickness" Value="0.5" />

<Setter Property="MinorStroke" Value="{StaticResource StrokeBrush}" />

<Setter Property="MinorStrokeThickness" Value="0.125" />

</Style>

<Style x:Key="CrosshairStyle" TargetType="Line">

<Setter Property="Stroke" Value="Black" />

<Setter Property="Opacity" Value="0.7" />

<Setter Property="StrokeThickness" Value="2.0" />

</Style>

</Window.Resources>

<Grid>

<ig:XamDataChart x:Name="xamDataChart"

HorizontalZoomable="True"

HorizontalZoombarVisibility="Visible"

CrosshairLineStyle="{StaticResource CrosshairStyle}"

CrosshairVisibility="Visible" Margin="2,0,2,2" Padding="0" MouseRightButtonDown="xamDataChart_MouseRightButtonDown">

<ig:XamDataChart.Axes>

<ig:CategoryDateTimeXAxis x:Name="xmXAxis"

ItemsSource="{Binding Path=Project.ActiveScenario.ActiveResults}"

DateTimeMemberPath="Date"

Label="{}{Date:MMM yyyy}"

Style="{StaticResource CategoryXAxisElementStyle}">

<ig:CategoryDateTimeXAxis.LabelSettings>

<ig:AxisLabelSettings FontFamily="Segoe UI" FontSize="10" Foreground="Black" FontWeight="Bold" />

</ig:CategoryDateTimeXAxis.LabelSettings>

</ig:CategoryDateTimeXAxis>

<ig:NumericYAxis x:Name="xmYAxis"

Style="{StaticResource NumericYAxisElementStyle}">

<ig:NumericYAxis.LabelSettings>

<ig:AxisLabelSettings FontFamily="Segoe UI" FontSize="10" Foreground="Black" FontWeight="Bold"

Location="OutsideLeft" />

</ig:NumericYAxis.LabelSettings>

</ig:NumericYAxis>

<ig:NumericYAxis x:Name="xmYAxis2">

<ig:NumericYAxis.LabelSettings>

<ig:AxisLabelSettings FontFamily="Segoe UI" FontSize="10" Foreground="Black" FontWeight="Bold"

Location="OutsideRight" />

</ig:NumericYAxis.LabelSettings>

</ig:NumericYAxis>

</ig:XamDataChart.Axes>

<ig:XamDataChart.Series>

<ig:LineSeries ItemsSource="{Binding Path=Project.ActiveScenario.ActiveResults}" XAxis="{Binding ElementName=xmXAxis}" YAxis="{Binding ElementName=xmYAxis}" ValueMemberPath="Rain" MarkerType="None" Title="Monthly Rainfall"

TrendLineType="SimpleAverage"

TrendLineBrush="LightCoral"

TrendLinePeriod="{Binding ElementName=sldTrendLinePeriod, Path=Value, Converter={StaticResource StringFormatConverter}, ConverterParameter='0'}"

TrendLineThickness="2"/>

<ig:LineSeries ItemsSource="{Binding Path=Project.ActiveScenario.ActiveResults}" XAxis="{Binding ElementName=xmXAxis}" YAxis="{Binding ElementName=xmYAxis}" ValueMemberPath="TSDM" MarkerType="None" Title="TSDM"/>

<ig:LineSeries ItemsSource="{Binding Path=Project.ActiveScenario.ActiveResults}" XAxis="{Binding ElementName=xmXAxis}" YAxis="{Binding ElementName=xmYAxis}" ValueMemberPath="Growth" MarkerType="None" Title="Growth" />

<ig:LineSeries ItemsSource="{Binding Path=Project.ActiveScenario.ActiveResults}" XAxis="{Binding ElementName=xmXAxis}" YAxis="{Binding ElementName=xmYAxis2}" ValueMemberPath="LWG" MarkerType="None" Title="Live Weight Gain" />

<ig:LineSeries ItemsSource="{Binding Path=Project.ActiveScenario.ActiveResults}" XAxis="{Binding ElementName=xmXAxis}" YAxis="{Binding ElementName=xmYAxis2}" ValueMemberPath="SoilLoss" MarkerType="None" Title="Soil Loss" />

<ig:LineSeries ItemsSource="{Binding Path=Project.ActiveScenario.ActiveResults}" XAxis="{Binding ElementName=xmXAxis}" YAxis="{Binding ElementName=xmYAxis2}" ValueMemberPath="RadCover" MarkerType="None" Title="Radiation Cover" />

</ig:XamDataChart.Series>

</ig:XamDataChart>

<StackPanel Orientation="Vertical" Margin="229,0,183,226" HorizontalAlignment="Center" Width="166">

<TextBlock Text="TrendLine Period" Margin="2" HorizontalAlignment="Center" FontSize="10" FontWeight="Bold" />

<StackPanel Orientation="Horizontal" HorizontalAlignment="Center">

<Slider x:Name="sldTrendLinePeriod" Width="120" Value="12" Minimum="1" Maximum="24" TickFrequency="24" TickPlacement="BottomRight" HorizontalAlignment="Left" Height="16" SmallChange="1" SnapsToDevicePixels="False" />

<TextBlock Width="30" Text="{Binding Value, ConverterParameter=0, Converter={StaticResource StringFormatConverter}, ElementName=sldTrendLinePeriod}" TextAlignment="Center" HorizontalAlignment="Right" />

</StackPanel>

</StackPanel>

</Grid>

</

Window>

the binding is to

public

ObservableCollection<GRASPRecord> ActiveResults

        {

           

get { return _activeResults; }

        }

 

and

[

Serializable]

    [

IgnoreFirst(1)]

    [

FixedLengthRecord()]

   

public class GRASPRecord

    {

        [

FieldFixedLength(8)]

        [

FieldConverter(ConverterKind.Date, "yyyyMMdd")]

       

public DateTime Date;

        [

FieldFixedLength(8)]

       

public float Rain;

        [

FieldFixedLength(8)]

       

public float TSDM;

        [

FieldFixedLength(8)]

       

public float Growth;

        [

FieldFixedLength(8)]

       

public float Cover;

        [

FieldFixedLength(8)]

       

public float Runoff;

        [

FieldFixedLength(8)]

       

public float SoilLoss;

        [

FieldFixedLength(8)]

       

public float LWG;

        [

FieldFixedLength(8)]

       

public float Beasts;

        [

FieldFixedLength(8)]

       

public float Eaten;

        [

FieldFixedLength(8)]

       

public float RadCover;

    }

 

 

Parents
  • 138253
    Offline posted

    Hello,

     

    It has been a while since you have made your post, in case you still need support I will be glad to assist you further. I suppose the other community members can benefit from this answer as well. I have been looking into your post, but it seems like that I am missing something in your scenario, so if this is still an issue for you, could you please send an isolated sample project, where the issue is reproduced, so I can investigate it further for you.

     

    Feel free to write me if you have further questions.

Reply Children