Reply
asimbilal
Regular Visitor

Change line chart background color

I want to make line chart report and I have attached the image what I am trying to achieve can you help me how can I do that. I want to change the background color if my y-axis value is 0 to 0.7 it will be green. If my y-axis value is 0.8 to 2.2 then it will be yellow and rest will be red.

 
Screen Shot 2016-03-29 at 4.05.20 pm.png
3 REPLIES 3
samKsam
New Member

Hi, I'm trying to create the same conditional background color. I was wondering if you could figure it out? 

Seth_C_Bauer
Community Champion
Community Champion

@asimbilal

I don't know of a way out of the box, but here are a few ideas you can pursue.

All ideas revolve around layering visuals. The line chart will be in the foreground, and these options in the background.

1) you could just add an image with these gradients and add it behind the line chart. The drawback is that if the y-axis changes, the colors may not match up...
2) You might be able to use a heat map custom visual to control the size and color which may change as your y-axis does. You could layer elements to hide descriptions on the heatmap, then put the line chart on top... Basically it would be something like, create the heat map, turn off all title, etc. Use a white box picture to cover the remaing text, then add your line chart.
3) A final option would be to use a visual and drop in a single value so nothing shows up. remove all titles, axis, etc. and add a color for the background. You will need 3 of these, and they could serve the same purpose as #1

All these ideas are just that, ideas. i haven't tested or brought them to completion to see how they may work.


Looking for more Power BI tips, tricks & tools? Check out PowerBI.tips the site I co-own with Mike Carlo. Also, if you are near SE WI? Join our PUG Milwaukee Brew City PUG
avatar user
Anonymous
Not applicable

I was trying to achieve the same a few weeks ago, except that in my case even the target values for the background color were dynamic too coming from a measure in the same dataset. This case nothing hardcoded could work...

 

I came to the conclusion that I need to create a custom visual for this purpose, that would ideally inherit from the Line Chart visual. I would add new input fields for the target limits, and fill in the background in the visual myself - while leaving the rest of the line chart as is. It sounds simple, but I couldn't get through the inheritance yet.

avatar user

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

Check out the February 2025 Power BI update to learn about new features.

Feb2025 NL Carousel

Fabric Community Update - February 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors (Last Month)
Top Kudoed Authors (Last Month)