Nevron Forum

Decluttering Surface Labels

https://www.nevron.com/Forum/Topic4058.aspx

By Ioannis Psomadakis - Friday, August 27, 2010

Hello,  I need to display the data using the Surface control.  My 3D data is (Numeric, Numeric, Date).  I used the Grid Sub Type.  On the Data settings, the Labels for the Category and Series are set to be strings. So the Chart plots a (Numeric, String, String) surface.

As you can see from the attachment, the Labels are cluttered and one overwrites the other with very small fonts.  Is there way to tell the Chart to display one every say 10 values?  Any recommendation on decluttering and improving the label visibility?

Thanks

By Nevron Support - Monday, August 30, 2010

Hi Ioannis,

Yes you can modify the number of labels per a group of ticks using custom code (this feature will be exposed in the next edition of the control trough the designer as well):

using System;
using System.Drawing;
using Nevron.GraphicsCore;
using Nevron.Chart;
using Nevron.ReportingServices;

namespace MyNamespace
{
 public class MyClass
 {
  /// <summary>
  /// Main entry point
  /// </summary>
  /// <param name="context"></param>
  public static void RSMain(NRSChartCodeContext context)
  {
   if (context.Document.Charts.Count == 0)
    return;

   NCartesianChart chart = context.Document.Charts[0] as NCartesianChart;
   if (chart == null)
    return;

   NOrdinalScaleConfigurator ordinalScale = chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator as NOrdinalScaleConfigurator;
   if (ordinalScale != null)
   {
    // set number of ticks per label.
    ordinalScale.NumberOfTicksPerLabel = 10;
   }

   ordinalScale = chart.Axis(StandardAxis.Depth).ScaleConfigurator as NOrdinalScaleConfigurator;
   if (ordinalScale != null)
   {
    // set number of ticks per label.
    ordinalScale.NumberOfTicksPerLabel = 10;
   }
  }
 }
}


Alternatively you can use:

ordinalScale.MajorTickMode = MajorTickMode.AutoMaxCount;
ordinalScale.MinTickDistance = new NLength(20);

instead of:

ordinalScale.NumberOfTicksPerLabel = 10;

for the X/Depth axes - in this case the control will place labels spaced between 20 points on the axis.

Let us know if you meet any problems...