Hello! In VA, how do I create a bar chart with each bar having a different color? In the picture, the x-axis range from "11" (bad) to "1" (good).... and I'd like to add a color gradation dimension to my visualization.... say make "11" red and slowly change the bars in color to a green "1". Is this possible in VA? Thanks in advance for everyone's reply!! I'm hoping someone has done this before and will be able to assist me. Thank you in advance for your assistance!
Hello,
You can make a bar chart with a Color role by using SAS Graph Builder (select Build Custom Graphs from the top left menu). Then, you can import the custom graph into your report:
If you want the same measure to be used for both the bar height and the bar color, you can change those roles to a single shared role in Graph Builder.
I don't think you can easily change the gradient fill colors for a bar chart, however. You can set the gradient colors by making a custom theme, but I think this would apply to every object in your report? I don't have much experience with this and I might be wrong.
A different approach would be to make a series of display rules to color the bars, but you would have to hard-code the interval values.
Let us know if that helps,
Sam
You should be able to do this with display rules.
Working with Display Rules
-------------------------------------------------------------------------
Four tips to remember when you contact SAS Technical Support
Tricks for SAS Visual Analytics Report Builders
SAS Visual Analytics Learning Center
Hello,
You can make a bar chart with a Color role by using SAS Graph Builder (select Build Custom Graphs from the top left menu). Then, you can import the custom graph into your report:
If you want the same measure to be used for both the bar height and the bar color, you can change those roles to a single shared role in Graph Builder.
I don't think you can easily change the gradient fill colors for a bar chart, however. You can set the gradient colors by making a custom theme, but I think this would apply to every object in your report? I don't have much experience with this and I might be wrong.
A different approach would be to make a series of display rules to color the bars, but you would have to hard-code the interval values.
Let us know if that helps,
Sam
Hi Sam!
could you kindly pass me some examples about this?
In particular, I can't insert different colors for the bar graph with the trend:
is it possible to do it like this?
thx a lot!
Hello @Teo_ita,
If I understand correctly, it looks like you want to create a color-mapped display rule for a bar-line chart, using the category that is assigned to the Lattice Columns role (Priorita in your example below.) Is that right?
You can create such a display rule for a regular bar chart, but it looks like this is not supported for a bar-line chart (or a custom graph with those elements). I will investigate to see whether the documentation for display rules should be updated.
Thanks,
Sam
I think it is just a limitation of the software. I am not a developer but I seem to understand there are difficulties applying display rules for a category when there are multiple response (measure) variables.
The documentation says:
I suspect that this is the same limitation you are seeing for bar-line charts and the doc should be phrased differently. I will look into that.
You can create a feature request here:
It is possible that a request already exists for this. All feature requests are reviewed by the product management team.
Thanks,
Sam
It is possible when you use "Build Custom Graph"
Here are the steps I used:
In the options for the line chart, change the color for the line
In the options for the bar chart, switch on data labels
Give it a try.
@BrunoMueller I was able to get your version working in Viya 4. When I tried it before, it didn't work. I guess that the options you specified in the custom graph are critical for the display rules to work.
@Teo_ita , let us know if you are able to get this working.
Thanks,
Sam
Hi Bruno, thx!
but I can't do what you tell me...
I have Viya 3.4 and I don't have '...the options for the line chart, change the color for the line'
but I solved it by using Display Rules and creating a Numeric variable from my Category variable...
A thousand thanks!
Save $250 on SAS Innovate and get a free advance copy of the new SAS For Dummies book! Use the code "SASforDummies" to register. Don't miss out, May 6-9, in Orlando, Florida.
See how to use one filter for multiple data sources by mapping your data from SAS’ Alexandria McCall.
Find more tutorials on the SAS Users YouTube channel.