javascript - Convert Graphite JSON output array to Rickshaw Graph compatible format -


I am using Graphite Render API to return data to node. JS, which I have I want to do socket for the rickshaw for graphs. I am using grockets.js to send data to the customer through IO. I have tested the rickshaw with the socket after passing manual data using one of my instances. The issue with me is that Jasonson's format is not a graphite return, which is hoping for a rickshaw and I'm not sure how to go about changing it.

Graphite output looks like this:

  [{"target": "localhost_localdomain.cpu-0.cpu-idle", "datapoint": [[99.999698, / Code>  

I need to be in this format:

 [99]  [{"target": "localhost_localdomain.cpu-0.cpu-idle", "Datapoint": [{"x": 99.999698, "y": 1392728820}, {"x": 100.000898, "y": 1392728880}, {"x": 99.999968, "y": 1392728940}, { "X": 99.299848, "y": 13 92732360}]}]  

Am I right, is this an array of objects?

Thank you!

Given that any help or guidance will be really appreciated! Just need to change dpaps, it should be quite easy:

  var myData = [{"" target: "localhost_localdomain cpu-0.cpu-idle", "datapoint": [ 99.999698, 1392728820], [100, 000898, 1392728880], [99.9 99 9 68, 137272404], [99.2 99848, 1392732360]]}]; Var Converted Points = MyData [0] .datapoints.map (function) (return {x: pt [0], y: pt [1]};}); MyData [0] .datapoints = changed digits; Console.log (MyData);  

this is a


Comments