Hi Hasindu,
You need to recalculate the chart layout and check what is the legend height in order to dynamically resize the control – the following code snippet shows how to achieve this:
NThinChartControl1.Settings.JitterMode = JitterMode.Enabled;
NThinChartControl1.BackgroundStyle.FrameStyle.Visible = false;
// setup chart
NChart chart = NThinChartControl1.Charts[0];
chart.BoundsMode = BoundsMode.Stretch;
chart.Dock = DockStyle.Fill;
chart.Margins = new NMarginsL(10, 10, 10, 10);
for (int i = 0; i < 20; i++)
{
NBarSeries bar = new NBarSeries();
bar.Values.Add(i);
chart.Series.Add(bar);
}
// recalculate layout
NThinChartControl1.RecalcLayout();
// update height
NLegend legend = NThinChartControl1.Legends[0];
NThinChartControl1.Height = new Unit(legend.ContentArea.Bottom + 10, System.Web.UI.WebControls.UnitType.Pixel);
Best Regards,
Nevron Support Team