Offsetting Series Labels


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

By Irina - 7 Years Ago
Hi,
Is it possible to change the position of the series labels? It seems that changing DataLabelStyle.TextStyle.Offset property has no effect.
By Nevron Support - 7 Years Ago
Hi Irina,
You need to use the ArrowLength property of the data label style:
point.DataLabelStyle.ArrowLength = new NLength(20, NGraphicsUnit.Point);

Let us know if you have any questions.

By Irina - 7 Years Ago
Hi,
Thank you for the answer, but I want to offset labels only horizontally (to the right). Is it possible?
By Nevron Support - 7 Years Ago
Hi Irina,
Can you please elaborate by sending us a small picture of how the label should be aligned / positioned.
By Irina - 7 Years Ago
Hi,
I want to show  labels in the middle of the step line segments. Please see the attached image. 

By Nevron Support - 7 Years Ago
Hi Irina,
You can achieve this with the help of a second point series that has data points offset by 0,5 from the line series points. For example:

   NChart chart = nChartControl1.Charts[0];

   NStepLineSeries line = new NStepLineSeries();
   line.DataLabelStyle.Visible = false;

   line.Values.Add(10);
   line.Values.Add(20);
   line.Values.Add(30);

   chart.Series.Add(line);

   NPointSeries point = new NPointSeries();
   point.Size = new Nevron.GraphicsCore.NLength(0);
   point.UseXValues = true;

   for (int i = 0; i < line.Values.Count - 1; i++)
   {
    point.Values.Add(line.Values[i]);
    point.XValues.Add(i + 0.5);
   }

   chart.Series.Add(point);

Hope this helps - let us know if you meet any problems.
By Irina - 7 Years Ago
Thank you!