OOPS, I didn't formatted the data correctly for passing to Plot() -
sorry, didn't read carefully. But the premise is the same - create an
array by looping your data, and then pass the array when done.

/Kevin

On Aug 30, 9:04 am, Kevin Dalman <kevin.dal...@gmail.com> wrote:
> Hi Glenn,
>
> Create an array and 'push' each hash of plot data onto it. When the
> loop is complete, pass the now complete array...
>
> $.getJSON('/Graph/HearthRateDataJSON', "", function(data) {
>     var data= [ ];
>     $.each(data, function(entryindex, entry) {
>         data.push( { Name: entry['Name'], Serie: entry['Serie'] } );
>     });
>      Plot( data );
>
> });
>
> /Kevin
>
> On Aug 29, 7:31 am, Depechie <glenn.versweyv...@gmail.com> wrote:
>
>
>
> > Hello guys.
>
> > My question has actually more to do with jqPlot ( graph library for
> > jQuery ), but I'm still asking it here, because it concerns json data
> > manipulation through jquery.
> > I'm not a javascript nor JQuery programmer, I'm just in a learning
> > process.
>
> > So my question.
> > To plot something through jqPlot the syntax should be:
> > plot = $.jqplot('chart', [line1, line2, line3], { ... }
>
> > With line1, line2 and line3 as array variables!
>
> > My current JSON data is:
> > [{"Name":"series1","Serie":[[1,4],[2,25],[3,7],[4,14]]},
> > {"Name":"series2","Serie":[[1,13],[2,5],[3,7],[4,20]]}]
>
> > And in my .js file I've put this:
> >     $.getJSON('/Graph/HearthRateDataJSON', "", function(data) {
> >         $.each(data, function(entryindex, entry) {
> >             Plot(entry['Serie'], entry['Name']);
> >         });
> >     });
>
> > Problem now is that the graph will only plot the 'last' serie, because
> > the graph itself needs all data at once! And not like I did going
> > through each JSON record and plot the line.
>
> > So any thoughts on how to use the $.each to put all data in one
> > variable to get jqPlot to plot all series?
>
> > Thanks
> > Glenn- Hide quoted text -
>
> - Show quoted text -

Reply via email to