2 Replies Latest reply: Mar 6, 2013 4:47 AM by Johan Lindell RSS

    Show and hide charts via macro

    Johan Lindell

      I was struggling to show different charts when clicking on gauges for a dashboard with the ajax client and layers. There are some posts on working with layers that works fine in the IE-plugin client. But it does not work in the Ajax client.

       

      This syntax goes like this - showing Chart1 over Chart 2:

       

      ActiveDocument.GetSheetObject("CH01").SetLayer 1

      ActiveDocument.GetSheetObject("CH02").SetLayer -1

       

       

      So I tried to find a solution with hiding / showing the charts when clicking. There are plenty examples for text-boxes but this does not work for charts. And I had trouble finding a solution for charts - also in the API-guide.

       

      This syntax is like this for showing a box and does not work for charts:

       

      set LB = ActiveDocument.GetSheetObject("LB01")

      set boxprop=LB.GetProperties

      boxprop.Layout.Frame.Show.Always = false

      boxprop.Layout.Frame.Show.Expression.v = "1=2"

      LB.SetProperties boxprop

       

      After some work and tests I found the macro syntax that works.

       

      Hiding a chart:

       

      set fd = BU.GetFrameDef

      set CH = ActiveDocument.GetSheetObject("CH01")

      fd.Show.Always = false

      fd.Show.Expression.v = "1 = 2"

      CH.SetFrameDef fd

       

      Showing a chart:

       

      set CH = ActiveDocument.GetSheetObject("CH01")

      set fd = BU.GetFrameDef

      fd.Show.Always = true

      fd.Show.Expression.v = ""

      CH.SetFrameDef fd

       

      See attached a simple example

       

      //Johan