<html>
<head>
<title>Test</title>
</head>
<body>
<script type="text/javascript">

// I have not tested it, but I presume that chart legends will be
similarly affected.

var chart = ''; // Will hold entire chart definition to send to
Google.

var s = new Array(); var i=0; // Array with text samples to test.

// Populate the text array with different methods to define one
characater.
s[i++] = 'A';              // - Unicode A via simple quoting.

s[i++] = '&#x0042;';       // - Unicode B via html escape
s[i++] = '\u0043';         // - Unicode C via javascript unicode
escape

s[i++] = '&#x2646;';       // - Unicode Neptune (trident) via html
escape
s[i++] = '\u2646';         // - Unicode Neptune (trident) via
javascript unicode escape
                           //   Neither method works okay, but at
least you still get a chart.
                           //   (converted to rectangles (FF) or
"?" (IE7).

s[i++] = '&alpha;';        // - HTML entity that sort of works. It
gets converted to "a".

s[i++] = '&#x0100;';       // - A with horizontal bar accent. FF okay,
IE removes the accent.


// The following cause errors :
// s[i++] = 'Á';             // These work okay in FF, but with IE the
title and annotation series
// s[i++] = '&#x00c1;';      // are completely missing. Maybe the
"GET" is not properly escaped.
                             // Note: 00c1 is the unicode sequence for
"Á".
// s[i++] = '&euro;';        // Euro currency. Same error as above. In
fact, IE fails with all
                             // HTML entities I tried above 00A0.

if(i>9) {alert("Too many samples, set to 9!"); i=9;};

// Define chart
chart += '?cht=s';
chart += '&chs=300x300';

// Put test chars into title, separate them with "_" (underscore).
chart += '&chtt=' + s[0]; for (j=1; j<=i-1; j++) {chart += '_' + s
[j];};

// Data points.
chart += '&chd=t:10,20,30,40,50,60,70,80,90|50,50,50,50,50,50,50,50,50|
100,100,100,100,100,100,100,100,100';

// Axes legend.
chart += '&chxt=x,y&chxl=0:|0|20|30|40|50|60|70|80|90|10|1:|0|25|50|75|
100';

// Position digits 1 to 9 at 90% height.
chart += '&c...@t1,000000,0,.1:.9,20,1';
chart +=     '|@t2,000000,0,.2:.9,20,1';
chart +=     '|@t3,000000,0,.3:.9,20,1';
chart +=     '|@t4,000000,0,.4:.9,20,1';
chart +=     '|@t5,000000,0,.5:.9,20,1';
chart +=     '|@t6,000000,0,.6:.9,20,1';
chart +=     '|@t7,000000,0,.7:.9,20,1';
chart +=     '|@t8,000000,0,.8:.9,20,1';
chart +=     '|@t9,000000,0,.9:.9,20,1';

// Add test symbols as markers on chart at 70% height.
chart += '|@t'+s[0]+',000000,0,.1:.7,20,1';
for (j=1; j<=i-1; j++) {k = j+1; chart += '|@t' + s[j] + ',000000,0,.'
+ k + ':.7,20,1';};

// Define image tag including the chart definition.
var image_tag = '<img src="http://chart.apis.google.com/chart' + chart
+ '" alt="">';

// Write it to document.
document.write (image_tag); //alert(chart);

// For debug purposes, display the coded url. Break it into readable
segments.
document.write ('<p>' + chart.replace(/\&c/g, "<br><br>&c").replace(/
\@/g, "<br>@") + '</p>');

</script>
</body></html>

--

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