How to ensure full size graph ?


Author
Message
Joël Golinucci
Joël Golinucci
Junior Member (18 reputation)Junior Member (18 reputation)Junior Member (18 reputation)Junior Member (18 reputation)Junior Member (18 reputation)Junior Member (18 reputation)Junior Member (18 reputation)Junior Member (18 reputation)Junior Member (18 reputation)
Group: Forum Members
Posts: 30, Visits: 61
Hi again,

Sorry to spam the forum with this third topic in a row but I thought this might need to be ask in a separate topic.

How can I make my graph take the whole available space in the NChart object ? Chart is 3D, but for now only seen with an OrthogonalTop projection.

I need no axis or walls at all, but setting their visible property to false doesn't seems to be enough.

Here is the code I use to create the chartControl and the chart object.


Protected Sub CreateGraph()
SyncLock fLockForChart
' Define the chart control (place holder for the graph)
fChartControl = New NChartControl()
fChartControl.Charts.Clear()
fChartControl.Name = String.Format("chartControl_{0}", fSubPile.ToString())
fChartControl.Dock = DockStyle.Fill
fChartControl.Margin = New Padding(0)
fChartControl.Padding = New Padding(0)
fChartControl.BackgroundStyle.FrameStyle.Visible = False
AddHandler fChartControl.Click, AddressOf Chart_Click
AddHandler fChartControl.MouseDown, AddressOf Chart_MouseDown

Dim zMin As Integer = fSubPile.Parent.DimMinZ.Value, zMax As Integer = Integer.Parse(fSubPile.Parent.DimMaxZ.Value) + Integer.Parse(fDataStorage.CellDimZ.Value)
' Define the graph and set its parameters
fChart = New NCartesianChart()
fChart.Series.Clear()
fChart.Name = String.Format("nGraph_{0}", fSubPile.ToString())
fChart.Enable3D = True
fChart.Projection.SetPredefinedProjection(PredefinedProjection.OrthogonalTop)
fChart.LightModel.SetPredefinedLightModel(PredefinedLightModel.None)
fChart.BackgroundFillStyle = New NColorFillStyle(Color.LightBlue) ' For screenshot on Nevron Forum only
fChart.Dock = DockStyle.Fill
fChart.Location = New NPointL(0, 0)
fChart.BoundsMode = BoundsMode.Stretch
fChart.Padding = New NMarginsL(0)
fChart.Margins = New NMarginsL(0)
fChart.Height = zMax - zMin
fChart.Axes(StandardAxis.PrimaryY).View = New NRangeAxisView(New NRange1DD(zMin, zMax))
For Each wall As NChartWall In fChart.Walls
'wall.Visible = False ' This is commentend to show the diffrence between screenshots
wall.Width = 0
Next
'For Each axis As NCartesianAxis In fChart.Axes
' axis.Visible = False ' This is also commented only for the screenshot
'Next

' Define the point series
fRangeSeries = New NRangeSeries()
fRangeSeries.Name = String.Format("nPointSeries_{0}", fSubPile.ToString())
fRangeSeries.InflateMargins = False
fRangeSeries.DataLabelStyle.Visible = False
fRangeSeries.Legend.Mode = SeriesLegendMode.None
fRangeSeries.BorderStyle.Width = New NLength(0)
fRangeSeries.UseXValues = True
fRangeSeries.UseZValues = True
fRangeSeries.Shape = BarShape.Bar


' Add the serie to the graph, the graph to its place holder and the whole to the panel (subPileView)
fChart.Series.Add(fRangeSeries)
fChartControl.Charts.Add(fChart)
Me.Controls.Add(fChartControl)
End SyncLock
End Sub



On the attached screenshot you will see that we are still able to see the blue background (with axis visible and not). What do I need to change to have the plot covering the blue area ?


Thanks for your help,

Best regards,

Joël
Reply
Joël Golinucci
Joël Golinucci
Junior Member (18 reputation)Junior Member (18 reputation)Junior Member (18 reputation)Junior Member (18 reputation)Junior Member (18 reputation)Junior Member (18 reputation)Junior Member (18 reputation)Junior Member (18 reputation)Junior Member (18 reputation)
Group: Forum Members
Posts: 30, Visits: 61
Hello,

Thanks for the answer, unfortunately this is not completely that, a bit better though but not perfect yet.

First this command is not correct:
fChart.DockMode = PanelDockMode.Fill


I had to replace it with this:
fChart.Dock = DockStyle.Fill



I understand that instead of placing the chart in the NChartControl1.Charts we put it in its Panels list, but I am have a few questions regarding the other changes :

1) Why are we using the value 50 in the chart width and depth ?
2) What is the point of naming the scale configurator title ? Especially if we are going to hide it after ?


Here is the modified code corresponding to the attached screenshot :


' Define the chart control (place holder for the graph)
fChartControl = New NChartControl()
fChartControl.Charts.Clear()
fChartControl.Panels.Clear()
fChartControl.Name = String.Format("chartControl_{0}", fSubPile.ToString())
fChartControl.Dock = DockStyle.Fill
fChartControl.Margin = New Padding(0)
fChartControl.Padding = New Padding(0)
fChartControl.BackgroundStyle.FrameStyle.Visible = False
AddHandler fChartControl.Click, AddressOf Chart_Click
AddHandler fChartControl.MouseDown, AddressOf Chart_MouseDown

' Define the graph and set its parameters
fChart = New NCartesianChart()
fChartControl.Panels.Add(fChart)
fChart.Series.Clear()
fChart.Enable3D = True
fChart.Projection.SetPredefinedProjection(PredefinedProjection.OrthogonalTop)
fChart.LightModel.SetPredefinedLightModel(PredefinedLightModel.None)
fChart.BackgroundFillStyle = New NColorFillStyle(Color.Yellow)
fChart.Dock = DockStyle.Fill 'There is no DockMode property in the NCartesianChart class. Incorrect code: fChart.DockMode = PanelDockMode.Fill
fChart.Location = New NPointL(0, 0)
fChart.BoundsMode = BoundsMode.Fit
fChart.Padding = New NMarginsL(0)
fChart.Margins = New NMarginsL(0)
For Each wall As NChartWall In fChart.Walls
   wall.Visible = False
   wall.Width = 0
Next
Dim aspect As Double = fChartControl.Width / fChartControl.Height
fChart.Width = aspect * 50
fChart.Depth = 50
fChart.Axis(StandardAxis.Depth).ScaleConfigurator.Title.Text = "Depth"
For Each axis As NCartesianAxis In fChart.Axes
   axis.Visible = False
Next



GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Threaded View
Threaded View
Joël Golinucci - 11 Years Ago
Nevron Support - 11 Years Ago
Joël Golinucci - 11 Years Ago
Nevron Support - 11 Years Ago
Joël Golinucci - 11 Years Ago
Joël Golinucci - 11 Years Ago
Nevron Support - 11 Years Ago
Joël Golinucci - 11 Years Ago
Nevron Support - 11 Years Ago
Joël Golinucci - 11 Years Ago
Joël Golinucci - 11 Years Ago
Nevron Support - 11 Years Ago
Joël Golinucci - 11 Years Ago
Nevron Support - 11 Years Ago

Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search