Forum Discussion
line chart - color gradient
- Anonymous9 years ago
You could do it in R, though you lose interactivity back into your dataset etc. Something like:
library(ggplot2) # Needed for ggplot # Avoid having to reference dataset$ each time in function calls attach(dataset) #Plot the Count dataset by Month and Year, with Year to set the fill colour ggplot(dataset, aes(x=Month, y=Count, group=Year, colour=Year)) + #Use lines on the plot geom_line() + Restrict the colur hue to (around) the green range scale_color_hue(h=c(90,180))
You may need to fiddle with the scale_colour_hue parameters to get exactly what you want.
Hi vijaybansal3000,
You could select the paint roller icon and expand "Data colors" and manually assign different gradients of 1 or more colors. It's not the ideal way, but it will accomplish what you want.
You could do it in R, though you lose interactivity back into your dataset etc. Something like:
library(ggplot2) # Needed for ggplot # Avoid having to reference dataset$ each time in function calls attach(dataset) #Plot the Count dataset by Month and Year, with Year to set the fill colour ggplot(dataset, aes(x=Month, y=Count, group=Year, colour=Year)) + #Use lines on the plot geom_line() + Restrict the colur hue to (around) the green range scale_color_hue(h=c(90,180))
You may need to fiddle with the scale_colour_hue parameters to get exactly what you want.
- vijaybansal30009 years agoFrequent Visitor
Thanks Anonymous. This seems to be a good way. Though I would have loved this as a feature inbuilt in PowerBI itself without going to R code.
- Anonymous9 years agoNot applicable
Hi vijaybansal3000,
Currently, it is impossible to change the color of years based on a gradient in Power BI Desktop, an idea about this issue has been submitted in the following link, please vote for it. In your scenario, you can set discrete set of colors using Format option as mihart’s post. Or set color using R code following Steve’s suggestion.
https://ideas.powerbi.com/forums/265200-power-bi-ideas/suggestions/15906193-continuous-color-palettes
Thanks,
Lydia Zhang