Profile Picture

Set NRoundedRectangularCallout position

Posted By Elvira Aminova 11 Years Ago
Author
Message
Elvira Aminova
questionmark Posted 11 Years Ago
View Quick Profile
Junior Member

Junior Member (10 reputation)Junior Member (10 reputation)Junior Member (10 reputation)Junior Member (10 reputation)Junior Member (10 reputation)Junior Member (10 reputation)Junior Member (10 reputation)Junior Member (10 reputation)Junior Member (10 reputation)

Group: Forum Members
Last Active: 10 Years Ago
Posts: 10, Visits: 1
Hello!

I use NRoundedRectangularCallout to mark last points of each line.

NRoundedRectangularCallout rectangularCallout = new NRoundedRectangularCallout();
rectangularCallout.ArrowLength = new NLength(15, NRelativeUnit.ParentPercentage);
rectangularCallout.ArrowBasePercent = 10;
rectangularCallout.FillStyle = new NColorFillStyle(Color.White);
rectangularCallout.UseAutomaticSize = true;
rectangularCallout.Orientation = 0;
rectangularCallout.Anchor = new NDataPointAnchor(line, line.Values.Count - 1, ContentAlignment.BottomCenter, StringAlignment.Center);

The result is on the picture "1.png". You can see that some callouts are overlaped.

I need something like this: see "2.png" (I manually change the callouts location).
Сallouts are one under the other and not overlap each other. How can I achieve this by code?

Attachments
1.png (339 views, 141.00 KB)
2.png (344 views, 152.00 KB)
Nevron Support
Posted 11 Years Ago
View Quick Profile
Supreme Being

Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)

Group: Forum Members
Last Active: 4 hours ago
Posts: 3,054, Visits: 4,012
Hi Elvira,

The control does not support automatic overlapping resolve for callouts. You can however use a different approach and that is to place a data label at the end of each line - data labels have support for non overlapping (check out the Panels\Chart\Automatic Label Layout) example.

Best Regards,
Nevron Support Team



Elvira Aminova
Posted 11 Years Ago
View Quick Profile
Junior Member

Junior Member (10 reputation)Junior Member (10 reputation)Junior Member (10 reputation)Junior Member (10 reputation)Junior Member (10 reputation)Junior Member (10 reputation)Junior Member (10 reputation)Junior Member (10 reputation)Junior Member (10 reputation)

Group: Forum Members
Last Active: 10 Years Ago
Posts: 10, Visits: 1
I probably found the solution.

Need to use rectangularCallout.Orientation - the angle between callout arrow and X-axis;
rectangularCallout.ArrowLength - the distance between data point on line and a callout.

Elvira Aminova
Posted 11 Years Ago
View Quick Profile
Junior Member

Junior Member (10 reputation)Junior Member (10 reputation)Junior Member (10 reputation)Junior Member (10 reputation)Junior Member (10 reputation)Junior Member (10 reputation)Junior Member (10 reputation)Junior Member (10 reputation)Junior Member (10 reputation)

Group: Forum Members
Last Active: 10 Years Ago
Posts: 10, Visits: 1
Thank you!

Using data labels will be a better solution.

Elvira Aminova
Posted 11 Years Ago
View Quick Profile
Junior Member

Junior Member (10 reputation)Junior Member (10 reputation)Junior Member (10 reputation)Junior Member (10 reputation)Junior Member (10 reputation)Junior Member (10 reputation)Junior Member (10 reputation)Junior Member (10 reputation)Junior Member (10 reputation)

Group: Forum Members
Last Active: 10 Years Ago
Posts: 10, Visits: 1
How can I change the horizontal alignment of data label?
There is only "VertAlign" property.

Need something like this:

NDataLabelStyle label = new NDataLabelStyle();
label.VertAlign = VertAlign.Center;
label.HorizontalAlign = HorizontalAlign.Right;

Nevron Support
Posted 11 Years Ago
View Quick Profile
Supreme Being

Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)

Group: Forum Members
Last Active: 4 hours ago
Posts: 3,054, Visits: 4,012
Hi Elvira,

You can use the string format:

dtLabel.TextStyle.StringFormatStyle.HorzAlign = Nevron.HorzAlign.Right;

Let us know if you meet any problems...

Best Regards,
Nevron Support Team



Elvira Aminova
Posted 11 Years Ago
View Quick Profile
Junior Member

Junior Member (10 reputation)Junior Member (10 reputation)Junior Member (10 reputation)Junior Member (10 reputation)Junior Member (10 reputation)Junior Member (10 reputation)Junior Member (10 reputation)Junior Member (10 reputation)Junior Member (10 reputation)

Group: Forum Members
Last Active: 10 Years Ago
Posts: 10, Visits: 1
I use a string format:

NDataLabelStyle label = new NDataLabelStyle();
label.TextStyle.FontStyle.Style = FontStyle.Bold;
label.TextStyle.FillStyle = new NColorFillStyle(Color.Crimson);
label.VertAlign = VertAlign.Center;
label.ArrowLength = new NLength(10);
label.TextStyle.StringFormatStyle.HorzAlign = Nevron.HorzAlign.Left;

But labels were overlapped and arrows length equals to 0 (see 3.png).

Then I set EnableLabelAdjustment property to prevent overlapping:
cartesianChart.LabelLayout.EnableLabelAdjustment = true;

Now labels are not overlapping but horizontal alignment isn't left (see 4.png).
What can I do to get something like this (see 5.png)

Attachments
3.png (350 views, 62.00 KB)
4.png (332 views, 60.00 KB)
5.png (344 views, 49.00 KB)
Nevron Support
Posted 10 Years Ago
View Quick Profile
Supreme Being

Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)

Group: Forum Members
Last Active: 4 hours ago
Posts: 3,054, Visits: 4,012
Hi,

If the automatic label layout is disabled, the labels cannot be placed to the left or to the right of a data point. So, the EnableInitialPositioning property must be set to true:


   chart.LabelLayout.EnableInitialPositioning = true;
   chart.LabelLayout.EnableLabelAdjustment = true; // this is not mandatory


Then you can specify the allowed label locations for each series. In the code below only Left and Right are set, but you can allow more locations (note that the order determines their priority).


   series.DataLabelStyle.Visible = true;
   series.LabelLayout.LabelLocations = new LabelLocation[]
   {
      LabelLocation.Left,
      LabelLocation.Right
   };




Best Regards,
Nevron Support Team





Similar Topics


Reading This Topic