Page 1 of 1

Is it possible to get data from the Tiggzi database in a format that could be used by rGraph (or any other chartiing api

Posted: Wed Apr 17, 2013 2:24 pm
by pietro117

I have data in a TIggzi database that has three columns. when I get the data from the rest service, it comes through as JSON objects e.g.
{
"id":"516ea545e4b055aafd1f6355",
"Hour":"08:00",
"LY":".05",
"TY":"0.2"
},
{
"id":"516ea545e4b055aafd1f6356",
"Hour":"09:00",
"LY":"1",
"TY":"2"
}
I need to extact one of the JSON elements (e.g. TY) and convert it into an array (e.g. [0.2,2] so i can feed it into the chart api. Is there a way to do this?
Thanks
Peter


Is it possible to get data from the Tiggzi database in a format that could be used by rGraph (or any other chartiing api

Posted: Wed Apr 17, 2013 3:34 pm
by maxkatz

The data is only returned in JSON format. Once you have the data, you can convert it to any format.


Is it possible to get data from the Tiggzi database in a format that could be used by rGraph (or any other chartiing api

Posted: Wed Apr 17, 2013 4:22 pm
by Maryna Brodina

To add to what Max said - you can use the following JS (for example on service Success event):
codevar arrayTY = [];
try {
for(var i = 0, len = data&#46;length; i < len; i++) {
arrayTY&#46;push(data["TY"]);
}
} catch( e ) {
}
localStorage&#46;setItem('TY', JSON&#46;stringify(arrayTY));/code

After successful invoking the service and running the code above in localStorage TY will be an array in json format ["0.2","2"]

To make it JS array use code:
codevar arrayTY = JSON&#46;parse(localStorage&#46;getItem("TY"));/code


Is it possible to get data from the Tiggzi database in a format that could be used by rGraph (or any other chartiing api

Posted: Fri Apr 19, 2013 6:40 am
by pietro117

Many thanks, that worked perfectly.


Is it possible to get data from the Tiggzi database in a format that could be used by rGraph (or any other chartiing api

Posted: Fri Feb 28, 2014 12:14 pm
by laura6372139

Hi:

I followed this tutorial.

https://getsatisfaction.com/apperyio/...

It's perfect.

But I need these values ​​to connect to the database with the chart

Image

The service that I have to create is list_service?

Can I help me?

Thanks


Is it possible to get data from the Tiggzi database in a format that could be used by rGraph (or any other chartiing api

Posted: Fri Feb 28, 2014 3:18 pm
by Maryna Brodina

Hello! You would need to adapt code above https://getsatisfaction.com/apperyio/... to your purposes.


Is it possible to get data from the Tiggzi database in a format that could be used by rGraph (or any other chartiing api

Posted: Fri Feb 28, 2014 5:19 pm
by laura6372139

Hi Maryna!

I adapted my code.
Image

I click invoke service (button)

And then I load this code:

var arraypesos = JSON.parse(localStorage.getItem("pesos"));

$(document).ready(function(){
var plot2 = $.jqplot ('chart', [arraypesos], {
// Give the plot a title.
title: 'Plot With Options',
// You can specify options for all axes on the plot at once with
// the axesDefaults object. Here, we're using a canvas renderer
// to draw the axis label which allows rotated text.
axesDefaults: {
labelRenderer: $.jqplot.CanvasAxisLabelRenderer
},
// An axes object holds options for all axes.
// Allowable axes are xaxis, x2axis, yaxis, y2axis, y3axis, ...
// Up to 9 y axes are supported.
axes: {
// options for each axis are specified in seperate option objects.
xaxis: {
label: "X Axis",
// Turn off "padding". This will allow data point to lie on the
// edges of the grid. Default padding is 1.2 and will keep all
// points inside the bounds of the grid.
pad: 0
},
yaxis: {
label: "Y Axis"
}
}
});
});

But doens't work!

Image


Is it possible to get data from the Tiggzi database in a format that could be used by rGraph (or any other chartiing api

Posted: Fri Feb 28, 2014 6:33 pm
by laura6372139

ok! it's work!

Thanks!