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
Replies
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
Joël Golinucci (7/10/2014)
You can find the project zip here : DemoNevronChartBorderBug.zip


Did you have any issue downloading it ?

I've tried to add it directly to the post but the forum doesn't allow me to (file too big).
https://www.nevron.com/forum/uploads/images/13b0b969-0844-49bb-b017-0965.png

Also the message "an attachment is uploading..." stays after the message 

Anyway, please let me know directly if you have any issue downloading the file from http://www.onlineautomation.ch/jgolinuc/forum/DemoNevronChartBorderBug.zip



Nevron Support
Nevron Support
Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)
Group: Administrators
Posts: 3.1K, Visits: 4.2K
Hi Joel,
We just reviewed the project again - why do you have to use the range series for a chart that is essentially 2D? In 2D mode it is much easier to set the chart bounds so that that they fill the area completely:

   NChart chart = nChartControl1.Charts[0];

   chart.BoundsMode = BoundsMode.Stretch;
   chart.DockMode = PanelDockMode.Fill;

   chart.Axis(StandardAxis.PrimaryX).Visible = false;
   chart.Axis(StandardAxis.PrimaryY).Visible = false;

   chart.Wall(ChartWallType.Back).FillStyle = new NColorFillStyle(Color.Green);

Hope this helps - let us know if you meet any problems or have any questions.


Best Regards,
Nevron Support Team


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