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