9 Replies Latest reply: Nov 9, 2011 2:30 PM by John Witherspoon

# Chart question - position of the Y axis

I have a combo chart that has three expressions (current value, target value and change).  For the first two expressions, I’m depicting them using a line.  For the third I’m using bars.  I’d like to get the expression axes for the third expression to display on the left.  The other two are on the right.  I’m looking at the axes tab in the chart properties but I don’t see how to make this happen.  Is this possible?  I’m attaching an example of what I would like it to look like.

• ###### Chart question - position of the Y axis

On the Axes tab, click on an expression, then in the Position box to the right, select which axis you want it to use.  Do the same for the other two expressions.

• ###### Chart question - position of the Y axis

I tried that.  I'm attaching a screenshot of my current chart and the properties.  The Change expression's position is set to Left (Bottom) but it is appearing on the right.

• ###### Chart question - position of the Y axis

Uncheck "Split Axis".  Splitting tells it to put it on the bottom instead of on the left.

• ###### Chart question - position of the Y axis

Is it possible to have the third expression on the left but also in the lower half of the chart?  Changing the position to Left (Bottom) does move it to the left but I need it towards the bottom, not on the same scale as the expressions on the right.  I tried clicking Split Axis but this moved the axis back over to the right.

Screenshot of chart after clicking on Position = Left (Bottom) on third expression.

Example of what I am trying for:

• ###### Re: Chart question - position of the Y axis

You can indeed put it in the lower half of the chart, but you're going to need additional calculations to get there.  Notice the "scale" box.  You need to calculate a "static" max and min so that the bars show up only in the lower half or third of your chart.  This will probably be of the following general form:

static min = rangemin(0,min(aggr(Expression,Dimension)))
static max = (1/Percent)*rangemax(0,max(aggr(Expression,Dimension))) - (1/percent-1)*rangemin(0,min(aggr(Expression,Dimension)))

Expression is the expression you're using for the bars.  Dimension is your chart's dimension.  Percent is the percent of the total chart you want your bars to cover.  Eyeballing what you have, maybe 30%?  Put it in as 0.3, though, because QlikView doesn't like numbers entered as %.  It will give you a scale all the way to the top, but the bars themselves will be limited in size.  The rangemax() and rangemin() make sure that zero is always displayed.  Yes, the forced 0 does that as well, but would result in a different percent of the graph being used.  Calculating it yourself makes sure it's always the right percent.

Edit: To avoid repeating your expression four times if it's anything complicated, you might want to store it in a variable.  You might want to do that anyway so that people maintaining the chart later don't change your expression and forget to change your min and max.  If it's a simple expression, though, a comment that the min and max need to be kept in sync would probably be sufficient, and is probably what I'd do.

• ###### Re: Chart question - position of the Y axis

This is what I am ending up with:

Maybe my syntax is incorrect:

=rangemin(0,min(aggr(Change,Dates)))

=(1/0.3)*rangemax(0,max(aggr(Change,Dates))) - (1/0.3-1)*rangemin(0,min(aggr(Change,Dates)))

• ###### Re: Chart question - position of the Y axis

I don't believe you can refer to the NAME of the expression when calculating the scale.  I think you need to repeat the expression.  That's why I mentioned using a variable if it's a complicated expression that you don't want to write and maintain four times.

• ###### Re: Chart question - position of the Y axis

I don't think this is going to work.  The expression I'm using for Change is using a () below function to get to the previous expression value.

The expression is:

column(1)-above(column(1))

• ###### Re: Chart question - position of the Y axis

Use a variable for the first expression as well, then use \$(Variable)-above(\$(Variable)) instead, or just repeat the first expression if it's a simple one.

See attached working example.