Cognos Analytics

 View Only

 Getting a chart to start at 0

Marc Reed's profile image
Marc Reed IBM Champion posted Mon October 27, 2025 12:16 PM

Hi all,

I think I must be missing something. I am trying to get a CA chart to start the y axis at 0. The data I am plotting is always positive integers, so I always waht the y axis to start at 0.

If my data to plot looks like :

The chart looks like.



However, if my data only contains zeroes, such as 

The chart looks like

Even if the y axis is specifically set to start at 0.

I think a work around is to plot a measure of value 1 and hide this plot. But I wondered if I was missing something.

Marc Reed's profile image
Marc Reed IBM Champion

I have stumbled across a work around and thought I would post here in case anyone else has this issue.

Simply set the maximum axis range. In this case I have set it to 1.

This forces the chart to start at 0.

If the maximum is more than one, then the chart automatically changes the range. 

Paul Mendelson's profile image
Paul Mendelson IBM Champion

One trick I like to use is to add another combination, set it to markers and the colors to transparent





I have two data items in that combination, min and max, set to -0.5 and 1.5 respectively. And unchecking "Include Zero" in the axis range. By doing so I get a little bit of finer control over exactly how the axis appears. It's not perfect because the graph automatically tries to "pretty fit" the axis. I set the chart node member to Text and " " so it doesn't affect the legend. The cool thing with this is you can add a prompt that let's the user select whether to make the chart 0 based or not (which 99% of the time it should absolutely be). 

Something like:

#let zerobased = prompt('make0Based','token','Yes');
 
case zerobased
when 'Yes' then '0'
else '[% of plan] * 0.9'
end#
 This trick also works if the data is all 0s: