Forum Discussion
Stacked bar chart formatting
Hi guys,
Looking for suggestions on how to approach this, I created a stacked chart which contains similar legends but different values, i needed them to be stacked in a cronological order, for this i created an index for each for the values, so far looks like this:
as you can see under State column the string values repeat several times, but the chart is stacking them by index, is there a way i can keep the current alignment in the chart but apply specific colors to each of the unique State values? as you can see the word "Static" repeats like 7 times, however the chart provides 7 different colors to that value and i am aiming to get one color only.
thanks for any suggestions.
Hi Anonymous ,
Try this:
Steps:
1. Add a calculated column.
Legend = [Category] & [Index]2. Create a table to sort Category in reverse order. Or just use "enter data" to set custom order.
Category = VAR t = DISTINCT ( 'Table'[Category] ) RETURN ADDCOLUMNS ( t, "Order", RANKX ( t, [Category],, DESC, DENSE ) )3. Create a measure.
1 = 14. Create visuals.
- Create a Ribbion visual and change the data color manually, then turn off background.
- Create a Treemap visual.
- Create a text box and enter text "Legend".
- Group.
Best Regards,
Icey
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
8 Replies
- DataInsightsSuper User
Anonymous, try this:
1. Create a States table.
2. Join States table to Fact table.
3. In Data view, click on States[State] column and sort by Index.
4. In chart, Legend should be States[State].
- AnonymousNot applicable
Thanks DataInsights thats a huge lead,
I will start applying it now, just one more question, so because the state will be changing, for example not alwasy ream up will be the first in the secuence, for example now i have another set of data with HR 20, with different secuence than 19, would this logic would work? the most important part here is to follow the secuence in the secuence for each HR value but providing a specific color for each of the unoique values in states:
- DataInsightsSuper User
Anonymous,
Would you be able to provide a mock-up of how you want each HR (19 and 20) to look in the chart?
- IceyCommunity Support
Hi Anonymous ,
Try to use Ribbon Chart inteading of Stacked Column Chart.
Reference: Ribbon Chart is the Next Generation of Stacked Column Chart
Best Regards,
Icey
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- AnonymousNot applicable
Icey , thanks for your answer,
would be a way to order this by index but only showing unique legend? my problem right now is when aggregating values as i do not need to aggregate nothing but showing the results in cronological order.
Thanks for any guide.
- IceyCommunity Support
Hi Anonymous ,
Try this:
Steps:
1. Add a calculated column.
Legend = [Category] & [Index]2. Create a table to sort Category in reverse order. Or just use "enter data" to set custom order.
Category = VAR t = DISTINCT ( 'Table'[Category] ) RETURN ADDCOLUMNS ( t, "Order", RANKX ( t, [Category],, DESC, DENSE ) )3. Create a measure.
1 = 14. Create visuals.
- Create a Ribbion visual and change the data color manually, then turn off background.
- Create a Treemap visual.
- Create a text box and enter text "Legend".
- Group.
Best Regards,
Icey
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.