Profile Picture

How to specify Custom DataLabelStyle Format

Posted By Alex Mendy 10 Years Ago
Author
Message
Alex Mendy
Posted 10 Years Ago
View Quick Profile
Forum Newbie

Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)

Group: Forum Members
Last Active: 10 Years Ago
Posts: 1, Visits: 5
I have a NBarSeries chart with MultiBarMode = MultiBarMode.Stacked;
When my value is less than 100% (say -131%), the DataLabelStyle only shows -100%. 
Is there a way to specify my own custom formatting for DataLabelStyle?

Code snippet:
NBarSeries oBar = chart.Series.Add(SeriesType.Bar) as NBarSeries;      
oBar.InflateMargins = true;
oBar.Name = name;
oBar.MultiBarMode = MultiBarMode.Stacked;
oBar.WidthPercent = 30;
oBar.DataLabelStyle.VertAlign = Nevron.VertAlign.Center;
oBar.DataLabelStyle.TextStyle.BackplaneStyle.Visible = false;
oBar.DataLabelStyle.TextStyle.FontStyle = new NFontStyle("Verdana", 7.0f, FontStyle.Bold);
oBar.DataLabelStyle.Format = "<percent>";
oBar.DataLabelStyle.ArrowLength = new NLength(0);
oBar.DataLabelStyle.Visible = true;
oBar.Values.Add(https://www.nevron.com/forum/uploads/images/2c8867fe-1ca0-4ae5-b276-e45e.png.IsNull() ? 0.0 : value.Value);


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: Yesterday @ 1:54 AM
Posts: 3,054, Visits: 4,009

Hi Alex,

The data label in case is configured to displays percents of the stack total, not  the data point value. In this case since it is the only negative stack it displays 100% - you can easily assign custom data label style and/or formatting to either individual bars or entire series – for example:

bar.DataLabelStyle.Format = "<value>";

will display the data point value instead of total percent. Hope this helps – let us know if you meet any problems or have any questions.



Best Regards,
Nevron Support Team





Similar Topics


Reading This Topic