Hi!

The reason the A and B don't show, is not the method of creation of the
DataTable (JS vs JSON).
Try it -- replace your code with the code that creates the datatable in JS
and you'll still fail to see A and B.
The problem lies in various problems with flash in local files (look for
more info in earlier posts in this group).
Put the html file on a webserver and access it from there and you will see A
and B, both with JS and with JSON.
Just tried with VizBoy's code, and it works fine.

Regards,
VizGuy


On Wed, Feb 11, 2009 at 12:32 PM, jago <[email protected]> wrote:

>
> Thanks. But unlike the Javascript example in
>
> http://code.google.com/apis/visualization/documentation/gallery/annotatedtimeline.html
>
> your JSon example - and also those I wrote - do not show the labels
> 'A' and 'B' in the timeline. Do you see what I mean? I tested it on
> Windows and Linux using different browsers. The labels are always
> missing.
>
> On Feb 1, 6:24 pm, VizBoy <[email protected]> wrote:
> > Does this work for you?
> > If so, could you please explain what made it hard for you ? Perhaps we
> could
> > improve the documentation.
> >
> > Unformatted code:
> >
> > <html> <head>
> > <script type='text/javascript' src='http://www.google.com/jsapi
> '></script>
> > <script type='text/javascript'>
> > google.load('visualization', '1', {'packages':['annotatedtimeline']});
> > google.setOnLoadCallback(drawChart);
> > function drawChart() {
> > var data = new google.visualization.DataTable(
> > {
> > cols: [{label: 'Date', type: 'date'},
> > {label: 'Sold Pencils', type: 'number'},
> > {label: 'title1', type: 'string'},
> > {label: 'text1', type: 'string'},
> > {label: 'Sold Pens', type: 'number'},
> > {label: 'title2', type: 'string'},
> > {label: 'text2', type: 'string'}],
> > rows: [
> > {c:[{v: new Date(2008, 1 ,1)}, {v: 30000}, , , {v: 40645}]},
> > {c:[{v: new Date(2008, 1 ,2)}, {v: 14045}, , , {v: 20374}]},
> > {c:[{v: new Date(2008, 1, 3)}, {v: 55022}, , , {v: 50766}]},
> > {c:[{v: new Date(2008, 1, 4)}, {v: 75284}, , , {v: 14334},
> > {v: 'Out of Stock'}, {v: 'Ran out of stock on pens at 4pm'}]},
> > {c:[{v: new Date(2008, 1, 5)}, {v: 41476}, {v: 'Bought Pens'}, {v:
> 'Bought
> > 200k pens'}, {v: 66467}]},
> > {c:[{v: new Date(2008, 1, 6)}, {v: 33322}, , , {v: 39463}]}]}, 0.5);
> >
> > var chart = new
> >
> google.visualization.AnnotatedTimeLine(document.getElementById('chart_div'));
> >
> > chart.draw(data, {displayAnnotations: true});
> >
> > }
> >
> > </script>
> > </head>
> > <body>
> > <div id='chart_div' style='width: 700px; height: 240px;'></div>
> > </body>
> > </html>
> > Formatted code:
> >
> > <html>  <head>
> >   <script type='text/javascript' src='http://www.google.com/jsapi
> '></script
> >
> >   <script type='text/javascript'>
> >   google.load('visualization', '1', {'packages':['annotatedtimeline']});
> >   google.setOnLoadCallback(drawChart);
> > function drawChart() {
> >     var data = new google.visualization.DataTable(
> >       {
> >         cols: [{label: 'Date', type: 'date'},
> >                {label: 'Sold Pencils', type: 'number'},
> >                {label: 'title1', type: 'string'},
> >                {label: 'text1', type: 'string'},
> >                {label: 'Sold Pens', type: 'number'},
> >                {label: 'title2', type: 'string'},
> >                {label: 'text2', type: 'string'}],
> >         rows: [
> >           {c:[{v: new Date(2008, 1 ,1)}, {v: 30000}, , , {v: 40645}]},
> >           {c:[{v: new Date(2008, 1 ,2)}, {v: 14045}, , , {v: 20374}]},
> >
> >           {c:[{v: new Date(2008, 1, 3)}, {v: 55022}, , , {v: 50766}]},
> >
> >           {c:[{v: new Date(2008, 1, 4)}, {v: 75284}, , , {v: 14334},
> >               {v: 'Out of Stock'}, {v: 'Ran out of stock on pens at
> 4pm'}]},
> >           {c:[{v: new Date(2008, 1, 5)}, {v: 41476}, {v: 'Bought Pens'},
> {v
> > : 'Bought 200k pens'}, {v: 66467}]},
> >           {c:[{v: new Date(2008, 1, 6)}, {v: 33322}, , , {v: 39463}]}]
> >       },   0.5);
> >     var chart = new google.visualization.AnnotatedTimeLine(document.
> > getElementById('chart_div'));
> >     chart.draw(data, {displayAnnotations: true});
> >
> >   }
> > </script>
> >   </head>
> >   <body>
> >   <div id='chart_div' style='width: 700px; height: 240px;'></div>
> >   </body>
> >   </html>
> >
> > Regards,
> >    VizBoy.
> >
> > On Thu, Jan 29, 2009 at 4:21 PM, jago <[email protected]> wrote:
> >
> > > Can somebody post the following Javascript example in JSon?
> >
> > >http://code.google.com/apis/visualization/documentation/gallery/annot.
> ..
> >
> > > I try to rewrite this thing in JSon but fail. No clue where the
> > > problem is.
> >
> > > Cheers,
> > > jago
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Visualization 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-visualization-api?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to