NetTalk Central

Author Topic: Template fix to support multiple graphs on a page  (Read 14452 times)

dmoyer

  • Newbie
  • *
  • Posts: 21
    • View Profile
    • Email
Template fix to support multiple graphs on a page
« on: March 21, 2008, 12:41:31 PM »
I have a dashboard report with 6 insight graphs.  The web server template only renders one of the graphs.  Here is a new NetGraphStuff group that renders unlimited graphs per page:

#Group(%NetGraphStuff)
  #if(not varexists(%vc))
    #declare(%vc)
  #EndIf
  #FOR(%ActiveTemplate),Where(%ActiveTemplate='Insight_Graph(Insight)')
    #FOR(%ActiveTemplateInstance)
      #Context(%Procedure,%ActiveTemplateInstance)
        #Set(%vc,%Object)
      #<!EndContext
    #<!EndFor
  #<!EndFor
  If not p_Web &= NULL
    #IF(%SecureRqd=1)
    If p_web.RequestData.WebServer.SSL = 1
    #ENDIF
    #IF(%LoginRqd=1)
      If p_web.GetSessionLoggedIn() = 1
    #ENDIF
    #IF(%LevelRqd)
        If p_web.GetSessionLevel() <= %LevelRqd
    #ENDIF
          %window{prop:hide} = 1
          %vc.Reset()
          %vc.Draw()
          ans = 'images\$$$' & format(random(1,99999),@n05) &'.png'
          %vc.SaveAs(clip(p_web.site.WebFolderPath) & '\' & Ans)
          %window{prop:pixels} = 1
          #Embed(%BeforeGraph,'Before Graph')
          packet = clip(packet) & p_web.CreateImage(ans,%vc.Width,%vc.Height,%vc.HeaderName)
          packetlen = len(clip(packet))
          #Embed(%AfterGraph,'After Graph')
          !p_web.ParseHTML(packet,1,packetlen,NET:NoHeader)
    #IF(%LevelRqd)
        End
    #ENDIF
    #IF(%LoginRqd=1)
      End
    #ENDIF
    #IF(%SecureRqd=1)
    End
    #ENDIF
   End
      #EndContext
    #EndFor
  #EndFor
    p_web.ParseHTML(packet,1,packetlen,NET:NoHeader)
    post(event:closewindow)
  !End


Basically just lets the template render for each instance of the insight template.  Would be nice to see this implemented as a fix in a future release:).

Dave Moyer

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11183
    • View Profile
Re: Template fix to support multiple graphs on a page
« Reply #1 on: March 22, 2008, 03:10:38 AM »
Hi Dave,

Thanks for the effort.
Done in 4.31

Cheers
Bruce