Error Saving Chart 2013 Q2 for WPF

6 posts, 0 answers
  1. Antonello Giuseppe
    Antonello Giuseppe avatar
    1 posts
    Member since:
    Nov 2013

    Posted 14 Nov 2013 Link to this post

    Hello,

    I'm trying to save a radchart to a file using the save() method.
    No matther what method overload I use I always get an ArgumentOutOfRange Exception with the following description:

    [System.ArgumentOutOfRangeException] = {"The parameter value must be greater than zero.\r\nParameter name: pixelWidth"}

    I'm not able to figure where to set that parameter in the RadChart.

    Documentation on the method does not provide any usage examples and all the old posts on the forum I've found point on this issue to a demo page that no more exist (they point to demos based on chartview now).

    Thanks for help

    Antonello


  2. Yavor
    Admin
    Yavor avatar
    401 posts

    Posted 19 Nov 2013 Link to this post

    Hi Antonello,

    Given only the provided information we are not able to determine the cause of the problem. In order to help you we will need to reproduce the problem on our side, so we can investigate it. It would be best if you could provide a small runnable project. or made modifications to the project that I attached so that it reproduces the problem you are experiencing. 

    Thanks for the understanding.

    Regards,
    Yavor
    Telerik
    TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
  3. UI for WPF is Visual Studio 2017 Ready
  4. Sergiy
    Sergiy avatar
    38 posts
    Member since:
    Jan 2012

    Posted 26 Dec 2013 Link to this post

    I have got a simple code:

    public class ProductSales
    {
        public ProductSales(int quantity, int month, string monthName)
        {
            Quantity = quantity;
            Month = month;
            MonthName = monthName;
        }
     
        public int Quantity { get; set; }
        public int Month { get; set; }
        public string MonthName {get; set; }
    }
     
    public sealed class Program
    {
        private static List<ProductSales> CreateData()
        {
            return new List<ProductSales>
            {
                new ProductSales(154, 1, "January"),
                new ProductSales(138, 2, "February")
            };
        }
     
        [STAThread]
        public static void Main()
        {
            var rc = new RadChart();
            var seriesMapping = new SeriesMapping
            {
                LegendLabel = "Product Sales",
                SeriesDefinition = new SplineSeriesDefinition()
            };
            seriesMapping.ItemMappings.Add(new ItemMapping("Month", DataPointMember.XValue));
            seriesMapping.ItemMappings.Add(new ItemMapping("Quantity", DataPointMember.YValue));
     
            rc.SeriesMappings.Add(seriesMapping);
            rc.ItemsSource = CreateData();
                           // GOT AN EXCEPTION
            var stream = rc.Save();
                           // GOT AN EXCEPTION
            rc.ExportToImage(new MemoryStream());
     
        }
    }

     I don't want hearing anything about XAML! I just want to create Chart in code-behind and get stream of image, but I always got an exception.

    Is it possible?




  5. Pavel R. Pavlov
    Admin
    Pavel R. Pavlov avatar
    1182 posts

    Posted 31 Dec 2013 Link to this post

    Hi,

    We managed to achieve your requirement in the attached project. Please take a look at it and let us know if you need any further assistance.

    Regards,
    Pavel R. Pavlov
    Telerik
    TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
  6. Sergiy
    Sergiy avatar
    38 posts
    Member since:
    Jan 2012

    Posted 08 Jan 2014 Link to this post

    wittily done) but its works for me, thanks.

    What about custom theme of chart? Can I change default theme to Metro for example? How?



  7. Pavel R. Pavlov
    Admin
    Pavel R. Pavlov avatar
    1182 posts

    Posted 13 Jan 2014 Link to this post

    Hello Sergiy,

    In your particular case you can use the StyleManager to set the theme. You can set it like this:

    StyleManager.SetTheme(chart, new Windows8Theme());

    I hope this information is helpful.

    Regards,
    Pavel R. Pavlov
    Telerik
    TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
Back to Top
UI for WPF is Visual Studio 2017 Ready