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
1060
Legend is hiding in XamDataChart.
posted

Hi,

I am trying to create a simple xamDataChart with Legend box, but legend box is not completely visible.  

And here is my XAML code for chart definition.

<ig:XamDataChart Grid.RowSpan="2" HorizontalAlignment="Stretch" Margin="0" Name="theChart" Background="#EBF3FB" VerticalAlignment="Stretch" Grid.Column="0" Grid.Row="1">
                    <ig:XamDataChart.Axes>
                        <ig:CategoryXAxis x:Name="xmXAxis" ItemsSource="{Binding}" Label="{}{X}" Stroke="Transparent" MajorStroke="Transparent">
                            <ig:CategoryXAxis.LabelSettings>
                                <ig:AxisLabelSettings Location="OutsideBottom" Extent="35" Visibility="Visible" />
                            </ig:CategoryXAxis.LabelSettings>
                        </ig:CategoryXAxis>
                        <ig:NumericYAxis x:Name="xmYAxisPrice" MajorStroke="Transparent" MinorStroke="Transparent">
                            <ig:NumericYAxis.LabelSettings>
                                <ig:AxisLabelSettings Location="OutsideLeft" Extent="55" Visibility="Visible" />
                            </ig:NumericYAxis.LabelSettings>
                        </ig:NumericYAxis>
                    </ig:XamDataChart.Axes>
                    <ig:XamDataChart.Series>
                        <ig:LineSeries Thickness="2" ItemsSource="{Binding}" Brush="Blue" UnknownValuePlotting="LinearInterpolate" ValueMemberPath="Y1" XAxis="{Binding ElementName=xmXAxis}" YAxis="{Binding ElementName=xmYAxisPrice}" Title="ABC" Legend="{Binding ElementName=MyLegendItem}" />
                    </ig:XamDataChart.Series>
                </ig:XamDataChart>
                <ig:Legend x:Name="MyLegendItem" HorizontalAlignment="Right" VerticalAlignment="Top" Width="200" Height="100" Content="Legend"></ig:Legend>

I don't know what I am doing wrong here. Kindly help.

  • 1060
    Offline posted in reply to Graham Murray

    Hi Graham,

    Thank you for your response. Here is the complete page XAML, I just removed the TreeView Items.

    <UserControl x:Class="MyNamespace.IC"
        xmlns="
    http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:igChart="http://schemas.infragistics.com/xamWebChart"
        xmlns:ig="http://schemas.infragistics.com/xaml"    
        xmlns:controlsToolkit="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Toolkit"
       
        mc:Ignorable="d" Loaded="IC_Loaded" xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk">
          <ScrollViewer VerticalScrollBarVisibility="Auto" d:LayoutOverrides="Width, Height" >
            <Grid x:Name="LayoutRoot" Style="{StaticResource GridMainPageOuter}" MinWidth="600" MinHeight="380">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="0.02*"/>
                    <ColumnDefinition Width="440"/>
                    <ColumnDefinition Width="0.02*"/>
                    <ColumnDefinition Width="0.93*"/>
                    <ColumnDefinition Width="0.03*"/>
                </Grid.ColumnDefinitions>
                <Grid.RowDefinitions>
                    <RowDefinition Height="30"/>
                    <RowDefinition Height="8"/>
                    <RowDefinition Height="*"/>
                    <RowDefinition Height="5"/>
                    <RowDefinition Height="120"/>
                    <RowDefinition Height="20"/>
                </Grid.RowDefinitions>

                <Border BorderBrush="Gray" Background="Transparent" x:Name="brdMainText" BorderThickness="0,0,0,4" Grid.Row="0" Grid.Column="1" Grid.ColumnSpan="3" />

                <TextBlock x:Name="lblCompany" Style="{StaticResource TextBlockTitle}" Text="Comparison : " Grid.Column="1" Grid.Row="0" Grid.ColumnSpan="3" />
                <TextBlock x:Name="lblPublishingHouse" Style="{StaticResource TextBlockPromptTitle}" Text="*report" Grid.Column="3" Grid.Row="0" HorizontalAlignment="Right" FontStyle="Italic" />

                <Grid x:Name="gLeft" Style="{StaticResource ExpandGridInformation}" Grid.Column="1" Grid.Row="2"  MinHeight="270" Background="#EBF3FB" >
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="0.01*"/>

                        <ColumnDefinition Width="0.60*"/>
                        <ColumnDefinition Width="0.38*"/>

                        <ColumnDefinition Width="0.01*"/>
                    </Grid.ColumnDefinitions>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="50"/>
                        <RowDefinition Height="35"/>
                        <RowDefinition Height="15"/>
                        <RowDefinition Height="15"/>
                        <RowDefinition Height="*"/>
                        <RowDefinition/>
                    </Grid.RowDefinitions>
                    <Grid x:Name="grdTopLeft" Style="{StaticResource GridInformation}" Grid.ColumnSpan="4" Grid.Row="0" Grid.Column="0" Height="50" Margin="0"  Background="#B0D0FF">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="0.01*"/>

                            <ColumnDefinition Width="0.60*"/>
                            <ColumnDefinition Width="0.38*"/>

                            <ColumnDefinition Width="0.01*"/>
                        </Grid.ColumnDefinitions>
                        <Grid.RowDefinitions>
                            <RowDefinition/>
                            <RowDefinition/>
                        </Grid.RowDefinitions>
                        <TextBlock x:Name="lbPerformance" VerticalAlignment="Top" Text="Categories" Grid.Column="1" Grid.Row="0" Grid.ColumnSpan="2" TextWrapping="Wrap" d:LayoutOverrides="Width" FontSize="16" FontFamily="Verdana" Foreground="Black"/>
                        <TextBlock x:Name="lbIndicators" HorizontalAlignment="Right" Margin="0" VerticalAlignment="Center" Grid.Row="1" Grid.Column="1" Text="Indicators" TextWrapping="Wrap" Foreground="Black"/>
                        <ComboBox x:Name="ddlYear" Margin="0" Grid.Column="2" Grid.Row="1" Width="70" VerticalAlignment="Top" SelectionChanged="ddlYear_SelectionChanged">
                        </ComboBox>
                    </Grid>
                    <TextBlock x:Name="lbPosChange" Margin="0" Grid.Column="1" Grid.Row="1" VerticalAlignment="Center" Text="Average within industry:" TextWrapping="Wrap" d:LayoutOverrides="Width" FontWeight="Bold" FontSize="18"/>
                    <TextBlock x:Name="lbPosChangeValue" Margin="0" Grid.Column="2" Grid.Row="1" HorizontalAlignment="Center" VerticalAlignment="Center" Text="80%" TextWrapping="Wrap" d:LayoutOverrides="Width" FontWeight="Bold" FontSize="18" Foreground="#FF0D5EEA"/>
                    <StackPanel FlowDirection="LeftToRight" Grid.Column="1" Grid.ColumnSpan="3" Grid.Row="2" HorizontalAlignment="Left" Orientation="Horizontal" VerticalAlignment="Center">
                        <TextBlock Text="                                                                 " />
                        <TextBlock x:Name="lbValue" Margin="0" Text="Value  " TextWrapping="Wrap" FontWeight="Bold" FontSize="10" Foreground="Black"/>
                        <TextBlock x:Name="lbAvg" Margin="0" Text=" Avg. " TextWrapping="Wrap" FontWeight="Bold" FontSize="10" Foreground="Black"/>
                        <TextBlock x:Name="lbSTDev" Margin="0" Text="   St. Dev. " TextWrapping="Wrap" FontWeight="Bold" FontSize="10" Foreground="Black"/>
                        <TextBlock x:Name="lbPct" Margin="0" Text="   Pct " TextWrapping="Wrap" FontWeight="Bold" FontSize="10" Foreground="Black"/>
                    </StackPanel>
                    <Border BorderBrush="Gray" Background="Transparent" x:Name="brdIndustryLine" BorderThickness="0,0,0,2" Grid.Row="3" Grid.Column="1" Grid.ColumnSpan="2" Width="185" HorizontalAlignment="Right" VerticalAlignment="Top" />
                    <ig:XamTree x:Name="webTree" Margin="0" Grid.Row="4" Grid.Column="1" Grid.ColumnSpan="2" Height="Auto" SelectionType="Single" VerticalAlignment="Top" Background="{x:Null}"
                                       d:LayoutOverrides="Width" BorderThickness="0" ItemExpansionChanged="XamWebTree_ItemExpansionChanged"  ActiveItemChanging="webTree_ActiveItemChanging">
                  <!--Tree Item here -->
                    </ig:XamTree>

                </Grid>
                <Grid x:Name="gChart" Style="{StaticResource ExpandGridInformation}" Grid.Column="3" Grid.Row="2" MinHeight="240" Background="#EBF3FB">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="*"/>
                    </Grid.ColumnDefinitions>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="30" />
                        <RowDefinition Height="*"/>
                    </Grid.RowDefinitions>
                    <TextBlock Grid.Column="0" Grid.Row="0" FontFamily="Arial" FontWeight="Bold" FontSize="16"  HorizontalAlignment="Left" Name="lblMeasureOnChart" VerticalAlignment="Top" Text=" " />
                    <ig:XamDataChart Grid.RowSpan="2" HorizontalAlignment="Stretch" Margin="0" Name="theChart" Background="#EBF3FB" VerticalAlignment="Stretch" Grid.Column="0" Grid.Row="1">
                        <ig:XamDataChart.Axes>
                            <ig:CategoryXAxis x:Name="xmXAxis" ItemsSource="{Binding}" Label="{}{X}" Stroke="Transparent" MajorStroke="Transparent">
                                <ig:CategoryXAxis.LabelSettings>
                                    <ig:AxisLabelSettings Location="OutsideBottom" Extent="35" Visibility="Visible" />
                                </ig:CategoryXAxis.LabelSettings>
                            </ig:CategoryXAxis>
                            <ig:NumericYAxis x:Name="xmYAxisPrice" MajorStroke="Transparent" MinorStroke="Transparent">
                                <ig:NumericYAxis.LabelSettings>
                                    <ig:AxisLabelSettings Location="OutsideLeft" Extent="55" Visibility="Visible" />
                                </ig:NumericYAxis.LabelSettings>
                            </ig:NumericYAxis>
                        </ig:XamDataChart.Axes>
                        <ig:XamDataChart.Series>
                            <ig:LineSeries Thickness="2" ItemsSource="{Binding}" Brush="Blue" UnknownValuePlotting="LinearInterpolate" ValueMemberPath="Y1" XAxis="{Binding ElementName=xmXAxis}" YAxis="{Binding ElementName=xmYAxisPrice}" Title="ABC" Legend="{Binding ElementName=MyLegendItem}" />
                        </ig:XamDataChart.Series>
                    </ig:XamDataChart>
                    <ig:Legend x:Name="MyLegendItem" HorizontalAlignment="Right" VerticalAlignment="Top" Width="200" Height="100" Content="Legend"></ig:Legend>
                </Grid>

                <Grid x:Name="grdTable" Background="#EBF3FB" VerticalAlignment="Top" Grid.Column="1" Grid.Row="4" Grid.ColumnSpan="3" Height="120">
                    <Grid.RowDefinitions>
                        <RowDefinition Height="18"/>
                        <RowDefinition Height="2"/>
                        <RowDefinition Height="17"/>
                        <RowDefinition Height="17"/>
                        <RowDefinition Height="17"/>
                        <RowDefinition Height="17"/>
                        <RowDefinition Height="17"/>
                        <RowDefinition Height="15"/>
                    </Grid.RowDefinitions>
                </Grid>
                <TextBlock x:Name="lblNote" Style="{StaticResource TextBlockPromptTitle}" Foreground="Red" Text="* This view contains calculated data not provided in the source document" Grid.Column="1" Grid.Row="5" Grid.ColumnSpan="3" FontStyle="Italic" />
                <controlsToolkit:BusyIndicator x:Name="actPTV" IsBusy="False" Grid.Row="1" Grid.Column="1" Grid.ColumnSpan="4" Grid.RowSpan="2" BusyContent="Calculating..." DisplayAfter="00:00:00" Margin="1,-3,-1,-27"/>
            </Grid>
        </ScrollViewer>
    </UserControl>

  • 30692
    Offline posted

    Hi, could you shart the xaml code for the element that contains these two?

    -Graham