datavisualization chart area modifications

bones

Well-known member
Joined
Aug 23, 2014
Messages
143
Programming Experience
Beginner
I would like to enlarge the actual chart area of a chart. The system leaves a lot of dead space that could be utilized. Looking at chart properties / chart area / collections ...there's a setting for inner plot position. It's set to auto 100 / 100. I set auto to false and tried to increase the numeric value but 100 is the max it will allow... So how does one go about tweaking the actual chart area to make it a bit larger?
 
Most of space as I can see it is because of the legend area defaults to outside ChartArea, usually leaving lots of unused space below it. You can configure Legend to dock inside ChartArea (property Legends > select a Legend > down its properties to Docking section > DockedToChartArea and select one to dock to), ChartArea will then utilize most of Chart control. There are also other docking options there that could utilize space better, even if you can't dock it inside the ChartArea, for example Docking:Top.
Further there are customizations that can be done to ChartArea>Axes that may minimize their space within Chart control.
 
Most of space as I can see it is because of the legend area defaults to outside ChartArea, usually leaving lots of unused space below it. You can configure Legend to dock inside ChartArea (property Legends > select a Legend > down its properties to Docking section > DockedToChartArea and select one to dock to), ChartArea will then utilize most of Chart control. There are also other docking options there that could utilize space better, even if you can't dock it inside the ChartArea, for example Docking:Top.
Further there are customizations that can be done to ChartArea>Axes that may minimize their space within Chart control.

Thanks for that info. I read MS docs on the subject but there is surprisingly no specific detail on increasing chart area... Regardless, I did manage to gain a bit from your advice by altering the legend location and also loosing the Chart Title and also the Axisx Title.

Regarding customization to Axes, do you see anything in my form load code that you would suggest changes to...or additions of?

VB.NET:
 With Chart1.ChartAreas(0)
            Chart1.BorderSkin.SkinStyle = BorderSkinStyle.FrameThin3
            .AxisX.Interval = 1
            .AxisY.Interval = 10
            .AxisX.IsLabelAutoFit = True
            .AxisY.IsStartedFromZero = CheckBox3.AutoCheck.GetTypeCode
            .AxisX.LabelAutoFitStyle = DataVisualization.Charting.LabelAutoFitStyles.DecreaseFont
            .AxisY.LabelAutoFitStyle = DataVisualization.Charting.LabelAutoFitStyles.DecreaseFont
            .AxisX.LabelStyle.Angle = -45
            .AxisX.Title = ""
            .AxisY.Title = "CFM"
            .BackColor = cboChartAreaColor.SelectedItem
 
do you see anything in my form load code that you would suggest changes to...or additions of?
I would first remove all code that sets a fixed value and configure that in designer instead :)

.AxisY.IsStartedFromZero = CheckBox3.AutoCheck.GetTypeCode
IsStartedFromZero property is type Boolean, while GetTypeCode return a TypeCode enumeration value. That won't compile if you have Option Strict On, which you should. It doesn't make anyway, because any boolean value will always return same type code.
.BackColor = cboChartAreaColor.SelectedItem
When you turn on Option Strict you will have to cast type of SelectedItem, which is type Object, to correct type that is assigned, and that is type Color. Intellisense will offer to correct that for you automatically (in Error Correction Options).
 
Back
Top