Regarding dynamically positioned charts - we would recommend to use percentages when you specify lengths - the following code snippet shows how to create a dynamically resizable layout with three columns and two rows of charts:
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
int colCount = 3;
int rowCount = 2;
float colSize = 100 / colCount;
float rowSize = 100 / rowCount;
nChartControl1.Panels.Clear();
for (int col = 0; col < colCount; col++)
{
NDockPanel dock = new NDockPanel();
// specify spacing between the columns
if (col == colCount - 1)
{
dock.Padding = new NMarginsL(0, 0, 10, 0);
}
else
{
dock.Padding = new NMarginsL(10, 0, 0, 0);
}
dock.PositionChildPanelsInContentBounds = true;
dock.Location = new NPointL(new NLength(col * colSize, NRelativeUnit.ParentPercentage), new NLength(0));
dock.Size = new NSizeL(new NLength(colSize, NRelativeUnit.ParentPercentage), new NLength(100, NRelativeUnit.ParentPercentage));
for (int row = 0; row < rowCount; row++)
{
NChart chart = CreateChart();
// specify spacing between rows
if (row == rowCount - 1)
{
chart.Padding = new NMarginsL(0, 0, 0, 10);
}
else
{
chart.Padding = new NMarginsL(0, 10, 0, 0);
}
chart.Location = new NPointL(new NLength(0), new NLength(row * rowSize, NRelativeUnit.ParentPercentage));
chart.Size = new NSizeL(new NLength(100, NRelativeUnit.ParentPercentage), new NLength(rowSize, NRelativeUnit.ParentPercentage));
dock.ChildPanels.Add(chart);
}
nChartControl1.Panels.Add(dock);
}
}
private NChart CreateChart()
{
NCartesianChart chart = new NCartesianChart();
NBarSeries bar = new NBarSeries();
bar.Values.Add(10);
bar.Values.Add(20);
bar.Values.Add(30);
chart.Series.Add(bar);
chart.BoundsMode = BoundsMode.Stretch;
return chart;
}
private void button1_Click(object sender, EventArgs e)
{
nChartControl1.ShowEditor();
}
}
Hope this helps - let us know if you meet any problems or have any questions.
Best Regards,
Nevron Support Team