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

Is there an easy way to set the scrolled position for a line graph?

Is there an easy way to set the scrolled position for a line graph?

On the Presentation tab in the user interface, Max Visible is set to 15 and Show X-Axis Scrollbar is checked. 

Can I dynamically when a user opens the .qvw presentation have the scrolling position automatically be set to the right most position representing the most current data?

1 Solution

Accepted Solutions
johnw
Champion III
Champion III

8 Replies
johnw
Champion III
Champion III

Yes, but the way I know to do it involves a little macro code.  Set an OnOpen trigger to execute a macro.  In the macro, execute code like this.  Substitute your own chart ID, of course.

set chart           = ActiveDocument.GetSheetObject("CH23")
set chartProperties = chart.GetProperties
chartProperties.ChartProperties.XScrollInitRight = true
chart.SetProperties chartProperties

Not applicable
Author

Thanks…… Sweet, great intro….. works great, updated multiple objects and is fine.

Will this simple macro be ok if this is placed on a server and gets updates from there? Will users who then access this and open the document from the server get the macro update?

johnw
Champion III
Champion III

As I recall, and unless this has changed in more recent versions, the OnOpen trigger is not guaranteed to work in a server environment.  That said, I have never seen my OnOpen triggers fail in a server environment.  Also, it's possible that the XScrollInitRight is a permanent property stored when you save, like a checkbox that just somehow didn't make it into the point and click object properties, but is still really there.  If so, executing the macro once, saving, and then removing the macro never to execute again would still work.  I've not tested that, though.

Not applicable
Author

John,

Great.

Does this script look ok?

set chart = ActiveDocument.GetSheetObject("CH24")

set chartProperties = chart.GetProperties

true

set chart2 = ActiveDocument.GetSheetObject("CH56")

set chartProperties2 = chart2.GetProperties

true

I started to get a Inconsistency Type B and D a couple times in the last couple hours. One thing I changed in the last 24 hours was to use this trigger. Wondering did I mess it up somehow that I am not seeing? The script seems to correctly update.

Thanks,

DD

johnw
Champion III
Champion III

That script seems to be missing a bunch of stuff on your "true" lines.

Since posting yesterday I verified that once the macro has executed, the property remains.  You should be able to remove the trigger.  I did so successfully in a sample application.  So just in case the trigger has anything to do with the internal inconsistency error, you can try removing it, and even the macro if you want.

Not applicable
Author

John,

Sorry, here is text paste:

set chart = ActiveDocument.GetSheetObject("CH24")

set chartProperties = chart.GetProperties

chartProperties.ChartProperties.XScrollInitRight = true

chart.SetProperties chartProperties

set chart2 = ActiveDocument.GetSheetObject("CH56")

set chartProperties2 = chart2.GetProperties

chartProperties2.ChartProperties.XScrollInitRight = true

chart2.SetProperties chartProperties2

DD

johnw
Champion III
Champion III

Looks fine.

jonathjl
Contributor II
Contributor II

do you have an example qvw of this?