Arshad,

You ignored a piece of my sample code that I sent you in my previous email
that parsed the date string. In the Visualization api we don't read dates by
strings, but rather we construct javascript Date objects by using new
Date(year, month, day).
In the code sample I sent you in the previous message, there is some code
that does that. You can read it again and use it.

Furthermore, I'm very sorry, but I can't write your code for you. Even if
this is urgent... Please try to use the examples, play around with them, and
use debugging tools like Firefox's FireBug.

Regards,
    VizBoy.

On Fri, Feb 20, 2009 at 8:43 AM, Arshad <[email protected]> wrote:

>
> Hi,
>
> Thanks dear for your reply, Dear I am using to this scenario, my JSON
> format is different from your’s. Please check the below example & let
> me know that how can I handle it. This is not working, please this is
> urgent.
>
> /
>
> ************************************************************************************************/
> $(document).ready(function()
> {
>                loadTimeLineAPI();
> });
>
> function loadTimeLine() {
>        drawChart();
> }
>
> function loadTimeLineAPI() {
>        var a = google.load("visualization", "1", {"callback": loadTimeLine,
> packages:["annotatedtimeline"]});
> }
>
> function drawChart() {
> var myJsonObject = getData();
> var rows = [];
> if(myJsonObject.length>0)
> {
>        $.each(myJsonObject[0].quotes, function(a,b) {
>                  var dateString = b.datetime;
>                  var volume = b.volume;
>                  var price = b.price;
>                  var cellsArray =
>                                [
>                                        {v: dateString},{v: volume}, {v:
> price}
>                                 ];
>                  var row = {c: cellsArray};
>                  rows.push(row);
>         });
> }
>
> var chart = new google.visualization.AnnotatedTimeLine
> (document.getElementById('div1'));
> chart.draw(row, {displayAnnotations: true});
> }
>
> function getData()
> {
>        var data = [{
>                "quotes":[
>
>  {"datetime":"03/26/2006","volume":531,"marketcap":8.73E11,"price":
> 128.56},
>
>  {"datetime":"08/26/2006","volume":131,"marketcap":8.301E11,"price":
> 227.27},
>
>  {"datetime":"09/16/2006","volume":231,"marketcap":8.637E11,"price":
> 325.99},
>
>  {"datetime":"08/04/2006","volume":331,"marketcap":8.384E11,"price":
> 425.28},
>
>  {"datetime":"07/11/2006","volume":531,"marketcap":8.065E11,"price":
> 425.25}]
>        }];
>        var p = eval(data);
>        return p;
> }
> /
>
> ************************************************************************************************/
>
> Thanks
> - arsh
>
> On Feb 19, 11:40 pm, VizBoy <[email protected]> wrote:
> > Hi,
> >
> > You need to format your data in a way that fits the Visualization API. It
> > does not matter that it's huge with hundreds of rows. It will still work
> > just fine if you format it correctly. In your case, instead of what you
> > wrote, it should be in the format you used below:
> >
> >   var data = new google.visualization.DataTable({
> >                cols: [
> >                        {label: 'Date', type: 'date'},
> >                        {label: 'Volume', type: 'number'},
> >                        {label: 'Price', type: 'number'}],
> >                rows: [
> >                        {c:[{v: new Date(2008, 3 ,26)}, {v:
> > 4.482362E7}, {v:28.56}]},
> >                        {c:[{v: new Date(2008, 8, 26)}, {v:
> > 4.477303E7}, {v:27.27}]},
> >                        {c:[{v: new Date(2008, 9, 16)}, {v:
> > 1.116584E8}, {v:25.99}]},
> >                        {c:[{v: new Date(2008, 8, 4)},  {v:
> > 6.040522E7}, {v:25.28}]},
> >                        {c:[{v: new Date(2008, 7, 11)}, {v:
> > 6.810552E7}, {v:25.25}]}
> >                      ]
> >     });
> >
> > Only with many more rows....
> > If you're asking how to do it automatically, you could do something like:
> > var rows = [];
> > var quotes = myJsonObject.quotes;
> > for (var i = 0; i < quotes.length; i++) {
> >   var quote = quotes[i];
> >   var dateString = quote.date;
> >   var dateElements = dateString.split('/');
> >   var cellsArray = [{v: new Date(dateElements[2], dateElements[0],
> > dateElements[1])},
> >       {v: quote.volume}, {v: quote.price}];
> >   var row = {c: cellsArray};
> >   rows.push(row);
> >
> > }
> >
> > This code might need some fixing, because I wrote it without testing, but
> > this is the general idea. Somehow transform the data that you have into
> the
> > correct form of rows for our API.
> >
> > Regards,
> >     VizBoy.
> >
> > On Thu, Feb 19, 2009 at 7:26 AM, Arshad <[email protected]>
> wrote:
> >
> > > My question is that I dont know that how many rows in JSON.. Please
> > > check the JSON below:
> > > Now my question is that how can I use to this huge JSON data using a
> > > variable, please let me know that how can I use it.
> >
> > > JSON:
> > > ----------------------------
> > > {"quotes":[{"volume":4.482362E7,"marketcap":2.658073488E11,"price":
> > > 28.56,"date":"03/26/2008"},{"volume":4.477303E7,"marketcap":
> > > 2.4898309011E11,"price":27.27,"date":"08/26/2008"},{"volume":
> > > 1.116584E8,"marketcap":2.3729631507E11,"price":
> > > 25.99,"date":"09/16/2008"},{"volume":6.040522E7,"marketcap":
> > > 2.3081380704E11,"price":25.28,"date":"08/04/2008"},{"volume":
> > > 6.810552E7,"marketcap":2.3516064825E11,"price":
> > > 25.25,"date":"07/11/2008"},{"volume":4.949439E7,"marketcap":
> > > 2.713915368E11,"price":29.16,"date":"04/02/2008"},{"volume":
> > > 5.196673E7,"marketcap":2.4003073E11,"price":26.23,"date":"07/30/2008"},
> > > {"volume":8.453531E7,"marketcap":2.663657676E11,"price":
> > > 28.62,"date":"03/13/2008"},{"volume":1.029828E8,"marketcap":
> > > 1.6270003017E11,"price":18.29,"date":"11/19/2008"},{"volume":
> > > 1.173847E8,"marketcap":2.53148925302E11,"price":
> > > 27.1999,"date":"02/29/2008"},{"volume":9.736064E7,"marketcap":
> > > 1.7888997303E11,"price":20.11,"date":"12/16/2008"},{"volume":
> > > 9.992337E7,"marketcap":2.5024818291E11,"price":
> > > 26.87,"date":"07/01/2008"},{"volume":7.846461E7,"marketcap":
> > > 2.5602242457E11,"price":27.49,"date":"06/06/2008"},{"volume":
> > > 5.335511E7,"marketcap":2.835907031793E11,"price":
> > > 30.4501,"date":"05/15/2008"},{"volume":9.810299E7,"marketcap":
> > > 2.92704521E11,"price":31.45,"date":"04/23/2008"},{"volume":
> > > 1.072016E8,"marketcap":2.4169073451E11,"price":
> > > 26.69,"date":"09/30/2008"},{"volume":7.60048E7,"marketcap":
> > > 2.635661919E11,"price":28.3,"date":"06/05/2008"},{"volume":
> > > 7.161478E7,"marketcap":2.738108142E11,"price":
> > > 29.4,"date":"05/01/2008"},{"volume":3.137194E7,"marketcap":
> > > 1.7986848606E11,"price":20.22,"date":"11/28/2008"},{"volume":
> > > 1.463643E8,"marketcap":2.2557198189E11,"price":
> > > 24.91,"date":"10/06/2008"},{"volume":5.779424E7,"marketcap":
> > > 2.5620869043E11,"price":27.51,"date":"06/30/2008"},{"volume":
> > > 6.958495E7,"marketcap":2.7260008611E11,"price":
> > > 29.27,"date":"05/08/2008"},{"volume":4.786377E7,"marketcap":
> > > 2.714846066E11,"price":29.17,"date":"03/24/2008"},{"volume":
> > > 4.964211E7,"marketcap":2.5482647763E11,"price":
> > > 27.91,"date":"08/14/2008"},{"volume":7.089988E7,"marketcap":
> > > 2.7734986554E11,"price":29.78,"date":"05/13/2008"},{"volume":
> > > 9.352937E7,"marketcap":2.766048021E11,"price":
> > > 29.7,"date":"05/06/2008"},{"volume":5.979924E7,"marketcap":
> > > 2.3536372E11,"price":25.72,"date":"07/31/2008"},{"volume":
> > > 8.094768E7,"marketcap":1.7675503551E11,"price":
> > > 19.87,"date":"12/03/2008"},{"volume":7.561489E7,"marketcap":
> > > 2.6785030668E11,"price":28.76,"date":"05/20/2008"},{"volume":
> > > 5.673429E7,"marketcap":2.3702330685E11,"price":
> > > 25.45,"date":"07/10/2008"},{"volume":5.203139E7,"marketcap":
> > > 2.6244859674E11,"price":28.18,"date":"05/28/2008"},{"volume":
> > > 5.219324E7,"marketcap":2.6514945171E11,"price":
> > > 28.47,"date":"05/22/2008"},{"volume":6.571854E7,"marketcap":
> > > 2.74554979302E11,"price":29.4999,"date":"04/01/2008"},{"volume":
> > > 6.825204E7,"marketcap":2.621776266E11,"price":
> > > 28.17,"date":"02/19/2008"},{"volume":5.71451E7,"marketcap":
> > > 2.6049280521E11,"price":27.97,"date":"06/23/2008"},{"volume":
> > > 1.089315E8,"marketcap":1.7453114226E11,"price":
> > > 19.62,"date":"11/18/2008"},{"volume":8.153331E7,"marketcap":
> > > 2.7930565707E11,"price":29.99,"date":"05/16/2008"},{"volume":
> > > 9.001423E7,"marketcap":1.805801319E11,"price":
> > > 20.3,"date":"11/12/2008"},{"volume":4.379627E7,"marketcap":
> > > 2.713915368E11,"price":29.16,"date":"04/04/2008"},{"volume":
> > > 5.712692E7,"marketcap":2.456048817E11,"price":
> > > 26.9,"date":"09/03/2008"},{"volume":9.727489E7,"marketcap":
> > > 1.7186247036E11,"price":19.32,"date":"11/17/2008"},{"volume":
> > > 8.332239E7,"marketcap":2.738113516E11,"price":
> > > 29.42,"date":"03/18/2008"},{"volume":3.804101E7,"marketcap":
> > > 2.5281781317E11,"price":27.69,"date":"08/18/2008"},{"volume":
> > > 6.192222E7,"marketcap":2.0121786126E11,"price":
> > > 22.62,"date":"11/03/2008"},{"volume":5.961479E7,"marketcap":
> > > 2.7436961178E11,"price":29.46,"date":"05/19/2008"},{"volume":
> > > 8.090675E7,"marketcap":2.3280144E11,"price":25.44,"date":"07/24/2008"},
> > > {"volume":8.877035E7,"marketcap":2.7204128853E11,"price":
> > > 29.21,"date":"05/07/2008"},{"volume":7.753418E7,"marketcap":
> > > 2.593855326E11,"price":27.87,"date":"03/07/2008"},{"volume":
> > > 1.541066E8,"marketcap":2.0211829128E11,"price":
> > > 22.32,"date":"10/23/2008"},{"volume":4.967654E7,"marketcap":
> > > 2.6505631878E11,"price":28.46,"date":"06/18/2008"},{"volume":
> > > 2.284018E8,"marketcap":1.946927985E11,"price":
> > > 21.5,"date":"10/10/2008"},{"volume":7.289955E7,"marketcap":
> > > 2.4962221062E11,"price":27.34,"date":"09/11/2008"},{"volume":
> > > 6.633051E7,"marketcap":2.3893261E11,"price":26.11,"date":"07/29/2008"},
> > > {"volume":5.969326E7,"marketcap":2.333505E11,"price":
> > > 25.5,"date":"07/28/2008"},{"volume":1.142839E8,"marketcap":
> > > 2.3834020728E11,"price":26.32,"date":"10/03/2008"},{"volume":
> > > 1.25272E8,"marketcap":1.8404940537E11,"price":
> > > 20.69,"date":"11/24/2008"},{"volume":7.967584E7,"marketcap":
> > > 1.8227029077E11,"price":20.49,"date":"11/26/2008"},{"volume":
> > > 7.124791E7,"marketcap":1.912548195E11,"price":
> > > 21.5,"date":"11/07/2008"},{"volume":4.668658E7,"marketcap":
> > > 2.641320924E11,"price":28.38,"date":"03/31/2008"},{"volume":
> > > 8.222243E7,"marketcap":2.3419201545E11,"price":
> > > 25.65,"date":"09/05/2008"},{"volume":1.051446E8,"marketcap":
> > > 2.319094422E11,"price":25.4,"date":"09/22/2008"},{"volume":
> > > 9.347177E7,"marketcap":2.2385144088E11,"price":
> > > 24.72,"date":"10/20/2008"},{"volume":8.465133E7,"marketcap":
> > > 2.4102802284E11,"price":25.88,"date":"07/02/2008"},{"volume":
> > > 8.310259E7,"marketcap":2.63387534E11,"price":28.3,"date":"03/17/2008"},
> > > {"volume":7.69826E7,"marketcap":2.589095454E11,"price":
> > > 27.8,"date":"06/02/2008"},{"volume":1.050604E8,"marketcap":
> > > 2.602231608E11,"price":27.96,"date":"03/14/2008"},{"volume":
> > > 3.890465E7,"marketcap":2.6990242E11,"price":29,"date":"04/03/2008"},
> > > {"volume":5.810064E7,"marketcap":2.5257650616E11,"price":
> > > 27.12,"date":"06/11/2008"},{"volume":5.072336E7,"marketcap":
> > > 2.4916569597E11,"price":27.29,"date":"08/29/2008"},{"volume":
> > > 6.302237E7,"marketcap":2.6375245776E11,"price":
> > > 28.32,"date":"05/30/2008"},{"volume":1.49981E8,"marketcap":
> > > 1.9496446287E11,"price":21.53,"date":"10/22/2008"},{"volume":
> > > 9.108476E7,"marketcap":2.565934386E11,"price":
> > > 27.57,"date":"03/06/2008"},{"volume":9.379936E7,"marketcap":
> > > 2.3770632375E11,"price":26.25,"date":"10/02/2008"},{"volume":
> > > 9.209246E7,"marketcap":2.3227465392E11,"price":
> > > 25.44,"date":"09/23/2008"},{"volume":6.012199E7,"marketcap":
> > > 2.715776764E11,"price":29.18,"date":"03/20/2008"},{"volume":
> > > 7.747199E7,"marketcap":2.3463164E11,"price":25.64,"date":"07/21/2008"},
> > > {"volume":8.89146E7,"marketcap":2.3978908392E11,"price":
> > > 26.48,"date":"10/01/2008"},{"volume":4.872364E7,"marketcap":
> > > 2.719499556E11,"price":29.22,"date":"04/17/2008"},{"volume":
> > > 8.253617E7,"marketcap":2.5007872527E11,"price":
> > > 27.39,"date":"08/07/2008"},{"volume":4.724656E7,"marketcap":
> > > 2.6487005292E11,"price":28.44,"date":"05/27/2008"},{"volume":
> > > 5.137294E7,"marketcap":2.5254390438E11,"price":
> > > 27.66,"date":"08/25/2008"},{"volume":4.914228E7,"marketcap":
> > > 2.712053972E11,"price":29.14,"date":"03/25/2008"},{"volume":
> > > 7.800206E7,"marketcap":1.885861476E11,"price":
> > > 21.2,"date":"11/11/2008"},{"volume":7.810444E7,"marketcap":
> > > 1.7221829328E11,"price":19.36,"date":"12/12/2008"},{"volume":
> > > 1.082349E8,"marketcap":2.641320924E11,"price":
> > > 28.38,"date":"02/26/2008"},{"volume":4.425166E7,"marketcap":
> > > 2.682228384E11,"price":28.8,"date":"06/17/2008"},{"volume":
> > > 1.072224E8,"marketcap":1.8689598873E11,"price":
> > > 21.01,"date":"12/08/2008"},{"volume":6.702865E7,"marketcap":
> > > 2.5844388075E11,"price":27.75,"date":"06/26/2008"},{"volume":
> > > 4.361413E7,"marketcap":2.4816136374E11,"price":
> >
> > ...
> >
> > read more »
> >
>

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