Home Forums WinForms controls Xceed Chart for WinForms Chart Margins – what am I missing?

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

    For some reason the chart Width/Height and Margins values just haven’t clicked in my brain. It certainly doesn’t seem very intuitive to me. The documentation suggests the margins “can be thought of as percentages” – well, are they percentages, or are they not? It doesn’t seem to work that way. If they are, what are they percentages of? How do they interact with the chart Height and Width properties, or the chartcontrol’s width and height? In the documentation it suggests the margins can be thought of as percentages, but then describes how I have to calculate the margin values – if they were percentages of the control’s height and width, surely I wouldn’t have to do that. The documentation badly needs some diagrams, to show the results of the given examples. This should-be-simple thing is driving me insane – any clarification will be most welcome.

    Imported from legacy forums. Posted by Steve (had 3255 views)

    User (Old forums)
    Member
    Post count: 23064

    Basically, due to OpenGL rendering of the chart, the value is interpreted within the control depending on how the chart was rendered, that is, what it appears to be relative to depends on how it is rendered (because of the 3D engine).

    Here is a <a href=”http://forums.xceed.com/forums/ShowPost.aspx?PostID=4757″>thread</a&gt; that explains the same for axis position.

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

    User (Old forums)
    Member
    Post count: 23064

    Digging a bit further this issue, we can add the following, which I hope will help a bit.

    Setting the Margins property will only have an effect if the MarginMode property is set to “Fit” or “Stretch”.

    In both cases, the 4 values passed to the RectangleF constructor are:

    X: The horizontal margin %
    Y: The vertical margin %
    Width: The % of the width that the chart must take in the ChartControl.
    Height: The % of the height that the chart must take in the ChartControl.

    Concerning the difference between the “Fit” and “Stretch” margin modes, here is what to expect:

    Fit: The chart will grow or shrink so that it will fit in the specified % of the margins, while respecting its initial ratio.

    Stretch: The chart will stretch to perfectly fill the % specified in the margins, without respecting the chart’s initial ratio.

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

    User (Old forums)
    Member
    Post count: 23064

    Thanks – I had actually discovered in the meantime that Stretch mode was the best way to get the result I wanted, and expected.

    Imported from legacy forums. Posted by Steve (had 4282 views)

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