I know How to put the array values in google visualisation api. But how to use var with google apis?
On Wed, Oct 1, 2014 at 5:01 AM, Andrew Gallant <[email protected]> wrote: > You can access the values by referencing their associated object > properties: > > var obj = { > timestamp: 1412048041, > status: 200, > > request: { > mbean: "MineStar:name=Statistics,type=Speedometer", > type: "read" > }, > value: { > EPM: 1, > Buffered: 0, > ThreadCount: 142 > } > }; > // access values in the object like this: > obj.value.EPM > > On Tuesday, September 30, 2014 1:07:56 AM UTC-4, Nagendra Singh wrote: >> >> I have a json format data. But I need to parse only "value" data from it >> and show it in google visualisation api. How can I achieve this. >> >> >> >> >> Consider the following JSON data: >> >> { >> timestamp: 1412048041, >> status: 200, >> >> request: { >> mbean: "MineStar:name=Statistics,type=Speedometer", >> type: "read" >> }, >> value: { >> EPM: 1, >> Buffered: 0, >> ThreadCount: 142 >> }} >> >> I have used jolokia jar to convert my jmx beans to json data. >> >> How can I parse only "value" to a UI using google visualisation api? >> >> On Thu, Sep 25, 2014 at 6:33 PM, Nagendra Singh <[email protected]> >> wrote: >> >>> Wow.....thanks andrew... thanks a lot. >>> >>> On Thu, Sep 25, 2014 at 4:45 AM, Andrew Gallant <[email protected]> >>> wrote: >>> >>>> Here's an example using the DOMParser: >>>> >>>> var xml = '<metric-datas><metric-data><metricPath>Application >>>> Infrastructure Performance|MineStar|Individual Nodes|Node 2 >>>> 9383|JMX|Test|CacheSize</metricPath><metricName>Server| >>>> Component:7|JMX|Test|CacheSize</metricName>< >>>> frequency>ONE_MIN</frequency><metricValues><metric-value>< >>>> startTimeInMillis>1411463700000</startTimeInMillis><value>250</ >>>> value><min>250</min><max>250</max><current>250</current>< >>>> sum>1750</sum><count>7</count><standardDeviation>0.0</ >>>> standardDeviation><occurrences>0</occurrences>< >>>> useRange>true</useRange></metric-value></metricValues></ >>>> metric-data></metric-datas>'; >>>> >>>> var parser = new DOMParser(); >>>> var xmlDoc = parser.parseFromString(xml, 'application/xml'); >>>> var metrics = xmlDoc.querySelectorAll('metric-data'); >>>> >>>> // create DataTable >>>> var data = new google.visualization.DataTable(); >>>> data.addColumn('string', 'Metric Path'); >>>> data.addColumn('number', 'Value'); >>>> >>>> for (var i = 0; i < metrics.length; i++) { >>>> var path = metrics[i].querySelector('metricPath').textContent; >>>> var value = new Number(metrics[i].querySelector('value'). >>>> textContent).valueOf(); >>>> data.addRow([path, value]); >>>> } >>>> >>>> On Tuesday, September 23, 2014 11:03:30 PM UTC-4, Nagendra Singh wrote: >>>>> >>>>> Hi Andrew, >>>>> Thanks of the reply. >>>>> I need to put it into google api's chart table. >>>>> How can I handle that? >>>>> >>>>> On Wed, Sep 24, 2014 at 5:50 AM, Andrew Gallant <[email protected]> >>>>> wrote: >>>>> >>>>>> You can use the DOMParser object >>>>>> <https://developer.mozilla.org/en-US/docs/Web/API/DOMParser> to >>>>>> parse an XML document. IE 8 does not have the DOMParser object though, >>>>>> so >>>>>> if you have to support IE 8, follow this guide >>>>>> <http://stackoverflow.com/questions/7949752/cross-browser-javascript-xml-parsing>, >>>>>> or use a 3rd-party library like jQuery >>>>>> <http://api.jquery.com/jquery.parsexml/> to handle this for you. >>>>>> >>>>>> >>>>>> On Tuesday, September 23, 2014 6:04:46 AM UTC-4, Nagendra Singh wrote: >>>>>>> >>>>>>> Hi, >>>>>>> I have xml data in following format. I need to parse only <metricPath> >>>>>>> and <value> and show in a UI format. I am able to parse a json >>>>>>> data. But how can I parse an XML data? >>>>>>> >>>>>>> <metric-datas> >>>>>>> <metric-data> >>>>>>> <metricPath> >>>>>>> Application Infrastructure Performance|MineStar|Individual >>>>>>> Nodes|Node 2 >>>>>>> 9383|JMX|Test|CacheSize >>>>>>> </metricPath> >>>>>>> <metricName>Server|Component:7|JMX|Test|CacheSize</metricName> >>>>>>> <frequency>ONE_MIN</frequency> >>>>>>> <metricValues> >>>>>>> <metric-value> >>>>>>> <startTimeInMillis>1411463700000</startTimeInMillis> >>>>>>> <value>250</value> >>>>>>> <min>250</min> >>>>>>> <max>250</max> >>>>>>> <current>250</current> >>>>>>> <sum>1750</sum> >>>>>>> <count>7</count> >>>>>>> <standardDeviation>0.0</standardDeviation> >>>>>>> <occurrences>0</occurrences> >>>>>>> <useRange>true</useRange> >>>>>>> </metric-value> >>>>>>> </metricValues> >>>>>>> </metric-data></metric-datas> >>>>>>> >>>>>>> -- >>>>>> You received this message because you are subscribed to a topic in >>>>>> the Google Groups "Google Visualization API" group. >>>>>> To unsubscribe from this topic, visit https://groups.google.com/d/to >>>>>> pic/google-visualization-api/-Y_SK-TJabw/unsubscribe. >>>>>> To unsubscribe from this group and all its topics, send an email to >>>>>> [email protected]. >>>>>> To post to this group, send email to [email protected] >>>>>> . >>>>>> Visit this group at http://groups.google.com/group >>>>>> /google-visualization-api. >>>>>> For more options, visit https://groups.google.com/d/optout. >>>>>> >>>>> >>>>> -- >>>> You received this message because you are subscribed to a topic in the >>>> Google Groups "Google Visualization API" group. >>>> To unsubscribe from this topic, visit https://groups.google.com/d/ >>>> topic/google-visualization-api/-Y_SK-TJabw/unsubscribe. >>>> To unsubscribe from this group and all its topics, send an email to >>>> [email protected]. >>>> To post to this group, send email to [email protected]. >>>> Visit this group at http://groups.google.com/ >>>> group/google-visualization-api. >>>> For more options, visit https://groups.google.com/d/optout. >>>> >>> >>> >> -- > You received this message because you are subscribed to a topic in the > Google Groups "Google Visualization API" group. > To unsubscribe from this topic, visit > https://groups.google.com/d/topic/google-visualization-api/-Y_SK-TJabw/unsubscribe > . > To unsubscribe from this group and all its topics, send an email to > [email protected]. > To post to this group, send email to > [email protected]. > Visit this group at > http://groups.google.com/group/google-visualization-api. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "Google Visualization API" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/google-visualization-api. For more options, visit https://groups.google.com/d/optout.
