Multiple line charts in frame


https://www.nevron.com/Forum/Topic13146.aspx
Print Topic | Close Window

By Mike O'Ceirin - 4 Years Ago
I have this Line chart within a frame. I want to add another chart below it. The second chart relates strongly to the first part but for clarity I do not want to combine it with the first. Is that possible?
https://www.nevron.com/forum/uploads/images/065e03a5-a8de-4cd3-aec6-b9cf.jpg
By Nevron Support - 4 Years Ago
Hi Mike,

Yes, it is possible to align two chart panels - the following code shows the most simple case of two charts that split the control height:

// create a layout of two chart panels docked on top of each other
nChartControl1.Panels.Clear();

NCartesianChart chart1 = new NCartesianChart();
nChartControl1.Panels.Add(chart1);
chart1.BoundsMode = BoundsMode.Stretch;
chart1.Margins = new NMarginsL(5, 5, 5, 2.5f);
chart1.DockMode = PanelDockMode.Top;
chart1.Location = new NPointL(0, 0);
chart1.Size = new NSizeL(new NLength(0), new NLength(50, NRelativeUnit.ParentPercentage));

NCartesianChart chart2 = new NCartesianChart();
nChartControl1.Panels.Add(chart2);
chart2.BoundsMode = BoundsMode.Stretch;
chart2.Margins = new NMarginsL(5, 2.5f, 5, 5);
chart2.DockMode = PanelDockMode.Top;
chart2.Location = new NPointL(new NLength(0), new NLength(50, NRelativeUnit.ParentPercentage));
chart2.Size = new NSizeL(new NLength(0), new NLength(50, NRelativeUnit.ParentPercentage));

// you may want to align the chart by their left plot side
NSideGuideline guideLine = new NSideGuideline();
nChartControl1.document.RootPanel.Guidelines.Add(guideLine);

guideLine.Side = PanelSide.Left;
guideLine.Targets.Add(chart1);
guideLine.Targets.Add(chart2);

You can also take a look at the following desktop example:
All Examples \ Panels \ Guidelines \ Side guideline

We hope this helps - let us know if you meet any problems...

By Mike O'Ceirin - 4 Years Ago
Thank you for your help. I have tried to find the desktop example and have looked here Nevron Web Examples but it seems that is not the right place can you please help?
By Nevron Support - 4 Years Ago
Hi Mike,
You can open the following solution in VS:
C:\Program Files (x86)\Nevron Software\Nevron .NET Vision 2019.1 for VS2019\Examples\Chart\WinForm\CSharp\Nevron.Examples.Chart.WinForm.VS2019.sln

it contains the desktop examples. When you launch the solution just navigate to:
All Examples \ Panels \ Guidelines \ Side guideline

The code to configure guidelines is the same for WinForms and ASP.NET.
We hope this helps - let us know if you meet any problems.