Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3218500
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T15:32:06+00:00 2026-05-17T15:32:06+00:00

I’m trying to make an XYLine with the Google Chart API via the not-so-well-documented

  • 0

I’m trying to make an XYLine with the Google Chart API via the not-so-well-documented GChartWrapper libraries.

Here’s a portion of the code that is supposed to generate the graph:

data = []
traffic_max = 0
date_minmax = []

#I have a number of timestamped readings in two series
for site in sites:
  site_data = get_datapoints_for(site)

  date_values = [datetime_to_unix(item.timestamp) for item in site_data]
  date_minmax = minmax(date_minmax + date_values) #get min and max values for
                                                  #scaling
  traffic_values = [item.traffic for item in site_data]
  traffic_max = max(traffic_max, *traffic_values) #just get maximum for readings

  #build graph
  data.append(date_values)
  data.append(traffic_values)

#add leeway to axes
date_minmax[0] -= 500
date_minmax[1] += 500
traffic_max /= 0.9

#build graph
chart = LineXY(data)
chart.legend(*sites)
chart.color("green", "red")
chart.size(600,400)
chart.scale(date_minmax[0], date_minmax[1], 0, traffic_max)
chart.axes.type("xy")
chart.axes.range(0, *date_minmax)
chart.axes.range(1, 0, traffic_max)

chart_url = chart.url

However, this is what I get:

link text

Question: What happened to the red series?


For your convenience, here is data after some pretty print love:

[[1286116241.448437, 1286118544.4077079, 1286119431.18503, 1286121011.5838161],
 [6710.9899999999998,
  6716.2799999999997,
  6641.8900000000003,
  6644.9499999999998],
 [1286116241.979831,
  1286118545.0123601,
  1286119431.9650409,
  1286121012.1839011],
 [38323.860000000001,
  38326.620000000003,
  38327.660000000003,
  38329.610000000001]]

Here is the list of parameters generated by the wrapper, also after some pretty print love:

chco=008000,FF0000
chd=t:1286116241.0,1286118544.0,1286119431.0,1286121011.0
    6711.0,6716.3,6641.9,6644.9
    1286116241.0,1286118545.0,1286119431.0,1286121012.0
    38323.9,38326.6,38327.7,38329.6
chdl=gaming.stackexchange.com
    serverfault.com
chds=1286115741.0,1286121512.0,0,42588.4555556
chs=600x400
cht=lxy
chxr=0,1286115741.0,1286121512.0
    1,0,42588.4555556
chxt=x,y
cht=lxy
chxr=0,1286116241.45,1286121012.18
    1,0,42588.4555556
chxt=x,y
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T15:32:07+00:00Added an answer on May 17, 2026 at 3:32 pm

    The problem was here:

    chart.scale(date_minmax[0], date_minmax[1], 0, traffic_max)
    

    The Google API allows you to define a different scale per each series. Thus, you need to specify the scaling for each series, whereas the above only affected the first series.

    Changing that line to:

    chart.scale(*[date_minmax[0], date_minmax[1], 0, traffic_max]*len(sites))
    

    …forces all series to the same scaling.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I'm making a simple page using Google Maps API 3. My first. One marker
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I am trying to render a haml file in a javascript response like so:
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I'm trying to select an H1 element which is the second-child in its group
I need a function that will clean a strings' special characters. I do NOT

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.