Line series not showing when printing chart

5 posts, 2 answers
  1. Michel Hardy
    Michel Hardy avatar
    9 posts
    Member since:
    Jun 2010

    Posted 27 Jul 2010 Link to this post

    Hello,

    I created a user control like the following for printing in SL4.

    <UserControl xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"  
        x:Class="HEXPORT.Controls.PrintPage"
      mc:Ignorable="d"
      d:DesignHeight="800" d:DesignWidth="600">
          
      <Grid x:Name="DocumentRoot">
            <Grid.RowDefinitions>
                <RowDefinition Height="25"/>
                <RowDefinition Height="*" />
                <RowDefinition Height="25"/>
            </Grid.RowDefinitions>
      
            <Grid.ColumnDefinitions>
                <ColumnDefinition />
                <ColumnDefinition />
                <ColumnDefinition />
            </Grid.ColumnDefinitions>
                  
            <TextBlock Name="HeaderLeft" TextAlignment="Left" HorizontalAlignment="Left" Grid.Column="0" Grid.Row="0"/>
            <TextBlock Name="HeaderCenter" TextAlignment="Center" HorizontalAlignment="Center" Grid.Column="1" Grid.Row="0"/>
            <TextBlock Name="HeaderRight" TextAlignment="Right" HorizontalAlignment="Right" Grid.Column="2" Grid.Row="0"/>
      
            <TextBlock Name="FooterLeft" TextAlignment="Left" HorizontalAlignment="Left" Grid.Column="0" Grid.Row="2"/>
            <TextBlock Name="FooterCenter" TextAlignment="Center" HorizontalAlignment="Center" Grid.Column="1" Grid.Row="2"/>
            <TextBlock Name="FooterRight" TextAlignment="Right" HorizontalAlignment="Right" Grid.Column="2" Grid.Row="2"/>
      
            <Grid Name="BodyRoot" Grid.Row="1" Grid.ColumnSpan="3">
                <Grid.RowDefinitions>
                    <RowDefinition Height="25"/>
                    <RowDefinition Height="*" />
                    <RowDefinition Height="25"/>
                    <RowDefinition Height="*" />
                </Grid.RowDefinitions>
                  
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="150"/>
                    <ColumnDefinition Width="*" />
                </Grid.ColumnDefinitions>
      
                <TextBlock Name="Chart1Header" TextAlignment="Center" HorizontalAlignment="Center" Grid.Column="0" Grid.Row="0" Grid.ColumnSpan="2"/>
                <TextBlock Name="Chart2Header" TextAlignment="Center" HorizontalAlignment="Center" Grid.Column="0" Grid.Row="2" Grid.ColumnSpan="2"/>
      
                <telerik:RadChart Name="radChart1" Grid.Row="1" Grid.Column="1"/>
                <telerik:RadChart Name="radChart2" Grid.Row="3" Grid.Column="1"/>
      
                <Grid x:Name="grdStatData1" Grid.Row="1" Grid.Column="0" VerticalAlignment="Center">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="*"/>
                        <ColumnDefinition Width="*"/>
                    </Grid.ColumnDefinitions>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="21"/>
                        <RowDefinition Height="21"/>
                        <RowDefinition Height="21"/>
                        <RowDefinition Height="21"/>
                        <RowDefinition Height="21"/>
                        <RowDefinition Height="21"/>
                        <RowDefinition Height="21"/>
                        <RowDefinition Height="21"/>
                        <RowDefinition Height="21"/>
                        <RowDefinition Height="21"/>
                        <RowDefinition Height="21"/>
                        <RowDefinition Height="21"/>
                        <RowDefinition Height="21"/>
                        <RowDefinition Height="21"/>
                        <RowDefinition Height="21"/>
                        <RowDefinition Height="21"/>
                    </Grid.RowDefinitions>
                    <Border Grid.Row="0" Grid.Column="0" BorderBrush="Black" BorderThickness="1" Margin="10,0,-1,-1">
                        <TextBlock Name="lblVariable1" HorizontalAlignment="Stretch" VerticalAlignment="Center" Margin="3,0,0,0"/>
                    </Border>
                    <Border Grid.Row="1" Grid.Column="0" BorderBrush="Black" BorderThickness="1" Margin="10,0,-1,-1">
                        <TextBlock Text="Samples" HorizontalAlignment="Stretch" VerticalAlignment="Center" Margin="3,0,0,0"/>
                    </Border>
                    <Border Grid.Row="2" Grid.Column="0" BorderBrush="Black" BorderThickness="1" Margin="10,0,-1,-1">
                        <TextBlock Text="Mean" HorizontalAlignment="Stretch" VerticalAlignment="Center" Margin="3,0,0,0"/>
                    </Border>
                    <Border Grid.Row="3" Grid.Column="0" BorderBrush="Black" BorderThickness="1" Margin="10,0,-1,-1">
                        <TextBlock Text="StDev" HorizontalAlignment="Stretch" VerticalAlignment="Center" Margin="3,0,0,0"/>
                    </Border>
                    <Border Grid.Row="4" Grid.Column="0" BorderBrush="Black" BorderThickness="1" Margin="10,0,-1,-1">
                        <TextBlock Text="-3 Sigma" HorizontalAlignment="Stretch" VerticalAlignment="Center" Margin="3,0,0,0"/>
                    </Border>
                    <Border Grid.Row="5" Grid.Column="0" BorderBrush="Black" BorderThickness="1" Margin="10,0,-1,-1">
                        <TextBlock Text="+3 Sigma" HorizontalAlignment="Stretch" VerticalAlignment="Center" Margin="3,0,0,0"/>
                    </Border>
                    <Border Grid.Row="6" Grid.Column="0" BorderBrush="Black" BorderThickness="1" Margin="10,0,-1,-1">
                        <TextBlock Text="Min" HorizontalAlignment="Stretch" VerticalAlignment="Center" Margin="3,0,0,0"/>
                    </Border>
                    <Border Grid.Row="7" Grid.Column="0" BorderBrush="Black" BorderThickness="1" Margin="10,0,-1,-1">
                        <TextBlock Text="Max" HorizontalAlignment="Stretch" VerticalAlignment="Center" Margin="3,0,0,0"/>
                    </Border>
                    <Border Grid.Row="8" Grid.Column="0" BorderBrush="Black" BorderThickness="1" Margin="10,0,-1,-1">
                        <TextBlock Text="Range" HorizontalAlignment="Stretch" VerticalAlignment="Center" Margin="3,0,0,0"/>
                    </Border>
                    <Border Grid.Row="9" Grid.Column="0" BorderBrush="Black" BorderThickness="1" Margin="10,0,-1,-1">
                        <TextBlock Text="LSL" HorizontalAlignment="Stretch" VerticalAlignment="Center" Margin="3,0,0,0"/>
                    </Border>
                    <Border Grid.Row="10" Grid.Column="0" BorderBrush="Black" BorderThickness="1" Margin="10,0,-1,-1">
                        <TextBlock Text="USL" HorizontalAlignment="Stretch" VerticalAlignment="Center" Margin="3,0,0,0"/>
                    </Border>
                    <Border Grid.Row="11" Grid.Column="0" BorderBrush="Black" BorderThickness="1" Margin="10,0,-1,-1">
                        <TextBlock Text="Target" HorizontalAlignment="Stretch" VerticalAlignment="Center" Margin="3,0,0,0"/>
                    </Border>
                    <Border Grid.Row="12" Grid.Column="0" BorderBrush="Black" BorderThickness="1" Margin="10,0,-1,-1">
                        <TextBlock Text="Cp" HorizontalAlignment="Stretch" VerticalAlignment="Center" Margin="3,0,0,0"/>
                    </Border>
                    <Border Grid.Row="13" Grid.Column="0" BorderBrush="Black" BorderThickness="1" Margin="10,0,-1,-1">
                        <TextBlock Text="CpK" HorizontalAlignment="Stretch" VerticalAlignment="Center" Margin="3,0,0,0"/>
                    </Border>
                    <Border Grid.Row="14" Grid.Column="0" BorderBrush="Black" BorderThickness="1" Margin="10,0,-1,-1">
                        <TextBlock Text="Hist. data" HorizontalAlignment="Stretch" VerticalAlignment="Center" Margin="3,0,0,0"/>
                    </Border>
                    <Border Grid.Row="0" Grid.Column="1" BorderBrush="Black" BorderThickness="1" Background="White" Margin="0,0,10,-1">
                        <TextBlock Name="lblUnit1" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,3,0"/>
                    </Border>
                    <Border Grid.Row="1" Grid.Column="1" BorderBrush="Black" BorderThickness="1" Background="White" Margin="0,0,10,-1">
                        <TextBlock Name="lblSamples1" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,3,0"/>
                    </Border>
                    <Border Grid.Row="2" Grid.Column="1" BorderBrush="Black" BorderThickness="1" Background="White" Margin="0,0,10,-1">
                        <TextBlock Name="lblMean1" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,3,0"/>
                    </Border>
                    <Border Grid.Row="3" Grid.Column="1" BorderBrush="Black" BorderThickness="1" Background="White" Margin="0,0,10,-1">
                        <TextBlock Name="lblStDev1" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,3,0"/>
                    </Border>
                    <Border Grid.Row="4" Grid.Column="1" BorderBrush="Black" BorderThickness="1" Background="White" Margin="0,0,10,-1">
                        <TextBlock Name="lblSigmaMinus31" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,3,0"/>
                    </Border>
                    <Border Grid.Row="5" Grid.Column="1" BorderBrush="Black" BorderThickness="1" Background="White" Margin="0,0,10,-1">
                        <TextBlock Name="lblSigmePlus31" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,3,0"/>
                    </Border>
                    <Border Grid.Row="6" Grid.Column="1" BorderBrush="Black" BorderThickness="1" Background="White" Margin="0,0,10,-1">
                        <TextBlock Name="lblMin1" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,3,0"/>
                    </Border>
                    <Border Grid.Row="7" Grid.Column="1" BorderBrush="Black" BorderThickness="1" Background="White" Margin="0,0,10,-1">
                        <TextBlock Name="lblMax1" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,3,0"/>
                    </Border>
                    <Border Grid.Row="8" Grid.Column="1" BorderBrush="Black" BorderThickness="1" Background="White" Margin="0,0,10,-1">
                        <TextBlock Name="lblRange1" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,3,0"/>
                    </Border>
                    <Border Grid.Row="9" Grid.Column="1" BorderBrush="Black" BorderThickness="1" Background="White" Margin="0,0,10,-1">
                        <TextBlock Name="lblLsl1" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,3,0"/>
                    </Border>
                    <Border Grid.Row="10" Grid.Column="1" BorderBrush="Black" BorderThickness="1" Background="White" Margin="0,0,10,-1">
                        <TextBlock Name="lblUsl1" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,3,0"/>
                    </Border>
                    <Border Grid.Row="11" Grid.Column="1" BorderBrush="Black" BorderThickness="1" Background="White" Margin="0,0,10,-1">
                        <TextBlock Name="lblTarget1" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,3,0"/>
                    </Border>
                    <Border Grid.Row="12" Grid.Column="1" BorderBrush="Black" BorderThickness="1" Background="White" Margin="0,0,10,-1">
                        <TextBlock Name="lblCp1" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,3,0"/>
                    </Border>
                    <Border Grid.Row="13" Grid.Column="1" BorderBrush="Black" BorderThickness="1" Background="White" Margin="0,0,10,-1">
                        <TextBlock Name="lblCpK1" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,3,0"/>
                    </Border>
                    <Border Grid.Row="14" Grid.Column="1" BorderBrush="Black" BorderThickness="1" Background="White" Margin="0,0,10,-1">
                        <TextBlock Name="lblHistoricalData1" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,3,0"/>
                    </Border>
                </Grid>
      
                <Grid x:Name="grdStatData2" Grid.Row="4" Grid.Column="0" VerticalAlignment="Center">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="*"/>
                        <ColumnDefinition Width="*"/>
                    </Grid.ColumnDefinitions>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="21"/>
                        <RowDefinition Height="21"/>
                        <RowDefinition Height="21"/>
                        <RowDefinition Height="21"/>
                        <RowDefinition Height="21"/>
                        <RowDefinition Height="21"/>
                        <RowDefinition Height="21"/>
                        <RowDefinition Height="21"/>
                        <RowDefinition Height="21"/>
                        <RowDefinition Height="21"/>
                        <RowDefinition Height="21"/>
                        <RowDefinition Height="21"/>
                        <RowDefinition Height="21"/>
                        <RowDefinition Height="21"/>
                        <RowDefinition Height="21"/>
                        <RowDefinition Height="21"/>
                    </Grid.RowDefinitions>
                    <Border Grid.Row="0" Grid.Column="0" BorderBrush="Black" BorderThickness="1" Margin="10,0,-1,-1">
                        <TextBlock Name="lblVariable2" HorizontalAlignment="Stretch" VerticalAlignment="Center" Margin="3,0,0,0"/>
                    </Border>
                    <Border Grid.Row="1" Grid.Column="0" BorderBrush="Black" BorderThickness="1" Margin="10,0,-1,-1">
                        <TextBlock Text="Samples" HorizontalAlignment="Stretch" VerticalAlignment="Center" Margin="3,0,0,0"/>
                    </Border>
                    <Border Grid.Row="2" Grid.Column="0" BorderBrush="Black" BorderThickness="1" Margin="10,0,-1,-1">
                        <TextBlock Text="Mean" HorizontalAlignment="Stretch" VerticalAlignment="Center" Margin="3,0,0,0"/>
                    </Border>
                    <Border Grid.Row="3" Grid.Column="0" BorderBrush="Black" BorderThickness="1" Margin="10,0,-1,-1">
                        <TextBlock Text="StDev" HorizontalAlignment="Stretch" VerticalAlignment="Center" Margin="3,0,0,0"/>
                    </Border>
                    <Border Grid.Row="4" Grid.Column="0" BorderBrush="Black" BorderThickness="1" Margin="10,0,-1,-1">
                        <TextBlock Text="-3 Sigma" HorizontalAlignment="Stretch" VerticalAlignment="Center" Margin="3,0,0,0"/>
                    </Border>
                    <Border Grid.Row="5" Grid.Column="0" BorderBrush="Black" BorderThickness="1" Margin="10,0,-1,-1">
                        <TextBlock Text="+3 Sigma" HorizontalAlignment="Stretch" VerticalAlignment="Center" Margin="3,0,0,0"/>
                    </Border>
                    <Border Grid.Row="6" Grid.Column="0" BorderBrush="Black" BorderThickness="1" Margin="10,0,-1,-1">
                        <TextBlock Text="Min" HorizontalAlignment="Stretch" VerticalAlignment="Center" Margin="3,0,0,0"/>
                    </Border>
                    <Border Grid.Row="7" Grid.Column="0" BorderBrush="Black" BorderThickness="1" Margin="10,0,-1,-1">
                        <TextBlock Text="Max" HorizontalAlignment="Stretch" VerticalAlignment="Center" Margin="3,0,0,0"/>
                    </Border>
                    <Border Grid.Row="8" Grid.Column="0" BorderBrush="Black" BorderThickness="1" Margin="10,0,-1,-1">
                        <TextBlock Text="Range" HorizontalAlignment="Stretch" VerticalAlignment="Center" Margin="3,0,0,0"/>
                    </Border>
                    <Border Grid.Row="9" Grid.Column="0" BorderBrush="Black" BorderThickness="1" Margin="10,0,-1,-1">
                        <TextBlock Text="LSL" HorizontalAlignment="Stretch" VerticalAlignment="Center" Margin="3,0,0,0"/>
                    </Border>
                    <Border Grid.Row="10" Grid.Column="0" BorderBrush="Black" BorderThickness="1" Margin="10,0,-1,-1">
                        <TextBlock Text="USL" HorizontalAlignment="Stretch" VerticalAlignment="Center" Margin="3,0,0,0"/>
                    </Border>
                    <Border Grid.Row="11" Grid.Column="0" BorderBrush="Black" BorderThickness="1" Margin="10,0,-1,-1">
                        <TextBlock Text="Target" HorizontalAlignment="Stretch" VerticalAlignment="Center" Margin="3,0,0,0"/>
                    </Border>
                    <Border Grid.Row="12" Grid.Column="0" BorderBrush="Black" BorderThickness="1" Margin="10,0,-1,-1">
                        <TextBlock Text="Cp" HorizontalAlignment="Stretch" VerticalAlignment="Center" Margin="3,0,0,0"/>
                    </Border>
                    <Border Grid.Row="13" Grid.Column="0" BorderBrush="Black" BorderThickness="1" Margin="10,0,-1,-1">
                        <TextBlock Text="CpK" HorizontalAlignment="Stretch" VerticalAlignment="Center" Margin="3,0,0,0"/>
                    </Border>
                    <Border Grid.Row="14" Grid.Column="0" BorderBrush="Black" BorderThickness="1" Margin="10,0,-1,-1">
                        <TextBlock Text="Hist. data" HorizontalAlignment="Stretch" VerticalAlignment="Center" Margin="3,0,0,0"/>
                    </Border>
                    <Border Grid.Row="0" Grid.Column="1" BorderBrush="Black" BorderThickness="1" Background="White" Margin="0,0,10,-1">
                        <TextBlock Name="lblUnit2" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,3,0"/>
                    </Border>
                    <Border Grid.Row="1" Grid.Column="1" BorderBrush="Black" BorderThickness="1" Background="White" Margin="0,0,10,-1">
                        <TextBlock Name="lblSamples2" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,3,0"/>
                    </Border>
                    <Border Grid.Row="2" Grid.Column="1" BorderBrush="Black" BorderThickness="1" Background="White" Margin="0,0,10,-1">
                        <TextBlock Name="lblMean2" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,3,0"/>
                    </Border>
                    <Border Grid.Row="3" Grid.Column="1" BorderBrush="Black" BorderThickness="1" Background="White" Margin="0,0,10,-1">
                        <TextBlock Name="lblStDev2" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,3,0"/>
                    </Border>
                    <Border Grid.Row="4" Grid.Column="1" BorderBrush="Black" BorderThickness="1" Background="White" Margin="0,0,10,-1">
                        <TextBlock Name="lblSigmaMinus32" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,3,0"/>
                    </Border>
                    <Border Grid.Row="5" Grid.Column="1" BorderBrush="Black" BorderThickness="1" Background="White" Margin="0,0,10,-1">
                        <TextBlock Name="lblSigmePlus32" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,3,0"/>
                    </Border>
                    <Border Grid.Row="6" Grid.Column="1" BorderBrush="Black" BorderThickness="1" Background="White" Margin="0,0,10,-1">
                        <TextBlock Name="lblMin2" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,3,0"/>
                    </Border>
                    <Border Grid.Row="7" Grid.Column="1" BorderBrush="Black" BorderThickness="1" Background="White" Margin="0,0,10,-1">
                        <TextBlock Name="lblMax2" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,3,0"/>
                    </Border>
                    <Border Grid.Row="8" Grid.Column="1" BorderBrush="Black" BorderThickness="1" Background="White" Margin="0,0,10,-1">
                        <TextBlock Name="lblRange2" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,3,0"/>
                    </Border>
                    <Border Grid.Row="9" Grid.Column="1" BorderBrush="Black" BorderThickness="1" Background="White" Margin="0,0,10,-1">
                        <TextBlock Name="lblLsl2" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,3,0"/>
                    </Border>
                    <Border Grid.Row="10" Grid.Column="1" BorderBrush="Black" BorderThickness="1" Background="White" Margin="0,0,10,-1">
                        <TextBlock Name="lblUsl2" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,3,0"/>
                    </Border>
                    <Border Grid.Row="11" Grid.Column="1" BorderBrush="Black" BorderThickness="1" Background="White" Margin="0,0,10,-1">
                        <TextBlock Name="lblTarget2" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,3,0"/>
                    </Border>
                    <Border Grid.Row="12" Grid.Column="1" BorderBrush="Black" BorderThickness="1" Background="White" Margin="0,0,10,-1">
                        <TextBlock Name="lblCp2" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,3,0"/>
                    </Border>
                    <Border Grid.Row="13" Grid.Column="1" BorderBrush="Black" BorderThickness="1" Background="White" Margin="0,0,10,-1">
                        <TextBlock Name="lblCpK2" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,3,0"/>
                    </Border>
                    <Border Grid.Row="14" Grid.Column="1" BorderBrush="Black" BorderThickness="1" Background="White" Margin="0,0,10,-1">
                        <TextBlock Name="lblHistoricalData2" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,3,0"/>
                    </Border>
                </Grid>
            </Grid>
        </Grid>
    </UserControl>

    I then use this user control and prepare the chart. I am using the SeriesMappings from my UI chart in the printout chart.
    I also tried creating SeriesMapping from scratch, but it makes no difference.
    void pd_PrintPage(object sender, PrintPageEventArgs e)
    {
        int chartCount = 0;
        if (printPage == null)
        {
            printPage = new Controls.PrintPage();
            printPage.Width = e.PrintableArea.Width;
            printPage.Height = e.PrintableArea.Height;
        }
        if (printPage.Width != e.PrintableArea.Width || printPage.Height != e.PrintableArea.Height)
            return;
        printPage.radChart1.SamplingSettings.SamplingThreshold = 0;
          
        printPage.HeaderLeft.Text = "Hexpol Compounding";
        printPage.HeaderCenter.Text = "Statistics";
        printPage.HeaderRight.Text = DateTime.Now.ToString("yyyy-MM-dd");
        printPage.radChart1.SeriesMappings = radChart.SeriesMappings;
        printPage.radChart1.DefaultView.ChartArea.AxisX.AxisStyles.TickLineStyle = (Style)this.Resources["AxisXTickStyle"];
        printPage.radChart1.DefaultView.ChartArea.AxisX.Title = "Date and time";
        printPage.radChart1.DefaultView.ChartArea.AxisX.IsDateTime = false;
        printPage.radChart1.DefaultView.ChartArea.AxisX.LabelRotationAngle = -90;
        printPage.radChart1.DefaultView.ChartArea.AxisX.LayoutMode = AxisLayoutMode.Normal;
        radChart.DefaultView.ChartArea.AxisY.DefaultLabelFormat = "F3";
        printPage.radChart1.DefaultView.ChartArea.AxisY = radChart.DefaultView.ChartArea.AxisY;
        printPage.radChart1.SortDescriptors.Clear();
        foreach (var s in radChart.SortDescriptors)
            printPage.radChart1.SortDescriptors.Add(s);
        printPage.radChart1.FilterDescriptors.Clear();
        foreach (var f in radChart.FilterDescriptors)
            printPage.radChart1.FilterDescriptors.Add(f);
        foreach (TestVariable t in TestVariables.Where(tv => !tv.printed && tv.load))
        {
            chartCount++;
            if (chartCount > 2)
                break;
            if (chartCount == 1)
            {
                printPage.Chart1Header.Text = cbCompoundStart.Text + " - " + Tests.Where(ts => ts.test_id.Equals(t.test_id)).First().identifier;
                printPage.radChart1.ItemsSource = statData.Where(d => d.test_id.Equals(t.test_id) && d.variable_id.Equals(t.variable_id));
                SetupStatPrintChart1(statData.Where(d => d.test_id.Equals(t.test_id) && d.variable_id.Equals(t.variable_id)).ToList());
            }
            t.printed = true;
        }
        if (chartCount == 1)
        {
            printPage.radChart2.Visibility = System.Windows.Visibility.Collapsed;
            printPage.grdStatData2.Visibility = System.Windows.Visibility.Collapsed;
        }
        e.PageVisual = printPage;
        e.HasMorePages = false;
    }

    The printout looks like the attached image. The chart x axis is formatted properly and the legend is also ok.
    But the line series do not show up. I use the same MappingSeries on the chart in the UI and the line series are showing.

    Here is how I setup the line series if it helps.
    SeriesMapping seriesMapping = new SeriesMapping();
    LineSeriesDefinition redLineSeries = new LineSeriesDefinition();
    LineSeriesDefinition redLineSeries1 = new LineSeriesDefinition();
    LineSeriesDefinition blackLineSeries = new LineSeriesDefinition();
    LineSeriesDefinition orangeLineSeries = new LineSeriesDefinition();
    redLineSeries.ShowPointMarks = false;
    redLineSeries.ShowItemLabels = false;
    redLineSeries.Appearance.StrokeThickness = 1;
    redLineSeries.Appearance.Stroke = new System.Windows.Media.SolidColorBrush(System.Windows.Media.Colors.Red);
    redLineSeries1.ShowPointMarks = false;
    redLineSeries1.ShowItemLabels = false;
    redLineSeries1.Appearance.StrokeThickness = 1;
    redLineSeries1.Appearance.Stroke = new System.Windows.Media.SolidColorBrush(System.Windows.Media.Colors.Red);
    blackLineSeries.ShowPointMarks = false;
    blackLineSeries.ShowItemLabels = false;
    blackLineSeries.Appearance.StrokeThickness = 1;
    blackLineSeries.Appearance.Stroke = new System.Windows.Media.SolidColorBrush(System.Windows.Media.Colors.Black);
    orangeLineSeries.ShowPointMarks = false;
    orangeLineSeries.ShowItemLabels = false;
    orangeLineSeries.Appearance.StrokeThickness = 1;
    orangeLineSeries.Appearance.Stroke = new System.Windows.Media.SolidColorBrush(System.Windows.Media.Colors.Orange);
    seriesMapping = new SeriesMapping();
    seriesMapping.SeriesDefinition = orangeLineSeries;
    seriesMapping.LegendLabel = "ML Historical";
    seriesMapping.ItemMappings.Add(new ItemMapping("RealResultValue", DataPointMember.YValue));
    seriesMapping.ItemMappings.Add(new ItemMapping("start_time_text", DataPointMember.XCategory));
    radChart.SeriesMappings.Add(seriesMapping);
    seriesMapping = new SeriesMapping();
    seriesMapping.SeriesDefinition = blackLineSeries;
    seriesMapping.LegendLabel = "ML";
    seriesMapping.ItemMappings.Add(new ItemMapping("ResultValue", DataPointMember.YValue));
    seriesMapping.ItemMappings.Add(new ItemMapping("start_time_text", DataPointMember.XCategory));
    radChart.SeriesMappings.Add(seriesMapping);
    seriesMapping = new SeriesMapping();
    seriesMapping.SeriesDefinition = redLineSeries;
    seriesMapping.LegendLabel = "Max Failure";
    seriesMapping.ItemMappings.Add(new ItemMapping("MaxFailure", DataPointMember.YValue));
    seriesMapping.ItemMappings.Add(new ItemMapping("start_time_text", DataPointMember.XCategory));
    radChart.SeriesMappings.Add(seriesMapping);
    seriesMapping = new SeriesMapping();
    seriesMapping.SeriesDefinition = redLineSeries1;
    seriesMapping.LegendLabel = "Min Failure";
    seriesMapping.ItemMappings.Add(new ItemMapping("MinFailure", DataPointMember.YValue));
    seriesMapping.ItemMappings.Add(new ItemMapping("start_time_text", DataPointMember.XCategory));
    radChart.SeriesMappings.Add(seriesMapping);

    Thank you for helping me,

    Michel
  2. Answer
    Giuseppe
    Admin
    Giuseppe avatar
    2363 posts

    Posted 02 Aug 2010 Link to this post

    Hello Michel,

    We would suggest you to disable the chart animations (set ChartArea.EnableAnimations = false) prior to printing the document -- see the attached sample application.

    Hope this helps.


    Sincerely yours,
    Freddie
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. DevCraft banner
  4. Michel Hardy
    Michel Hardy avatar
    9 posts
    Member since:
    Jun 2010

    Posted 23 Aug 2010 Link to this post

    Sorry for my late reply, I was in vacation.

    Thank you, the series are now displaying.

    But the graph shows a black header bar on the top (See not rendered chart.jpg).
    If I make the chart render on the screen and then print it (See rendered chart.jpg), that bar is not there.
    Anyway to get rid of it?

    Michel


  5. Answer
    Giuseppe
    Admin
    Giuseppe avatar
    2363 posts

    Posted 26 Aug 2010 Link to this post

    Hello Michel Hardy,

    You can remove the chart title from the print form like this:
    printPage.RadChart1.DefaultView.ChartTitle.Visibility = System.Windows.Visibility.Collapsed;

    Hope this helps.


    Sincerely yours,
    Freddie
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  6. Michel Hardy
    Michel Hardy avatar
    9 posts
    Member since:
    Jun 2010

    Posted 26 Aug 2010 Link to this post

    Thank you so much for your help.

    It works!

    Michel
Back to Top
DevCraft banner