Hi Bhumi,
Yes - you can conditionally add the chart to the control panels collection - the following code snippet shows how to achieve such behaviour:
private void UpdateChart()
{
nChartControl1.Panels.Clear();
// create a chart that is not added to the control
NCartesianChart chart = new NCartesianChart();
NBarSeries bar =new NBarSeries();
// feed data (in this case the chart will have
// some data points randomly)
Random rand = new Random();
if ((rand.Next() % 2) == 1)
{
bar.Values.Add(10);
bar.Values.Add(20);
bar.Values.Add(30);
}
chart.Series.Add(bar);
// check if there is data and add the chart panel
if (bar.Values.Count == 0)
{
NLabel label = new NLabel("There is no data");
label.ContentAlignment = ContentAlignment.MiddleCenter;
label.Location = new NPointL(new NLength(50, NRelativeUnit.ParentPercentage), new NLength(50, NRelativeUnit.ParentPercentage));
nChartControl1.Panels.Add(label);
}
else
{
nChartControl1.Panels.Add(chart);
}
nChartControl1.Refresh();
}
Hope this helps - let us know if you meet any problems...
Best Regards,
Nevron Support Team