Overlapping bar chart with multiple axis in PowerBi - data-visualization

I would like to have a overlapping bar chart in PowerBi with multiple axis. I have an example from Excel which I would prefer to recreate in PowerBi if this is possible.
Here the example:
Is this possible in PowerBi? Maybe by using a custom visual I don't know off.
Thanks in advance,

Multiple axes? Yes! Overlapping bars? No!
Using a Line and Clustered Column Chart is the way to go:
Here's a demo using some random numbers:
Date A B C
07.08.2018 0,359008828 0,993689927 0,8
08.08.2018 0,127630228 0,449164386 0,8
09.08.2018 0,431825126 0,615830289 0,8
10.08.2018 0,269830973 0,984995499 0,8
11.08.2018 0,27416548 0,64248379 0,8
12.08.2018 0,777712123 0,740108131 0,8
13.08.2018 0,264229043 0,242084953 0,8
14.08.2018 0,49124239 0,144428206 0,8
15.08.2018 0,242050334 0,020032871 0,8
16.08.2018 0,316102617 0,644935538 0,8
Use Enter Data to get a table with these numbers under Fields:
Click Line and Clustered Column Chart under Visualizations
Drag Date to Shared Axis, and change the date hierarchy to simple date using the drop down menu next to Date.
Drag C to Line Values, and A and B to Column values:
Under Y axis, set Show Secondary to On
And that's as close as you're going to get to replicate your Excel Chart at the time being as far as I know.

It's certainly not an ideal solution, but it is possible to place charts on top of each other. This is the result of two bar charts superimposed upon each other:
Note: In order to have control over the column width, you need to change the x-axis to categorical and adjust the inner padding.

There are multiple custom visuals available on the appsource now. Search for lipstick charts. see screenshot below. one of those is here
https://appsource.microsoft.com/en-US/product/power-bi-visuals/yavdaanalyticspvtltd1628223732998.lipstickcolumnpro?tab=Overview

Related

how to align chart + html.table in a Plotly Dash app?

I'm trying to reproduce a layout where the table and the chart should be aligned as in the image below:
The main idea is to work for 1 to N values, always aligned to each other.
I tried to create a "fake" graph inside the table but as you can see in the image below it doesn't work exactly as expected
So I would like to know what's the best way to:
1- calculate and set the size needed for each bar in the graph
2 - set it dynamically based on how many entries the data has
3 - Don't forget please, ALWAYS ALIGNED
IF needed I can share the code of the table or of the layout graph + table I'm using;
Thank you in advance.
Regards,

Stacked bar chart from one column pandas or dictionary

I have been trying to create a stacked bar chart from simple data.
Assume the dictionary:
data ={A:2,B:3, C:4, D:5}
I would like to create a bar chart that shows like this:
I cant do it manually (i.e. dividing A by the total and so on) since I have a dictionary that consists of 20 keys.
I feel like it should be so simple but I can't figure it out
Thanks
You can try:
pd.Series(data).to_frame().T.plot.bar(stacked=True)
Output:

Is there any built in function in pandas to subtract various columns to manipulate a stacked bar chart?

I hope I do not brake too much rules (this is my first post).
First Things first: I'm sorry, but I cannot post an image of my plots or Code right now. So I created a pretty image in paint. On the left side you see what I want to create, on the right side you see what I create right now.
Example
I was able to make a barchart as shown on the left side with lots of detours. Since I have to analyse lots of data in similar charts I want to use the built in plot function of Pandas.
What I need: stacked bar chart, where the values are not summed up (like shown in the right image) but the difference of the values are summed up (like shown in the left image). So if s1 = 2 and s2 = 6 and i just do some stuff like groupby().unstack().plot(kind='bar', stacked=True) I got stacked bars which end at y=2 for s1 and y=8 for s2 (like shown in the right diagram).
How can I modify my code so that I will get y=2 for s1 and y=6 for s2?.
I thought about diff(), but the result was definetly not like expected.
I hope my question is clear.
Thanks for your adviced and best regards
Arnfried

Is it posible to get the position of point on an excel graph axis

I'm not sure this is possible but thought this was the best place to ask.
Is it posible to get the position of a series value on a graph in excel?
For example, if I have a line graph in excel that has time along the x axis, is it possible to (using VBA) get the position of a specific point on that axis.
What I am trying to do is have a vertical line that is can be positioned based on a date entered by the user.
like this
Where the green line could be positioned by entering in a date (rather than just being manually moved) (or also it could be set to automatically move to the current date etc).
I was then thinking that if the position is on the graph is queryable, then I can just access the line object and move it to any position I wanted through VBA.
Any Ideas? or is this just not possible?
The "cleanest" way to do this is to add the line to the chart as a new series. In that way, Excel handles all of the positioning and your work is simplified. To get a vertical line on a chart, there are a number of options. I prefer this route:
Create a small 2x2 area with two dates and two values
Add in the date or x-axis value you want the line at (E3 in image). You can use =TODAY() here or some manually entered value.
Set the second x-axis value equal to the first
Use MAX and MIN on the data to get the values for each date. You can also use 0 and 1 and a secondary axis, but I think MAX/MIN is easier.
Add the data to the chart and format as a marker with straight line.
Formulas
E3: =TODAY()
E4: =E3
F3: =MIN(C3:C27)
F4: =MAX(C3:C27)
Result and chart data series for vertical line

Connect Xaxis of a chart to another one

I have an application made of a "main" chart with stock quotes plotted in it and a "subordinated" one with some indicators; the two charts are dinamically feeded with data so they are ever moving and re-sizing their own YAxis accordingly. The following snapshot gives a better idea:
What I would like to do is to make the below chart XAxis exactly the same of the first one, so that it is possible to follow the evolution of the two indicators together.
Right now I'm doing the following work around:
With ChartBelow.ChartAreas(0)
.AxisX.Minimum = ChartAbove.ChartAreas(0).AxisX.Minimum
.AxisX.Maximum = ChartAbove.ChartAreas(0).AxisX.Maximum
End With
However this doesn't work well since the digits of the YAxis on the main chart are not always the same of the second one (as in the example above where it's 6-digits against 3-only).
Is there any way to aligne the two y-axes or make the X-Axis shared between the two charts?
Yes, as well as setting the Min/Max values, also set the interval and label interval values of the Axis.
ChartAbove.ChartAreas(0).XAxis.Interval
ChartAbove.ChartAreas(0).XAxis.LabelStyle.Interval