Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

lessassy
New Contributor III

scroll cursor on the right of a chart

Hello everyone,

I had a simple question to ask

scroll right.PNG

I want to put the scroll button on the right of the chart just like in the picture.

Is it possible to do it ?

Thanks a lot for answering

Tags (1)
1 Solution

Accepted Solutions
mwoolf
Honored Contributor II

Re: scroll cursor on the right of a chart

"for i = 0 to s-1" should be on a separate line

View solution in original post

13 Replies
Chanty4u
Esteemed Contributor III

Re: scroll cursor on the right of a chart

Hi

i think there is no direct way to do it   here some workaround given go through it might help you

Scroll bar in bar chart

mwoolf
Honored Contributor II

Re: scroll cursor on the right of a chart

This can be done with a macro:

sub ChartXScrollInitRight

stop

s=ActiveDocument.NoOfSheets for i = 0 to s-1

set s=ActiveDocument.Sheets(i)

objs=s.GetSheetObjects

for j=lbound(objs) to ubound(objs)

    strCHID = objs(j).GetObjectID

    strSearch = "CH28,CH29,CH30,CH61,CH59,CH57,CH62,CH65,CH66,CH67,CH68,CH69,CH130"   'List of charts

    intFound =  instr(strSearch,mid(strCHID,10,5))

if intFound > 0 then

Set rep = ActiveDocument.GetSheetObject(strCHID)

set p = rep.GetProperties

p.ChartProperties.XScrollInitRight = True

rep.SetProperties p

end if

next

next

end sub

lessassy
New Contributor III

Re: scroll cursor on the right of a chart

Sorry  it might be a stupid question but where do i Put this formula exactly ?

In the script ?

In the Tool/Module ?

mwoolf
Honored Contributor II

Re: scroll cursor on the right of a chart

Yes

lessassy
New Contributor III

Re: scroll cursor on the right of a chart

I tried but I Got a message error.

The module underline the line s=ActiveDocument.NoOfSheets for i = 0 to s-1. before display the error.

Also i wanted to know if there are any other area where it's false.

Macro Fail.PNG

lessassy
New Contributor III

Re: scroll cursor on the right of a chart

I'm not familiar with these kind of macro.

Sorry i'm new.

So  i know i made several mistake on the code.

It would be nice if you underlight the exact sentence i should put.

Thank you

for instance :

chart=ActiveDocument.NoOfSheets for i = 0 to s-1 : DO i Have to put the number of charts i have in my tab

The same apply to the over lines

lessassy
New Contributor III

Re: scroll cursor on the right of a chart

I also found this macro nline :

DO this also work for my case ?


Sub SetScrollRight



set chart1 = ActiveDocument.GetSheetObject("CH13")


set p1 = chart1.GetProperties


p1.ChartProperties.XScrollInitRight = true


chart1.SetProperties p1


End sub


But what I don't know it's that if the name "chart 1" is the name of the chart or it's just a random name given. Because i tried with this one and a message erro appeared, saying that they could not found chart 1.

mwoolf
Honored Contributor II

Re: scroll cursor on the right of a chart

This macro is looking for a chart with the Object ID = CH13.

Put the Object ID of you chart in place of CH13 and this macro should work.

lessassy
New Contributor III

Re: scroll cursor on the right of a chart

Well i tried and it's not working either.

I will put your formula instead but i need few informations:

This can be done with a macro:

sub ChartXScrollInitRight

stop

s=ActiveDocument.NoOfSheets for i = 0 to s-1 --> Do I replace 0 by the first chart (ag: CH01) and s-1 to the last chart (example: CH17)

set s=ActiveDocument.Sheets(i) Instead of i do I put all the chart i want the macro to active. For instance i have 2 chart (1, 2 and 3) and then i put ("CH01,CH02,CH03,CH04"

objs=s.GetSheetObjects --> Do i have to change this ?

for j=lbound(objs) to ubound(objs)

    strCHID = objs(j).GetObjectID

    strSearch = "CH28,CH29,CH30,CH61,CH59,CH57,CH62,CH65,CH66,CH67,CH68,CH69,CH130"   'List of charts

    intFound =  instr(strSearch,mid(strCHID,10,5)) ---> DO I have to change this ?

if intFound > 0 then

Set rep = ActiveDocument.GetSheetObject(strCHID)

set p = rep.GetProperties

p.ChartProperties.XScrollInitRight = True

rep.SetProperties p

end if

next

next

end sub