I want to embed a google chart into the description of a placemark in
a KML File.

The problem is this: if I simply use the URL, it is working with very
simple Google Charts.

Unfortunately my chart is a little more complex and data are stored on
a public Google Spreadsheet:

<head>
   <title> CLimAlpTour Project - Temperatures Chart </title>
   <script language="javascript" src="http://www.google.com/jsapi";></
script>
   </head>
   <body>

   <div id="chart"></div>

   <script type="text/javascript">
      var queryString = 'SELECT A,B,C,D,E,F,G';
      var dataUrl = 'https://spreadsheets.google.com/ccc?
key=0Ao30UgWMlOC_dHFONUJnOTQ2dFduYkt2Z29lZktVSlE&hl=en';

      function onLoadCallback() {
        if (dataUrl.length > 0) {
        /* alert("Loading data from Google Spreadsheet!"); */
          var query = new google.visualization.Query(dataUrl);
          query.setQuery(queryString);
          query.send(handleQueryResponse);
        } else {
             /*
          var dataTable = new google.visualization.DataTable();
          dataTable.addRows(53);

          dataTable.addColumn('number');
          dataTable.addColumn('number');

          dataTable.setValue(0, 0, 37.910661144194286);
          dataTable.setValue(0, 1, 16.39344262295082);
          dataTable.setValue(0, 2, 32.78688524590164);
          draw(dataTable); */

          alert("Data are not available, loading fake data!")
        }
      }

      function draw(dataTable) {
        var vis = new
google.visualization.ImageChart(document.getElementById('chart'));
        var options = {
          chxl: '0:|1995|1996|1997|1998|1999|2000|2001|2002|2003|2004|
2005|2006|2007|2008|1:|-25|-20|-15|-10|-5|0|5|10|15|20|25|30|
35',       /* Chart X Labels */
          chxp: '',        /* chxp to space it in the middle of the
axis. */
          chxr: '',        /* Chart X Range */
          chxs: '',        /* You could consider adding tick marks on
the y-axis using chxs. */
          chxtc: '',       /* chxtc=1,10|2,-180 - Axis tick lengths
for the y- and r-axes. The first value specifies 10-pixel-long ticks,
outside the axis. The second value specifies 180-pixel-long ticks
inside the axis; the negative number means that the tick goes inside
the axis, and the tick is cropped to fit inside the chart. */
          chxt: 'x,y',     /* Chart Axis */
          chs: '900x450',  /* Shart Size */
          cht: 'lc',       /* Chart Type */
          chco: 'FF9900,FF99ff,009900,0099ff,999900,9999ff',  /* Color
Line */
          chds: '-25,35',          /* Custom Marker - Altezza massima
e minim delle y */
          // chd: 't:
37.911,34.166,35.881,35.067,32.94,30.466,25.87,32.787,32.787,32.787,31.148,32.787|-1',
---- Candelistik markers
          chdl: 'Min. Temp. Hoch Pustertal| Avg Temp. Hoch Pustertal|
Max. Temp. Hoch Pustertal| Min. Temp. Les Gets| Avg Temp. Les Gets|
Max. Temp. Les Gets',        /* Legenda dei valori - List separator is
| */
          chg: '10,10',                 /* Grid Interval */
          chls: '0.75,-1,-1|0.75,-1,-1|3,4,1|1',    /* Line Style -
Thickness, Length, Space */
          chm: 'x,FF000088,2,30.3,20|
b,EFEFEF66,0,1,0',                    /* Line fill
Axis,Color,StartLine, EndLine,0 */
         chf: 'a,s,900000FA|c,lg,0,FFE7C6,0,BBBBBB,1', /* Background
Color   */
         chtt:'CLimAlpTour Project - Temperatures Chart'
        };
        vis.draw(dataTable, options);
      }

      function handleQueryResponse(response) {
        if (response.isError()) {
          alert('Error in query: ' + response.getMessage() + ' ' +
response.getDetailedMessage());
          return;
        }
        draw(response.getDataTable());
      }

      google.load("visualization", "1", {packages:["imagechart"]});
      google.setOnLoadCallback(onLoadCallback);

    </script>
  </body>

Is there any way to embed this into the description?
I have just copied it as Source, but the system is not rendering the
page.

Is there any way to add a DataSource to the URL Format? I have not yet
found the right option in documentation (I think this is simply not
possible, by design).

Many thanks in advance for any help.

Best regards.

Stefano

-- 
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