Click here to Skip to main content
15,905,508 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
I'm using the MS Chart controls for .Net 3.5, and trying to use its automatic axis view selection feature:
mainChartArea.CursorX.IsUserSelectionEnabled = mainChartArea.CursorY.IsUserSelectionEnabled = true;

This works okay, but on the X axis, the visible range has an extra margin on both sides beyond what was actually selected, typically of 1 unit (so if I select 1.6 to 3.2, it will show 0.6 to 4.2). It appears there is a private 'marginView' in the Axis class which gets set internally that causes this to happen, and I don't see a way of turning that off.

The Y axis has a margin of zero and the view selection works perfectly.

So my question is: has anyone else had this problem, and what did you do to fix or work around it?
Updated 1-Jun-11 22:40pm

1 solution

This should fix the problem.

.AxisX.IsMarginVisible = False
Share this answer
BobJanova 2-May-12 13:42pm    
I'm not working on this software any more, but thanks.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900