Home Forums WinForms controls Xceed Chart for WinForms What is the best way to dynamically size BarSeries chart?

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • User (Old forums)
    Member
    Post count: 23064
    #19066 |

    Hi, I have question about how to properly size a chart so that it has the best readability.
    I have a BarSeries chart set up but my problem is that depending on user’s selction the series could have anywhere between 5 ~ 30 dimensions on X-axis. Now with fixed size of the chart, it display fine for small dimensions but when dimension becomes higher than 10, it becomes difficult to see all the values (bars become too small, etc.)
    Size of the chart can change but I am not sure how to programatically set this up.

    Is there a way to dynamically change the size of the chart so it maintains the same readability no matter how many dimensions are added to it?

    Imported from legacy forums. Posted by Jay (had 2094 views)

    User (Old forums)
    Member
    Post count: 23064

    Unfortunately not.  You will need to implement your own algorithm to resize the chart as you add new bars to it.  You can start by setting the MarginMode property to Stretch or Fit (depending if you want the chart to keep proportions), and set an initial value for the Margin property, and then increase of decrease margins as you increase of decrease the number of bars in the chart.

    e.g.:

    chart.MarginMode =

    MarginMode.Stretch;

    chart.Margins =

    new RectangleF( 10, 10, 80, 80 );

    You can look at the our Chart Explorer ( Start Menu -> All Programs -> Xceed Components -> Our components in action! -> Xceed Chart Explorer for .NET ), for examples on how to adjust margins. Go to All Examples -> Chart.

    You can look at the code by clicking on the “C# Code” tab.  You also will find the complete source code of the explorer in both C# and VB.NET in -> C:\Program Files\Xceed Components\Xceed Chart for .NET and ASP.NET <version>\Samples under XP, or in C:\Xceed Component Samples\Xceed Chart for .NET <version>\Samples under Vista.

     

    Imported from legacy forums. Posted by André (had 2771 views)

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.