This thread looks to be a little on the old side and therefore may no longer be relevant. Please see if there is a newer thread on the subject and ensure you're using the most recent build of any software if your question regards a particular product.
This thread has been locked and is no longer accepting new posts, if you have a question regarding this topic please email us at support@mindscape.co.nz
|
Hi Jason, Our customer wants to put the label of the bar to the middle of the bar for stacked bar series, is that possible? See attached image. (same requirement for Vertical Bar Series) Manipulating on DataLabel style does not seem to work. (We are using Version 7.0 WpfElement) Thanks, Gordon |
|
|
Hello Gordon This will be possible in the next nightly build of version 7.0. Simply set the HorizontalAlignment (for horizontal bars) and VerticalAlignment (for vertical bars) property on the custom label style, and the chart will know to position the labels in the center of the bars. (Or you could set both Horizontal and Vertical alignment properties to center so that you can use the same label style for both orientations of bar chart). This will work on normal and stacked bar series.
-Jason Fauchelle |
|
|
Thanks, Jason. It worked. Gordon |
|
|
Hello Gordon You posted an image saying that it doesn't work in code. As long as the label style has setters for the vertical and horizontal alignments, this should work. If not, please send the code you are using to build the label style. -Jason Fauchelle |
|
|
Sorry, Jason, that image was captured when I pointed to the previous build, and I want to delete from the forum but unsuccessful. It is working now. Gordon |
|
|
Ok no worries, great to hear it is all working.
|
|
|
Hi Jason, If we change the VerticalAlignment to value other than Center, it will stay on top of the bar, same thing for the HorizontalAlignment, right? Thanks, Gordon |
|
|
That is correct. It is a little bit odd to implement it this way, but this was the best way to implement it without adding a new property to the BarSeries that could change later. I simply check if center alignment has been applied, and this changes the placement logic to put the label in the center. Any other value will be ignored - resulting in the label being placed at the tip of the bar. -Jason Fauchelle |
|