Hi,
My question is that I dont know that how many rows in JSON.. And this
JSON have huge data of JSON(alot or rows). Now my question is that how
can I use to this huge JSON's rows data using a
variable, please let me know that how can I use it.
And I am using to this js function, In this example I am using only 5
row but I dont know that how many rows are available in JSON data. So
I want to know that how can I use to dynamic rows of JSON data.
Javascript function for JSON:
-------------------------------------
/
*******************************************************************************************************************/
function drawChart() {
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}]}
]
});
var chart = new google.visualization.AnnotatedTimeLine
(document.getElementById('div1'));
chart.draw(data, {displayAnnotations: true});
}
/
*******************************************************************************************************************/
Thanks
- arsh
On Feb 18,
On Feb 19, 2:25 pm, VizGuy <[email protected]> wrote:
> Your mistake is setting the first column to be of type 'date' and not
> 'datetime'.
> This is described
> athttp://code.google.com/apis/visualization/documentation/gallery/annot...
> ("If the first column is of type date (and not datetime) then the time
> resolution on the X axis will not get below days.")
>
> Regards,
> VizGuy
>
> On Thu, Feb 19, 2009 at 12:23 AM, desvin <[email protected]>wrote:
>
>
>
>
>
> > Thanks for your help.
>
> > I've tried to modify my code using your advice but I can't get it
> > working.
>
> > From what I understand, you added a new column (data.addColumn
> > ('number', 'Hours');) but you do not pass it any data, am I right ?
>
> > Thnaks for your help.
>
> > On 18 fév, 23:01, Diter <[email protected]> wrote:
> > > Try this way:
>
> > > function drawChart() {
> > > var data = new google.visualization.DataTable();
> > > data.addColumn('date', 'Date');
> > > data.addColumn('number', 'Hours');
> > > data.addColumn('number', 'Visits');
>
> > > data.addRow();
> > > data.setValue(0, 0, new Date(2008, 1 ,1, 1, 1, 1));
> > > data.setValue(0, 1, 30000);
> > > data.setValue(1, 0, new Date(2008, 1 ,2, 1, 1, 1));
> > > data.setValue(1, 1, 14045);
> > > var chart = new google.visualization.AnnotatedTimeLine
> > > (document.getElementById('chart_div'));
> > > chart.draw(data, {displayAnnotations: true});
> > > }
>
> > > On Feb 18, 4:42 pm, desvin wrote:
>
> > > > Hello all,
>
> > > > I've struggling all day with Google's Annotated Timeline chart.
> > > > I'm using this chart to display an analysis of an internet site
> > > > visits.
>
> > > > To do so, I've got the data of how many users connected to this site
> > > > every hour for the last fifteen days.
>
> > > > I am able to display these data well but would like to show the hours
> > > > in the x scale.
>
> > > > Have you got an idae on how to do so ?
>
> > > > Thanks a lot for your help.
>
> > > > PS : a sample of the code I use :
> > > > ...
> > > > function drawChart() {
> > > > var data = new google.visualization.DataTable();
> > > > data.addColumn('date', 'Date');
> > > > data.addColumn('number', 'Visits');
> > > > data.addRows(2);
> > > > data.setValue(0, 0, new Date(2008, 1 ,1, 1, 1, 1));
> > > > data.setValue(0, 1, 30000);
> > > > data.setValue(1, 0, new Date(2008, 1 ,2, 1, 1, 1));
> > > > data.setValue(1, 1, 14045);
> > > > var chart = new google.visualization.AnnotatedTimeLine
> > > > (document.getElementById('chart_div'));
> > > > chart.draw(data, {displayAnnotations: true});
> > > > }
>
> > > > ...- Hide quoted text -
>
> - Show quoted text -
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---