Printing from ViewModel

3 posts, 0 answers
  1. jay
    jay avatar
    10 posts
    Member since:
    Mar 2011

    Posted 03 Mar 2011 Link to this post

    I'm attempting to build a linechart from the view model for printing.  The chart shows up, however there is no data graphed.  I've reviewed several samples and have been unable to find the problem.  Here is the code that builds the chart:

    RadChart

     

     

    rptChart= new RadChart();

     

     

    rptChart.DefaultView.ChartArea.PaletteBrushes.Add(

     

    new SolidColorBrush(Colors.Blue));

     

     

    rptChart.DefaultView.ChartArea.Margin =

     

    new Thickness(0,0,0,5);

     

     

    rptChart.DefaultView.ChartArea.AxisX.IsDateTime =

     

    true;

     

     

    rptChart.DefaultView.ChartArea.AxisX.AutoRange =

     

    false;

     

     

    rptChart.DefaultView.ChartArea.AxisX.DefaultLabelFormat =

     

    "MM/dd/yyyy";

     

     

    rptChart.DefaultView.ChartArea.AxisX.LabelRotationAngle = 25;

     

    rptChart.DefaultView.ChartArea.AxisX.Step = 1;

     

    rptChart.DefaultView.ChartArea.AxisX.LabelStep = 5;

     

    rptChart.DefaultView.ChartArea.AxisX.MaxValue = MaxDateShown;

     

    rptChart.DefaultView.ChartArea.AxisX.MinValue = MinDateShown;

     

    rptChart.DefaultView.ChartLegend.Visibility =

     

    Visibility.Collapsed;

     

     

    rptChart.ItemsSource = Data; //Data is an observableCollection

     

    rptChart.MaxHeight = 200;

     

    rptChart.MaxWidth = 450;

     

    rptChart.MinWidth = 350;

     

    rptChart.MinHeight = 150;

     

    Telerik.Windows.Controls.Charting.

     

    SeriesMapping sm = new Telerik.Windows.Controls.Charting.SeriesMapping();

     

     

    sm.LegendLabel =

     

    "legendLabel";

     

     

    sm.SeriesDefinition =

     

    new Telerik.Windows.Controls.Charting.LineSeriesDefinition();

     

     

    sm.ItemMappings.Add(

     

    new Telerik.Windows.Controls.Charting.ItemMapping("ReportDate", Telerik.Windows.Controls.Charting.DataPointMember.XValue));

     

     

    sm.ItemMappings.Add(

     

    new Telerik.Windows.Controls.Charting.ItemMapping("Quantity", Telerik.Windows.Controls.Charting.DataPointMember.YValue));

     

     

    rptChart.SeriesMappings.Add(sm);

    I then add the chart to the grid for printing.  Any ideas on what is preventing the line from showing up?  The chart shows up on the printed page formatted correctly, just no line.

    Thanks,
    Jay.

  2. jay
    jay avatar
    10 posts
    Member since:
    Mar 2011

    Posted 03 Mar 2011 Link to this post

    I have tried what was suggested in another thread (http://www.telerik.com/community/forums/silverlight/chart/line-series-not-showing-when-printing-chart.aspx).  I set ChartArea.EnableAnimations = false;  This did not fix the issue for me.
  3. Giuseppe
    Admin
    Giuseppe avatar
    2363 posts

    Posted 09 Mar 2011 Link to this post

    Hello jay,

    We have addressed your inquiry in the other forum thread you have opened on the printing topic.


    Greetings,
    Giuseppe
    the Telerik team
    Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
Back to Top