Ejemplo n.º 1
0
def GetGLineUrl(plot_list, width=600, height=500):
  """Get Google line chart url string.

  Args:
    plot_list: Numeric number list.
               A list also can contain negative value elements.
    width: Image width when it is rendered in web browser.
    height: Image height when it is rendered in web browseor.

  Returns:
    An url string that will create chart image in google chart.
  """
  max_y = max(plot_list)
  min_y = min(plot_list)
  
  gchart = GChart()
  gchart.type('line')
  gchart.dataset(plot_list)
  
  gchart.size(width, height)
  
  gchart.axes.type('y')
  gchart.axes.range(0, min_y, max_y)
  gchart.scale(min_y, max_y)
  
  return str(gchart)
Ejemplo n.º 2
0
def simple():
   G = GChart()
   # Set the chart type, either Google API type or regular name
   G.type('pie')
   # Update the chart's dataset, can be two dimensional or contain string data
   G.dataset('helloworld')
   # Set the size of the chart, default is 300x150
   G.size(250, 100) 
   print G
Ejemplo n.º 3
0
 def simple(self):
     # Instantiate the GChart instance, this is all you will need for making charts
     # GChart(type=None, dataset=None), see the doc for more
     G = GChart()
     # Set the chart type, either Google API type or regular name
     G.type('pie')
     # Update the chart's dataset, can be two dimensional and contain string data
     G.dataset('helloworld')
     # Set the size of the chart, default is 300x150
     G.size(250, 100)
     return G