Merging Charts in WebI
Even though the title tells about merging the two charts, in reality this is not possible in Webi 🙂 . The idea is to trick WebI by putting the chart on top of each other in such a way that they appear to be merged 😉 . The idea for this blog came from the following query posted in the forum.
To plot a Cross tab into a Bar/Line chart in such a way that Measure 2 forms a bar chart for all Zones for a particular Date and Measure 1 forms a Line chart for each Zones for a particular Date. This is the tricky part because we need 2 measures to behave in 2 different way in the same chart. To my knowledge this cannot be achieved in a single chart and hence we will plot them separately and then merge them.
Preparing the Dataset – First we will create a data set for plotting our graph
Below is a Crosstab table which has Date along the Vertical Axis and Zone along the Horizontal Axis and a Measure Amount on the Body Axis
Also will create a variable Average which will be Measure 2 and add a column at the end of the table. So, that’s how the table and our data objects looks like
Plotting the Chart
Now we will try to plot this data into a Bar/Line. We will select the Combined Column Line chart. X Axis will be the Date. Value Axis will be the Average(Bar) and Amount(Line). And since we need the Line chart for each Zone, we will select the Region Color as Zone.
Right Click Chart -> Format Chart and make sure you select the below option from the Measure properties. So that Average is Bar and Amount is Line.
And we get the below Chart. The issue with this is; the Average also get separated for each Zone which is not something that we want. We want the Region Color to be applied only on Amount and not on Average.
Workaround – Following are the steps taken for the workaround.
1. Create 2 separate charts
2. Format the charts
3. Place the chart on top of each other
Creating a Bar Chart
Create a bar chart for the Average as shown below. We will not select Region Color since we don’t need this to separate into the Zones.
This is how the chart looks like and exactly what we want.
Creating a Line Chart
Create the Line Chart. Here we will select the Region Color since we want to separate the Amount into zones
This is how the chart looks like and exactly what we want
Formatting the Bar Chart
First we need to format the base chart (BAR) as shown below.Right Click on the Bar Chart – > Select Chart Properties
Goto the Value Axis tab and select the Design option. This is to fix the Y-Axis. Make sure to select the Maximum value in such a way that it is higher than all measure values in the table
Scroll down below and hide the text of the Value Axis by selecting the color as white. Don’t uncheck the Visible checkbox else the chart will get dislocated.
Similarly goto the Title option and hide the text as well
Repeat the same for Category Axis and hide the text of the Title and Design Option as shown below
Hide the legendTitle
Change the position of the Legend value
And the Bar Chart will look like as below
Formatting the Line Chart
The first and most important thing is the make the Y Axis of line chart same as Bar Chart. This is because when we put the chart on top of each other, we want the axis to be same. For formatting right click on the Line chart -> Select Chart Formatting
Next we remove the legend title from the Legend -> Title
Goto the Value Axis -> Title and give a custom title name
The next important part, is to make Line Chart transparent so that when it is placed on top of the Bar Chart, we can see both the chart. For this reduce the RGBA Color to 46%.
We won’t touch the Category Axis because we want to see the Axis details when we plot the charts. One more setting that we would do is make the background white for the line chart.
Now our Line chart will look like as below
Merging the Charts
Now the last part of this trick, make the relative position of the Line Chart same as that of the Bar chart
And we get the Chart as shown below which matches with our requirement
Thanks a lot for your help!!!! is very useful that trick 😉
Hi Rakesh Pattani,
I have an example with a horizontal bar chart and a crosstab to create a Gantt chart.
The Gantt chart trick looks impressive, do you plan to share it with others?
If you have already done, can you please share the link?
The bad news is that I don't have access anymore to this webi.
It's look good, but it's a lot of trouble to maintain.
It's a CrossTab with a 100% stacked horizontal bar chart if I recall well.
You have to strip the bar chart to the minimum and find the good size of the bar chart vs the crosstab so the bar representing a date fits the information in the crosstab headers and lines.
Everything is calculated in months...
The blue line for example, .
You need to calculate a padding value.
So you have to calculate the number of month before March 2014 vs January 2011. Your padding will be (12 * (2014-2011)) + Month -1
Make it dynamic, do not hardcode values.
In our example it will be 12*3+2 = 38month of padding before the blue line then the number of month between the beginning and the end of a milestone or task to have the blue line.
For the colors, I don't recall what I exactly did, but I think that I was using different measure with if else statement depending of the value of the left dimensions.
I'm sorry I know that I'm not really precise but I did that 8 months ago.
Great Webi trick !
You've been added to Webi 4.x tricks : summary for a better visibility. Keep posting !
good to know
This is truly useful i have applied @ my report. but i am stuck at 1 point
in my report i want to display %age values but i am not finding any option @ format chart
I am using sap BI 4.1 sp5
Thanks in Advance
You could probably use a variable ?
Have you tried exporting the merged chart into xls? For me, Its not giving the correct output, the images of the two charts are now stacked one below the other.
Were you able to find any solution to your issue? I have the same issue while publishing in MHTML format to email?
I am trying to publish it but the charts are not on one another instead came seperately. Did anyone did this before?
Quite an old post from 2015, but as I haven’t found anything else for the workaround …
In case I want to export the graph into an excel the charts still get separated.
Does anyone know a workaround for that or has any tips?
For those of you who is looking for a proper solution check out this post:
Helped me, hope it can help you!