Profile Picture

How do I centre data labels in horizontal bars

Posted By Kevin Harrison 6 Years Ago
Author
Message
Kevin Harrison
Posted 6 Years Ago
View Quick Profile
Supreme Being

Supreme Being (79 reputation)Supreme Being (79 reputation)Supreme Being (79 reputation)Supreme Being (79 reputation)Supreme Being (79 reputation)Supreme Being (79 reputation)Supreme Being (79 reputation)Supreme Being (79 reputation)Supreme Being (79 reputation)

Group: Forum Members
Last Active: 3 Years Ago
Posts: 176, Visits: 1,865

I can get the attached using:
nevronSeries.DataLabelStyle.VertAlign = Nevron.VertAlign.Center;
 nevronSeries.DataLabelStyle.ArrowLength = new NLength(0);
nevronSeries.DataLabelStyle.ArrowStrokeStyle = new NStrokeStyle(0); 
nevronSeries.DataLabelStyle.ArrowPointerLength = new NLength(0);

but I want the label to be centred vertically within the bar. Can I do this?
data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAARUAAAC4CAYAAADNG3hmAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAkTSURBVHhe7d3PbxTnHcfxD0UOBtf1GswaSJNs7GBDQwOiEa6cSggUgYRUixu0EqpvrZIe+AvwbnqsqqIqUcIJR1UTU/XgmqoSCCVFapyAFGRaINjBjk2a1GtsvBY1MXGldufZZ/0DiDRGX+/usO9XNImfmRxWe3h7npnHMyv+lyUAMPIt/18AMEFUAJgiKgBMERUApogKAFNEBYApogLAFFEBYIqoADBFVACYIioATBEVAKaICgBTRAWAKaICwBRRAWCKqAAwVfAnvw0MDGjlypV+FB2zs7OqqKjwo2iI4mcO8F0XTm9vr44cOeJHNgoelStXrmjbtm1+FB1R/Nx814UT1e86lUqpo6PDj2ww/QFgiqgAMEVUAJgiKgBMERUApogKAFNEBYApogLAFFEBYIqoADBFVACYIioATBEVAKb4K+WQlutzz47/zW3LYWxsTPF43I+iI4qfO6rf9a9PrTD/K2WiEtJyfe6715PZLeVHQGG9cTnJow8AlDaigkiYTB91v1VzW7s+8/sDi49l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dyq9FWbwepWnvWdVfOOL2v3Eho8MLL+qWEZbph8Qy/cJhmX7hBAFkmT6AkkZUAJgiKgBMERUApogKAFNEBYApogLAFFEBYIqoADBFVACYIioATBEVAKaICgBTRAWAKaICwBRRAWCKhzSFxEOaCuez/pNKPDniR9EQ1Zfhv/abFbygvViISuHwXRdOKpXiyW8AShtRAWCKqAAwRVQAmCIqAEwRFQCmiAoAU0QFgCmiAsAUUQFgiqgAMEVUAJgiKgBMERUApogKAFNEBYApogLAFFEBYIqoADBFVACYIioATBEVAKaICgBTRAWAKaICwBRRAWCKqAAwRVQAmCIqAEwRFQCmiAoAU0QFeGz1qzuVUspt3dlRIUj/B4HSHvuInWAdAAAAAElFTkSuQmCC

Thanks
Kevin



Nevron Support
Posted 6 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: Last Week
Posts: 3,054, Visits: 4,000
Hi Kevin,
We tested with the following code and were not able to replicate the problem:

   NChart chart = nChartControl1.Charts[0];
   chart.SetPredefinedChartStyle(PredefinedChartStyle.HorizontalRight);
   chart.DisplayOnLegend = null;

   {
    NBarSeries nevronSeries = new NBarSeries();

    nevronSeries.Values.Add(10);
    nevronSeries.Values.Add(20);

    chart.Series.Add(nevronSeries);

    nevronSeries.DataLabelStyle.VertAlign = Nevron.VertAlign.Center;
    nevronSeries.DataLabelStyle.ArrowLength = new NLength(0);
    nevronSeries.DataLabelStyle.ArrowStrokeStyle = new NStrokeStyle(0);
    nevronSeries.DataLabelStyle.ArrowPointerLength = new NLength(0);
   }

   {
    NBarSeries nevronSeries = new NBarSeries();

    nevronSeries.MultiBarMode = MultiBarMode.Clustered;
    nevronSeries.Values.Add(10);
    nevronSeries.Values.Add(20);

    chart.Series.Add(nevronSeries);

    nevronSeries.DataLabelStyle.VertAlign = Nevron.VertAlign.Center;
    nevronSeries.DataLabelStyle.ArrowLength = new NLength(0);
    nevronSeries.DataLabelStyle.ArrowStrokeStyle = new NStrokeStyle(0);
    nevronSeries.DataLabelStyle.ArrowPointerLength = new NLength(0);
   }


Most likely you touch the TextStyle associated with the data labels somewhere. You can try the following:

nevronSeries.DataLabelStyle.TextStyle.StringFormatStyle.HorzAlign = Nevron.HorzAlign.Center;
nevronSeries.DataLabelStyle.TextStyle.StringFormatStyle.VertAlign = Nevron.VertAlign.Center;

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




Best Regards,
Nevron Support Team



Kevin Harrison
Posted 6 Years Ago
View Quick Profile
Supreme Being

Supreme Being (79 reputation)Supreme Being (79 reputation)Supreme Being (79 reputation)Supreme Being (79 reputation)Supreme Being (79 reputation)Supreme Being (79 reputation)Supreme Being (79 reputation)Supreme Being (79 reputation)Supreme Being (79 reputation)

Group: Forum Members
Last Active: 3 Years Ago
Posts: 176, Visits: 1,865
Thanks.

I noticed after posting that one of the examples had correctly centred labels.
We are still using 16.8.8.12, so I suspect this issue has been fixed since then.
It would be good to have release notes indicating what is fixed in each release.

Kevin



Similar Topics


Reading This Topic