You do not need to install any special javascript to use the JSON methods - they are part of the standard javascript library.
On Saturday, March 29, 2014 8:14:19 AM UTC-4, Abhik Bhowmik wrote: > > Hello, > Thanks for replying. I never work with JSON. But i could not > install json.js. so how can i do this. > > *Thanks & Regards*, > *Abhik Bhowmik* > *Mobile: +918794415116* > > > On Fri, Mar 28, 2014 at 8:06 PM, asgallant > <[email protected]<javascript:> > > wrote: > >> This line: >> >> a = v1.split("*"); >> >> splits the string into an array of strings, not an array of arrays. If >> you replace the "*"s with commas, you can use javascript's JSON parser to >> build your data array: >> >> v1 = v1.replace(/\*/g, ','); >> a = JSON.parse(v1); >> >> You can then add the data via the #addRows method: >> >> data.addRows(a); >> >> >> On Friday, March 28, 2014 8:16:42 AM UTC-4, Abhik Bhowmik wrote: >>> >>> Hi, >>> I faced same error for this code.. >>> "Message: If argument is given to addRow, it must be an array, or null" >>> kindly help me to solve. after button click rows created automatically >>> in table. just need this. >>> ------------------------------------------- >>> var v1=document.getElementById('txt1').value; >>> a= new Array(); >>> a = v1.split("*"); >>> alert(a[0]); >>> var numRows = a.length; >>> alert(numRows); >>> >>> for (var i = 0; i < 1; i++) >>> data.addRow(a[i]); >>> >>> <body> >>> <input type="text" id="txt1" value="['Mike', {v: 10000, f: '$10,000'}, >>> '28/05/2013']*['Jim', {v:8000, f: '$8,000'}, '27/03/2006'] "> >>> <input type="button" text="click me" onclick="drawTable()" > >>> <div id='table_div'></div> >>> </body> >>> --------------------------------------------------- >>> >>> On Friday, 12 February 2010 19:17:34 UTC+5:30, Nils wrote: >>>> >>>> I'm getting the error message "Argument given to addRows must be >>>> either a number or an array" in IE8 and I get reports of the same >>>> error message in other versions as well. I could not find anything >>>> about this problem. I'm sending both the function I use to draw with >>>> and the data. >>>> >>>> My code looks like this: >>>> var data = new google.visualization.DataTable(); >>>> data.addColumn('string', 'Distance'); >>>> data.addColumn('number', 'Elevation'); >>>> >>>> data.addRows(callback.data); >>>> var chart = new >>>> google.visualization.AreaChart(document.getElementById('contourLine')); >>>> chart.draw(data, { >>>> width: '100%', //684 >>>> height: 250, >>>> pointSize: 0, >>>> min: 0, >>>> axisFontSize: 12, >>>> legend: 'none', >>>> colors: ['#177245'], >>>> title: 'Höjdkurva', >>>> titleX: 'distans (km)', >>>> titleY: 'hojd (m)' >>>> }); >>>> >>>> And callback is an javascript object created from a JSON request from >>>> my server, and callback.data is an array, see bellow. >>>> {"code":1,"data":[["53",26],["65",25],["87",26],["124",24],["182",23], >>>> ["203",23],["233",23],["291",25],["364",24],["369",24],["383",24], >>>> ["404",26],["447",24],["477",24],["543",25],["561",24],["581",25], >>>> ["614",27],["722",25],["733",25],["775",22],["822",24],["879",26], >>>> ["890",24],["909",23],["930",23],["994",23],["1046",23],["1077",23], >>>> ["5113",32],["5122",33],["5127",35],["5128",36],["5175",36],["5273", >>>> 34],["5309",34],["5333",32],["5357",31],["5398",30]]} >>>> >>>> -- >> 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/y4yvI6wTheQ/unsubscribe >> . >> To unsubscribe from this group and all its topics, send an email to >> [email protected] <javascript:>. >> To post to this group, send email to >> [email protected]<javascript:> >> . >> 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.
