Cannot Read Propertie 'gettime' of Null Google Charts
Home › Forums › Chart Back up › Uncaught TypeError: Cannot read property 'getTime' of undefined
Viewing 8 posts - ane through 8 (of eight total)
November 30, 2017 at 4:56 pm #17760
I am facing an issue when updating the datapoints of canvass chart, and the error bulletin says "Uncaught TypeError: Cannot read property 'getTime' of undefined". Below is my html (I am making ajax call to update the datapoints)
<html> <head> <script type="text/javascript"> function GetGraph(val) { $("#dialogOpen").dialog({ autoOpen: false, modal: true, title: "Graph" }); $.ajax({ type: 'Mail', url: '/Ranking/ReturnKeywordGraph', contentType: "application/json; charset=utf-8", dataType: 'html', data: '{keywordId: "' + val + '" }' }).success(role (response) { //$('#dialogOpen').html(response); var chart = new CanvasJS.Nautical chart("chartContainer", { title: { }, animationEnabled: true, axisX: { interval: 3 }, axisY: { }, legend: { verticalAlign: "bottom", horizontalAlign: "center" }, data: [{ proper noun: "Graph Overview", showInLegend: true, legendMarkerType: "square", blazon: "expanse", color: "#0990B0", markerSize: 0, dataPoints: [ response ] }] }); chart.render(); $('#dialogOpen').dialog('open'); }).mistake(role (response) { $('#dialogOpen').html(response.responseText); $('#dialogOpen').dialog('open up'); }); } </script> </head> <torso> <div id="dialogOpen" fashion="display: cake; width:100%;"> <div id="chartContainer" style="height: 289px; width: 100%;"> </div> </div> </body> </html>
The output I receive in response is "{x: new Date(2017, 10, 20),y: 10},{x: new Appointment(2017, 10, 17),y: 15}," which when replaced with "response" renders the chart successfully. Merely passing response to datapoints gives the error.
Whatsoever aid ????
December 1, 2017 at 1:27 pm #17818
@mudassir,
dataPoints is an array of objects. But equally per the code shared above, it seems like you are passing a string
("{x: new Date(2017, x, xx),y: ten},{x: new Engagement(2017, ten, 17),y: 15}"
) to dataPoints assortment instead of objects. Therefore, parsing the data and converting it to objects similar {x: new Date(2017, 10, 20),y: 10},{10: new Engagement(2017, ten, 17),y: fifteen}
should piece of work fine in your case. Here is an example you can refer.
If this doesn't adjust your requirements, Can yous please create a JSFiddle, along with your sample data, reproducing the issue?
___
Suyash Singh
Squad CanvasJS
December 2, 2017 at xi:08 am #17837
@Suyash Singh
Thanks mate, I got it working, cheers for the helping response.
January 25, 2019 at v:xv pm #24100
Hi Mudassir
I am facing same problem,tin can u tell me how did it worked
January 28, 2019 at 8:xvi pm #24132
@savnur-imran,
As you are also facing a similar consequence, y'all might too exist passing a cord to dataPoints assortment instead of an object. In example you are fetching the data from a JSON data source, I would advise parsing the received to the format accepted by CanvasJS. Delight refer to the code snippet beneath for an instance:
dataPoints : [ //assortment of dataPoint {x: new Engagement(2019, 00, 28), y: 10}, //dataPoint {10: new Appointment(2019, 00, 29), y: 15} //dataPoint ]
In example you're withal facing the event, kindly create a JSFiddle reproducing the issue then that nosotros can expect into the code and chart-options being used past y'all, empathize the scenario amend and help you out?
____
Shashi Ranjan
Team CanvasJS
May 29, 2019 at 2:35 pm #25332
This error occurs in Chrome Browser when you read a property or phone call a method on an undefined object . Uncaught TypeError: Cannot read property of undefined error is probably easiest to sympathise from the perspective of undefined, since undefined is not considered an object type at all (but its ain undefined type instead), and properties can only belong to objects inside JavaScript. There are a few variations of this error depending on the property you are trying to access. Sometimes instead of undefined it will say nada.
February 27, 2020 at 8:47 am #28482
Hullo sir,
Sir, I accept as well the same output "{'x':new Engagement(2020,02,24),'y':2},". As you lot said then I tried to parse the string later that then this error are come "Uncaught SyntaxError: Unexpected token eastward in JSON at position 6".
I need your help!!
February 27, 2020 at 6:56 pm #28493
@priyanka-kumari,
Can you kindly create a sample project reproducing the result and share it with u.s.a. over Google-Drive or Onedrive along with sample JSON data so that we can await into the lawmaking, run information technology locally to understand the scenario better and aid you resolve?
—
Shashi Ranjan
Team CanvasJS
Viewing viii posts - 1 through 8 (of 8 total)
mcnaughtonsough1988.blogspot.com
Source: https://canvasjs.com/forums/topic/uncaught-typeerror-cannot-read-property-gettime-of-undefined/
0 Response to "Cannot Read Propertie 'gettime' of Null Google Charts"
Post a Comment