Label font color depending on position

ron barlow 411 Reputation points
2021-02-16T14:26:52.06+00:00

Hello

Is there a way, I can change a data label font color depending on it position. In the chart below the font is gray. I would like it white if it's inside the bar and black if it's outside?

68692-image.png

Thanks in advance
Ron.

SQL Server Reporting Services
SQL Server Reporting Services
A SQL Server technology that supports the creation, management, and delivery of both traditional, paper-oriented reports and interactive, web-based reports.
2,641 questions
0 comments No comments
{count} votes

Accepted answer
  1. ZoeHui-MSFT 27,466 Reputation points
    2021-02-17T06:08:10.933+00:00

    Hi @ron barlow ,

    We couldn't change the data label color conditionally with the position.

    It seems that you have set the BarLabelStyle as left, we'd suggest that you may set it as outside.

    When the bar label style is set to Outside, the labels will be placed outside of the bar, as long as it fits in the chart area.

    If the label cannot be placed outside of the bar but inside of the chart area, the label is placed inside the bar at the position closest to the end of the bar.

    If the label is placed inside the bar, you may set like this.

    Regards,
    Zoe


    If the answer is helpful, please click "Accept Answer" and upvote it.

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    What can I do if my transaction log is full?--- Hot issues November

    How to convert Profiler trace into a SQL Server table -- Hot issues November


1 additional answer

Sort by: Most helpful
  1. Michael Taylor 41,816 Reputation points
    2021-02-16T15:09:50.573+00:00

    It looks like you're using BarLabelStyle to control whether the label is shown inside or outside the bar. Therefore you could use the same expression to control the color of the text. However if the label cannot fit outside the bar then the rendered will put it inside anyway so for larger bars it won't work properly.

    0 comments No comments