Hey, I'm trying to use a global variable in the construction of my
chart, and I have 2 questions. First off, is there any way to get the
google charts server to ping me back with some debugging info? I have
no idea what I'm actually passing to the chart and it would be really
nice to know.

Secondly, How would I go about passing variables to the posted chart?
Currently I'm just including my file like so:

<?php
  echo WP_PLUGIN_DIR . "/widget-dash-replace/index.php";
  // Create some random text-encoded data for a line chart.
  header('content-type: image/png');
  $url = 'https://chart.googleapis.com/chart?chid=' .
md5(uniqid(rand(), true));
  $chd = 't:';

  global $data_array;
  $x_values = array_keys($data_array);
  $y_values = array_values($data_array);

  $chd .= implode(',', $x_values);
  $chd .= '|';
  $chd .= implode(',', $y_values);

  // Add data, chart type, chart size, and scale to params.
  $chart = array(
    'cht' => 'lxy',
    'chs' => '500x200',
    'chd' => $chd);

  // Send the request, and print out the returned bytes.
  $context = stream_context_create(
    array('http' => array(
      'method' => 'POST',
      'content' => http_build_query($chart,'','&'))));
  fpassthru(fopen($url, 'r', false, $context));
?>

and then parsing the data that I need as I go along. Is there a better
method to pass data to the img script? I'm not even sure this method
works at all.

-- 
You received this message because you are subscribed to the Google Groups 
"Google Chart API" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-chart-api?hl=en.

Reply via email to