Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Qlikview charttype

Hey,

I'm wondering if anyone knows if it is possible to change charttype based on selection. In my particular case I display a scatter plot but I want it to change to a line graph when the user zooms in. E.g, the scatter chart displays sales per region/time combination but as soon as the user selects a region the trend should be displayed as a line graph.

1 Solution

Accepted Solutions
Gysbert_Wassenaar

Well, technically it is possible with a macro. But it's easier to use two separate charts and show/hide them as needed. Charts that are hidden aren't calculated so they don't impact performance. On the Layout tab of the charts properties window you can enter an expression if you select the Conditional option. Something like =if(getselectedcount(Region)=1, 1, 0) for the line chart and =if(getselectedcount(Region)=1, 0, 1) for the scatter chart.


talk is cheap, supply exceeds demand

View solution in original post

5 Replies
Anonymous
Not applicable
Author

Can use a macro, fired off by a trigger on a change of the region (Settings>Document>Triggers) that contains commands like these:

set chart = ActiveDocument.GetSheetObject("CH01")

chart.SetProperties p

chart.SetChartType  4       'line

I would avoid the use of macros though as they sometimes don't work on Ajax.

You could instead just create two charts and set the show condition to show one when the count(distinct Region)=1 or count(distinct Region)>1

Jonathan

Gysbert_Wassenaar

Well, technically it is possible with a macro. But it's easier to use two separate charts and show/hide them as needed. Charts that are hidden aren't calculated so they don't impact performance. On the Layout tab of the charts properties window you can enter an expression if you select the Conditional option. Something like =if(getselectedcount(Region)=1, 1, 0) for the line chart and =if(getselectedcount(Region)=1, 0, 1) for the scatter chart.


talk is cheap, supply exceeds demand
Not applicable
Author

That's incredibly helpful Gysbert, thanks.

One more question though, how can I integrate both graphs in a container without having double the amount of tabs?

Gysbert_Wassenaar

That's not going to happen.

But since you now know how to show/hide objects you can use buttons or textboxes to show/hide the objects instead of putting them in a container. You can add a Set Variable action to a button or textbox to change the value of a variable and use the variable in the conditional expression of a chart. For example a variable vMyVariable that changes between 0 and -1 (i.e. False and True). Add a Set Variable action to the button, choose vMyVariable as variable and as value: =not vMyVariable. You can use the same variable to change the text on the button of textbox: =if(vMyVariable, 'Hide chart xx', 'Show chart xx').

This gives you much more flexibility than a container can.


talk is cheap, supply exceeds demand
Not applicable
Author

I was afraid so. Got to redesign the app then. Thanks a lot again!