This is a migrated thread and some comments may be shown as answers.

Error Saving Chart 2013 Q2 for WPF

5 Answers 108 Views
Chart
This is a migrated thread and some comments may be shown as answers.
Antonello Giuseppe
Top achievements
Rank 1
Antonello Giuseppe asked on 14 Nov 2013, 10:19 AM
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


5 Answers, 1 is accepted

Sort by
0
Yavor
Telerik team
answered on 19 Nov 2013, 11:36 AM
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 >>
0
Sergiy
Top achievements
Rank 1
answered on 26 Dec 2013, 04:40 PM

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?




0
Pavel R. Pavlov
Telerik team
answered on 31 Dec 2013, 03:07 PM
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 >>
0
Sergiy
Top achievements
Rank 1
answered on 08 Jan 2014, 10:14 AM

wittily done) but its works for me, thanks.

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



0
Pavel R. Pavlov
Telerik team
answered on 13 Jan 2014, 07:52 AM
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 >>
Tags
Chart
Asked by
Antonello Giuseppe
Top achievements
Rank 1
Answers by
Yavor
Telerik team
Sergiy
Top achievements
Rank 1
Pavel R. Pavlov
Telerik team
Share this question
or