Skip to Content
Author's profile photo Rakesh Pattani

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.

http://scn.sap.com/thread/3652142

Requirement

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.  Pic1.JPG

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

Pic2.JPG

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

Pic3.JPG

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.Pic4.JPG

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.

Pic5.JPG

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.

Pic6.JPG

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.

Pic7.JPG

This is how the chart looks like and exactly what we want.

Pic8.JPG

Creating a Line Chart


Create the Line Chart. Here we will select the Region Color since we want to separate the Amount into zones

Pic9.JPG

This is how the chart looks like and exactly what we want

Pic10.JPG


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


Pic11.JPG


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.

Pic12.JPG

Similarly goto the Title option and hide the text as well

Pic13.JPG

Repeat the same for Category Axis and hide the text of the Title and Design Option as shown below

Pic14.JPG

Pic15.JPG

Hide the legendTitle

Pic16.JPG

Change the position of the Legend value

Pic17.JPG

And the Bar Chart will look like as below


Pic18.JPG


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

Pic19.JPG

Next we remove the legend title from the Legend -> Title

Pic20.JPG

Goto the Value Axis -> Title and give a custom title name

Pic21.JPG

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%.

Pic22.JPG

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.

Pic23.JPG

Now our Line chart will look like as below


Pic24.JPG

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

Pic25.JPG

And we get the Chart as shown below which matches with our requirementPic27.JPG

Assigned Tags

      13 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Former Member
      Former Member

      Great!!!!

      Thanks a lot for your help!!!! is very useful that trick 😉

      Thank again!!!

      Author's profile photo Former Member
      Former Member

      Hi Rakesh Pattani,

      I have an example with a horizontal bar chart and a crosstab to create a Gantt chart.

      Gantt.PNG

      Author's profile photo Former Member
      Former Member

      Hi David,

      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?

      Thanks,

      MM

      Author's profile photo Former Member
      Former Member

      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.

      Author's profile photo William MARCY
      William MARCY

      Great Webi trick !

      You've been added to Webi 4.x tricks : summary for a better visibility. Keep posting !

      William

      Author's profile photo Former Member
      Former Member

      good to know

      Author's profile photo Amish Sinha
      Amish Sinha

      Really interesting..

      Author's profile photo JEET PANDEY
      JEET PANDEY

      Hi All

      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

      2 snap.png

      1 snap.png

      3 snap.png

      I am using sap BI 4.1 sp5

      Thanks in Advance

      Regards,

      Jeet

      Author's profile photo Former Member
      Former Member

      Hi Jeet,

      You could probably use a variable ?

      NotFormated.PNG

      VS

      Formated.PNG

      Author's profile photo Former Member
      Former Member

      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.

      Author's profile photo Haradev Viswanadha
      Haradev Viswanadha

      Hello Goutham,

      Were you able to find any solution to your issue? I have the same issue while publishing in MHTML format to email?

      Thanks

      Haradev

      Author's profile photo Haradev Viswanadha
      Haradev Viswanadha

      I am trying to publish it but the charts are not on one another instead came seperately. Did anyone did this before?

      Author's profile photo Roman V
      Roman V

      Hey,

      Quite an old post from 2015, but as I haven’t found anything else for the workaround  …

      Question:

      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?

       

      Thanks!

       

      Edit 

      For those of you who is looking for a proper solution check out this post:

      https://blogs.sap.com/2015/09/12/create-combined-columns-lines-chart-in-webi/

      Helped me, hope it can help you!

       

       

       

      Â