Skip to content

Problem with MS Chart control while assigning width to chart

Nagarjun G N

Asked Feb 5, 2015, 12:12 AM EST1 answer
Share
LinkedInX
Hi guys,
 
I am facing problem in MS Chart Control.
If i set width to chart it expands and starts from another point.
Y chart moves from one place to other while assigning width to it...? 
Any help would be helpful. 

1 Answer

Know the answer? Post it. Somebody with the same question will find it here.

  • 0
    Hi, I'm not sure are making your charts, but have a look at this article to see how you can create Excel charts in C#.
    For example let's say you have defined the following chart control:
    C#
    // Create chart.
    var chart = sheet.Charts.Add(ChartType.Bar, "D2", "M25");
    // Select data for it.
    chart.SelectData(sheet.Cells.GetSubrange("A1", "D5"), true);
    And later on you want to change its width, you would just need to use something like the following:
    Code
    // Double a chart's size.
    chart.Position.Width *= 2;
    chart.Position.Height *= 2;
    Note that this API comes from this excel's component for a C# code.
    0