Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

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? 

@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
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.

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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