Skip to main content
Announcements
See why Qlik was named a Leader in the 2024 Gartner® Magic Quadrant™ for Data Integration Tools for the ninth year in a row: Get the report
cancel
Showing results for 
Search instead for 
Did you mean: 
Jonathan_Alm
Partner - Creator
Partner - Creator

Dynamic number of x-axis columns on bar chart

Hi,

There is a possibility to change the maximum number of columns in a bar chart (see image below).

 

Jonathan_Alm_0-1673942547293.png

I have a bar chart which is a drill down-chart (hierarchy-dimension). First dimension is month.  If i select maximum number = 12, then the bar chart will stretch and use all the space.
However if I click on month, the chart will drill down to date. Then only 12 dates are shown.
If I select automatic in number of axis value, the month view will not be strectched and only uses 2/3 of the diagram making it look quite funny.


Is there a way to make maximum values more dynamic with an expression - so in  month view, it will use 12 and in date view it will be 31?

Kind regards, Jonathan

Kind regards 

Labels (2)
1 Solution

Accepted Solutions
vinieme12
Champion III
Champion III

since it's a drilldown, GetSelectedCount() will work

 

=if(GetSelectedCount(Month),31,12)   

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.

View solution in original post

5 Replies
vinieme12
Champion III
Champion III

Use GetObjectDimension() as  below to check which dimension is being used

 

=if(getobjectdimension(0)='Month',12

,if(getobjectdimension(0)='Date',31,ELSEValue) )

 

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
Jonathan_Alm
Partner - Creator
Partner - Creator
Author

Hi,

It looks like it should work. If i put the expression in a table it computes perfectly, but when I put it in the line chart it only falls back on 3 (only three dimensions in line chart.

See image below. Am I doing something wrong here that is obvious to you?

Jonathan_Alm_1-1674046736837.png

 

Kind regards, Jonathan

 

 

marcus_sommer

Regarding to the help this function couldn't be applied within all chart-parts and I assume the maximum number belonged to the not supported ones: GetObjectDimension - chart function | Qlik Cloud Help

Without supporting the function within the various meta-data areas of a chart and the earlier in QlikView working second parameter (Object-ID to call the function from the outside of the object) and also not supporting features like getcurrentfield() it seems not be possible - at least not with the standard dimension-groups.

vinieme12
Champion III
Champion III

since it's a drilldown, GetSelectedCount() will work

 

=if(GetSelectedCount(Month),31,12)   

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
Jonathan_Alm
Partner - Creator
Partner - Creator
Author

Thanks, works like a charm

 

Kind regards, Jonathan