5 Replies Latest reply: Jan 8, 2013 2:22 AM by Jonathan Brough RSS

    Select Chart In Container Issue

      Hi Friends,

       

         I need Some Help. My Requirement is I have 4 charts in a sheet. 2 bar charts(1male scores,1 female scores) and 2 pivot tables(1 male scores, 1 female scores). 2 bar charts are placed in one container and 2 pivot tables are placed in one container. if i select male scores bar chart in one container it will select male scores automatically for pivot also. Thats Solve.

       

       

      Regards,

      Nirmal

        • Re: Select Chart In Container Issue
          Jonathan Brough

          Maybe the advice I gave in this recent post may help. http://community.qlik.com/message/296692#296692

          Jonathan

            • Re: Select Chart In Container Issue

              Thanks For You Reply Mr. Jon. But My Requirement Is Without Button I need To Activate The Sheet Object.

                • Re: Select Chart In Container Issue
                  Jonathan Brough

                  You can test whether a chart is active by using the macro code SheetObject.IsActive. This could then be used to set a variable to be using in a conditional show on the layout tab for the other charts.

                  I am not sure however how you can trigger such a macro code as Chart objects don't have Actions properties and the available sheet objects are not included as Triggers under the Document settings.

                  You could set a thread that leeps for a second efore testing this, but I suspect the performance impact, and potential for the thread to be interupted, would not be justified.

                  Jonathan

                    • Re: Select Chart In Container Issue

                      Can You Please Send me That Macro.....

                        • Re: Select Chart In Container Issue
                          Jonathan Brough

                          If you go to the API Guide qvw file's 'Automation examples' sheet and select Member 'IsActive' and Class 'SheetObject' you get the following example that tests for what object is active and then minimizes it:

                           

                          rem ** minimize all active sheet objects on active sheet **

                          set s=ActiveDocument.ActiveSheet

                          objs=s.GetSheetObjects

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

                              if objs(i).IsActive then objs(i).Minimize

                          next

                           

                          If you then choose Member 'Activate' you will see another example on how to activate sheet objects (all the objects on a sheet though):

                           

                          rem ** activate all sheet objects on sheet Main one by one **

                          set s=ActiveDocument.Sheets("Main")

                          for i=0 to s.NoOfSheetObjects-1

                              s.SheetObjects(i).Activate

                          next

                           

                          Between these two bits of code you should be able to get something that tests which of one chart is active and activates another chart accordingly. As I said before however, I am not sure how you would trigger this as Chart SheetObjects don't have triggers or Actions properties.

                          Jonathan