Beispiel #1
0
 def getImage(self):
   params = self.__getDataAndMeta()
   cl = PlottingClient()
   if not params.has_key("Meta"):
     params["Meta"] = {"graph_size":"normal"}
   elif not params.has_key("Data"):
     result = cl.textGraph("Data for the plot is not defined","Memory",params["Meta"])
   elif not params.has_key("PlotType"):
     result = cl.textGraph('Type of plot is absent','Memory',params["Meta"])
   else:
     if params["PlotType"] == "pieGraph":
       result = cl.pieGraph(params["Data"],'Memory',params["Meta"])
     elif params["PlotType"] == "histogram":
       result = cl.histogram(params["Data"],'Memory',params["Meta"])
     elif params["PlotType"] == "qualityGraph":
       result = cl.qualityGraph(params["Data"],'Memory',params["Meta"])
     elif params["PlotType"] == "cumulativeGraph":
       result = cl.cumulativeGraph(params["Data"],'Memory',params["Meta"])
     elif params["PlotType"] == "lineGraph":
       result = cl.lineGraph(params["Data"],'Memory',params["Meta"])
     elif params["PlotType"] == "barGraph":
       result = cl.barGraph(params["Data"],'Memory',params["Meta"])
     else:
       result = cl.textGraph('The plot type ' + str(params["PlotType"]) + ' is not known','Memory',params["Meta"])
   if result["OK"]:
     plot = result["Value"]
     response.headers['Content-type'] = 'image/png'
     response.headers['Content-Length'] = len(plot)
     response.headers['Content-Transfer-Encoding'] = 'Binary'
     response.headers['Cache-Control'] = 'no-cache' # cache switchoff
     response.headers['Expires'] = '-1' # cache switchoff for old clients
     return plot
   else:
     return result["Message"]
Beispiel #2
0
 def buildPlot(self,data,title):
   cl = PlottingClient()
   result = cl.lineGraph(data,'Memory',title)
   if result["OK"]:
     plot = result["Value"]
     response.headers['Content-type'] = 'image/png'
     response.headers['Content-Length'] = len(plot)
     response.headers['Content-Transfer-Encoding'] = 'Binary'
     response.headers['Cache-Control'] = 'no-cache' # cache switchoff
     response.headers['Expires'] = '-1' # cache switchoff for old clients
     return plot
   else:
     return result["Message"]
Beispiel #3
0
 def buildPlot(self, data, title):
     cl = PlottingClient()
     result = cl.lineGraph(data, 'Memory', title)
     if result["OK"]:
         plot = result["Value"]
         response.headers['Content-type'] = 'image/png'
         response.headers['Content-Length'] = len(plot)
         response.headers['Content-Transfer-Encoding'] = 'Binary'
         response.headers['Cache-Control'] = 'no-cache'  # cache switchoff
         response.headers[
             'Expires'] = '-1'  # cache switchoff for old clients
         return plot
     else:
         return result["Message"]
Beispiel #4
0
 def getImage(self):
     params = self.__getDataAndMeta()
     cl = PlottingClient()
     if not params.has_key("Meta"):
         params["Meta"] = {"graph_size": "normal"}
     elif not params.has_key("Data"):
         result = cl.textGraph("Data for the plot is not defined", "Memory",
                               params["Meta"])
     elif not params.has_key("PlotType"):
         result = cl.textGraph('Type of plot is absent', 'Memory',
                               params["Meta"])
     else:
         if params["PlotType"] == "pieGraph":
             result = cl.pieGraph(params["Data"], 'Memory', params["Meta"])
         elif params["PlotType"] == "histogram":
             result = cl.histogram(params["Data"], 'Memory', params["Meta"])
         elif params["PlotType"] == "qualityGraph":
             result = cl.qualityGraph(params["Data"], 'Memory',
                                      params["Meta"])
         elif params["PlotType"] == "cumulativeGraph":
             result = cl.cumulativeGraph(params["Data"], 'Memory',
                                         params["Meta"])
         elif params["PlotType"] == "lineGraph":
             result = cl.lineGraph(params["Data"], 'Memory', params["Meta"])
         elif params["PlotType"] == "barGraph":
             result = cl.barGraph(params["Data"], 'Memory', params["Meta"])
         else:
             result = cl.textGraph(
                 'The plot type ' + str(params["PlotType"]) +
                 ' is not known', 'Memory', params["Meta"])
     if result["OK"]:
         plot = result["Value"]
         response.headers['Content-type'] = 'image/png'
         response.headers['Content-Length'] = len(plot)
         response.headers['Content-Transfer-Encoding'] = 'Binary'
         response.headers['Cache-Control'] = 'no-cache'  # cache switchoff
         response.headers[
             'Expires'] = '-1'  # cache switchoff for old clients
         return plot
     else:
         return result["Message"]