The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My badges

  • Twitter Updates

  • My Flickr Stream

  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 1,595 other followers

Old Google Charting API: tools for still using them

Posted by jpluimers on 2016/11/10

While mocking the ScaleMM documentation, I bumped into a chart that I thought was an image, but is in fact generated by the (now deprecated) Image Charts API from Google.

In fact it is generated on the fly from a URL: http://chart.apis.google.com/chart?chxr=0,0,16|1,0,14682…&nonsense=something_that_ends_with.png

Compare the two below. They are identical (:

Static ScaleMM1 comparison chart

Static ScaleMM1 comparison chart

URL based ScaleMM1 comparison chart

URL based ScaleMM1 comparison chart

Even though the API is deprecated Google has no plans to turn it of, so it still works and is the easiest way to get charts into a Markdown or reStructuredText document.

In practice, it doesn’t matter if you use the chart.apis.google.com or chart.googleapis.com domain: they give the same results the same.

As I wanted to convert the results.txt to a chart, I dissected the above URL, looked up the definitions of the URL parameters (the trickiest: cds for lxy graphs and the combination of chds and chxr, easier: chls) and created a new URL for the chart below.

Notes:

  • The number of entries chds and chdl must be the same.
  • The number of entries in chds and chdl must match the number of lines in cds.
  • The chxr axis start/end values must match the ones in chds.
  • I let the axis start at 1 (not 0) as a zero-thread application is kind of useless.
  • I increased the height to be twice the previous one as both JemallocMM and JemallocFFMM perform so badly.
  • The undocumented parameter suffix nonsense=something_that_ends_with.png is absolutely essential: it is ignored by the API, but used by the Markdown to HTML conversion to recognise the image type (PNG) which the API generates so the browser can use the image to get width/height information.

The URL: http://chart.googleapis.com/chart?chxr=0,1,8|1,0,11500&chxs=0,676767,11.5,0,lt,676767&chxt=x,y…&nonsense=something_that_ends_with.png

The chart: it continuous to scale in the same linear way as the previous measurements.

Static SimpleChallenge comparison chart

Static SimpleChallenge comparison chart

URL SimpleChallenge comparison chart

URL SimpleChallenge comparison chart

I hand picked the line colours (avoiding black and white) from Ssnot!: Kmeans++ Color Quantization seeding which does not take into account Color Universal Design (CUD) / Colorblind Barrier Free and does not work that well on a white background.

–jeroen

references:

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

 
%d bloggers like this: