Changing the zoom level of NLabel control during export


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

By Irina - 8 Years Ago
Hi,
When exporting a chart control to an image, I can specify the desired size of the image. If this size is less than the size of the control, the chart will be zoomed out, but the NLabel control will have the same size. Is it possible to change the zoom level of the NLabel control based on the specified dimensions during export?
By Nevron Support - 8 Years Ago
Hi Irina,
Yes you can use relative units to specify the size of the header - for example:

   nChartControl1.Panels.Clear();

   NLabel label = new NLabel("Some Label");
   label.BoundsMode = BoundsMode.Fit;
   label.TextStyle.FontStyle.EmSize = new NLength(5, NRelativeUnit.RootPercentage);
   label.DockMode = PanelDockMode.Top;
   nChartControl1.Panels.Add(label);

   NCartesianChart chart = new NCartesianChart();
   chart.DockMode = PanelDockMode.Fill;
   nChartControl1.Panels.Add(chart);

   NBarSeries bar = new NBarSeries();
   bar.Values.Add(10);
   bar.Values.Add(20);
   bar.Values.Add(30);
   chart.Series.Add(bar);

Alternatively you can simply set the font size depending on the export image size.
By Irina - 8 Years Ago
Hi,
Your approach works. Thank you!