Hi,
Wondering has anyone ever been able to create a diverging bar chart in Looker ?
If so how did you implement?
thanks
Solved! Go to Solution.
Hi @Tony_Le_Mesmar!
I would say this depends on what your data looks like. However, I have a quick workaround for if you're trying to compare two categories that both have positive values. This method uses Table Calculations to manipulate the data so that it shows up as "negative" for one of the categories, making the bars run left (see screenshot below). The idea is to use the Table Calculation to make one of the pivoted categories negative, but using a custom value format to make the value label appear positive.
The logic for the calculation is if we are looking at the second column of the pivot (in this case the brand Columbia), make the value of sale price negative; else just take the normal sale price. The Table Calculation is as follows:
if(pivot_column()=2,-${order_items.total_sale_price},${order_items.total_sale_price})
With custom formatting you can decide how a positive value vs a negative value is formatted using the semicolon to separate the positive from the negative. In this case we want them formatted the same (without a negative sign) so the formats are the same before and after the semicolon. The custom format that allows the number labels for the negative values to appear positive is as follows:
$#,##0.00; $#,##0.00
Hope this helps!
Hi @Tony_Le_Mesmar!
I would say this depends on what your data looks like. However, I have a quick workaround for if you're trying to compare two categories that both have positive values. This method uses Table Calculations to manipulate the data so that it shows up as "negative" for one of the categories, making the bars run left (see screenshot below). The idea is to use the Table Calculation to make one of the pivoted categories negative, but using a custom value format to make the value label appear positive.
The logic for the calculation is if we are looking at the second column of the pivot (in this case the brand Columbia), make the value of sale price negative; else just take the normal sale price. The Table Calculation is as follows:
if(pivot_column()=2,-${order_items.total_sale_price},${order_items.total_sale_price})
With custom formatting you can decide how a positive value vs a negative value is formatted using the semicolon to separate the positive from the negative. In this case we want them formatted the same (without a negative sign) so the formats are the same before and after the semicolon. The custom format that allows the number labels for the negative values to appear positive is as follows:
$#,##0.00; $#,##0.00
Hope this helps!