Add a label on top of each row for floatBar chart


Author
Message
Clare Moore
Clare Moore
Junior Member (22 reputation)Junior Member (22 reputation)Junior Member (22 reputation)Junior Member (22 reputation)Junior Member (22 reputation)Junior Member (22 reputation)Junior Member (22 reputation)Junior Member (22 reputation)Junior Member (22 reputation)
Group: Forum Members
Posts: 22, Visits: 1

I have a (horizontal) float bar chart, and i have some values that i'd like to display in labels on top of the bars.

Because my data is grouped, each row is actually made up of quite a few datapoints (otherwise i'd just use the data label).

Is there a way to display one label for each row, on the exact location of each row??

I have tried writing some code that figures out how many categories i have, and tried to position labels by calculating where they should go for each category - as a percentage of the total height, but this doesnt seem to be working out.


Reply
Nevron Support
Nevron Support
Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)
Group: Administrators
Posts: 3.1K, Visits: 4.2K

Hi Clare,

You should populate either the axis labels or the data labels series for each bar - for example:

// 1. Modify category labels of primary x axis

NOrdinalScaleConfigurator ordinalScale = chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator as NOrdinalScaleConfigurator;

if (ordinalScale != null)

{

ordinalScale.AutoLabels = false;


// for each category add a label here

ordinalScale.Labels.Clear();

ordinalScale.Labels.Add("Category 1");

ordinalScale.Labels.Add("Category 2");

ordinalScale.Labels.Add("Category 3");

}

// 2. Modify data labels per data point

NBarSeries barSeries = new NBarSeries();

barSeries.Labels.Clear();

barSeries.Labels[0] = "Some Label For Bar 1";

barSeries.Labels[1] = "Some Label For Bar 2";

// etc.

Hope this helps - let us know if you meet any problems.



Best Regards,
Nevron Support Team


GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...





Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search