Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Re-sizing Trellis Charts

I suspect I know the answer to this, but I thought I'd ask.

I want to make a trellis chart to show values on three countries (from a list). QV clearly calculates the allowable size of the trellis chart from the number of possibly results...

(Has a think - maybe if I set up an inline table with only the three countries in it, with two fields, country & MajorCountry, then use MajorCountry as the Dimension - hmmm, that didn't work :-()

I understand how to use ctrl-shift to adjust the chart area within the box, but is there a way to force the sizing of the trellis chart?

Bob

11 Replies
johnw
Champion III
Champion III

You can use a fixed number of rows and columns under the trellis settings.  Is that what you mean?

Not applicable
Author

No, I understand that, but the trellis charts do not scale to fit the size of the area available. I want to make the charts scale to make the most of whatever area I define for the whole group.

Trellis shapes.jpg

johnw
Champion III
Champion III

Ah!  That I don't know, and I'm curious myself.  I don't really use trellis charts, but when I've poked at them, I've seen that same problem.  I don't know how to fix it.

Not applicable
Author

I can achieve the Desired when I force the number of rows to be fixed at 1.

Not applicable
Author

Thanks - going to one row gets me much nearer, but not quite near enough.

Never mind, plan B awaits....

hdonald
Creator
Creator

Hi,

Maybe a macro would help with a more dynamic setting of rows and columns in the trellis chart ? e.g.

Set the number of columns to '3' but have a 'vCol' variable that sets a lower value if selections have reduced the number of columns  =if(GetPossibleCount(country)<3,GetPossibleCount(country),3). 

Set up a similar 'vRow' variable with another expression (depending on range expected).

then set up a macro, triggered OnActivate (for the sheet)  and OnAnySelect (for the document) to do the following;

set c=ActiveDocument.GetVariable("vCol")

set r=ActiveDocument.GetVariable("vRow")

set chart = ActiveDocument.GetSheetObject("CH01")

set p = chart.GetProperties

p.ChartProperties.TrellisProperties.EnablePrimaryDimension=true

p.ChartProperties.TrellisProperties.EnableSecondaryDimension=False

p.ChartProperties.TrellisProperties.Columns=c.GetContent.String 

p.ChartProperties.TrellisProperties.Rows=r.GetContent.String    

chart.SetProperties p

That might give you the layout control you're looking for,

Regards,

HD

orital81
Partner - Creator III
Partner - Creator III

Hi HD

Although this is an old post, I would like to clarify your reply which is relevant to me right now.

I tried to use your Macro suggestion but it didn't work.

Attached my model, Can you please assist?

Not applicable
Author

Hi Ori Tal,

I was looking the file you sent and the macro works, only you have to configure the trigger on the document.

You should set the action in the variable in the Document Properties options

Attached the new file

Regards

Thomas M.

Not applicable
Author

Hi,

You can simply go to trellis properties and change the number of rows to number of values you want to trellis for (say 2 if you want to trellis for 2 countries) and change number of rows to 1. It worked for me.

Regards,

Abhinav Garg