Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Missing bars in bar chart (advanced)

Hi everybody

In my last post (Missing bars in bar Chart) I was wondering how I can add missing bars in a bar chart with a predefined bin size.
i.e i want to plot the Count of y where y =(0,1,1.5,5,6) in a bar plot with bins 0-2, 2-4, 4-6 and i want to see the bin 2-4 with Count 0.

This Problem could be solved by Alex Timofeyev, thanks a lot. His answer can be found here: Missing bars in bar Chart.


Now my next question: I want to have a more dynamical bar chart where i always see around 10 bars independent of the drilldown level ( or another Number depending on a user input, but i don't include this since probably not all of you have this  add-on).
To achive that i created the variables: vminy=min() and vmaxy=max().

In vN the desired number of bins are stored.

The Dimension has the form [bins for y dynamically] = class(y ,  ( $(vmaxy)-$(vminy) )/ $(vN) )

In the bar chart I plot [bins for y dynamically] and Count(y).

If I drill down much into y i see jumps between the boundaries of the bins.

I would like to add bins which show a count 0 betwwen. ( see Level2.png)
I attache my testworkbook: test.qvf  (and 2 png files to clarify my question

11 Replies
Not applicable
Author

I think you have to poste the code...
The data load Editor is alway empty if I load skripts from other People....

alextimofeyev
Partner - Creator II
Partner - Creator II

That is strange. What version of QS are you using?

Here is the script from my latest example:

[Sheet1]:

LOAD

    x,

    y,

y as z

FROM [lib://Documents/Test2.xlsx]

(ooxml, embedded labels, table is Sheet1);

TempY:

LOAD

Min(y) as MinY,

Max(y) as MaxY

Resident Sheet1;

Let vMinY = Peek('MinY',0,'TempY');

Let vMaxY = Peek('MaxY',0,'TempY');

Intervals:

Load

RowNo()/100 as z

autogenerate($(vMaxY)*100);

Drop Table TempY;