score:2
have you tried parsing your data (string)
into a javascript object before setting it to the series[i].data
?
series : [{
data: json.parse(data)
}]
what you are getting from php through $.get
is basically string
and not a javascript array of array of numbers, which is what you want. it may look like that, but it is as simple as "5"!=5
, but parseint("5")==5
same is the case with json objects, you need to parse the string into such an object before javascript or highcharts can interpret it correctly, highcharts could do it on your behalf, but it is not designed that way.
try his fiddle to get an idea of the data types in picture
var data="[[1362639600000, 8],[1362726000000, 20],[1362985200000, 28],[1363071600000, 51],[1363158000000, 64],[1363244400000, 11],[1363330800000, 4],[1363503600000, 4],[1363590000000, 21],[1363676400000, 10],[1363762800000, 31],[1363849200000, 13],[1363935600000, 17],[1364194800000, 10],[1364454000000, 1],[1365058800000, 30],[1365145200000, 10],[1366009200000, 55],[1366182000000, 18],[1366268400000, 22],[1366354800000, 12]]"
console.log(typeof data); //string
var parseddata=json.parse(data);
console.log(typeof parseddata); //object
console.log(typeof parseddata[0]); //object [1362639600000, 8]
console.log(typeof parseddata[0][0]); //number 1362639600000
when you paste the console value directly in the fiddle, you are actually pasting it as a valid javascript array, try using your console value wrapped by "
quotes "
and see that the exact issue is reproduced!!
an alternate approach could be using the $.getjson()
method instead. jquery does the parsing for you before it calls your callback method
score:-1
your problem is in either the output from the php script or when you receive the data in your javascript (quite obvious).
first, don't do json by hand use json_encode (http://php.net/manual/en/function.json-encode.php). it's easier and it will guarantee that strings will be escaped properly.
secondly, inspect your data
variable with a debugger. you could also post the exact content of the variable to the question.
but basically, as long as it is working in the fiddle and not in your program you have not yet reproduced the error in your code properly in the fiddle.
for instance, you could replace data
in your callback with the data you have in your fiddle to see if the code runs.
Source: stackoverflow.com
Related Query
- Highcharts not rendering data points
- HighCharts - data points not appearing
- HighCharts Not Adding Series Data Points
- My column highcharts is not rendering any data
- Highcharts rendering high amount of data points showing message "A webpage is slowing down your browser. What would you like to do?" in Firefox
- Highcharts not rendering in Angular 2 when I use data from http.get
- Highcharts Drilldown is not show if i have more than 4000 data points
- Highcharts displays series names but missing data points from json source
- Resize data points with highcharts
- Highcharts doesn't display series with lots of data points
- Highcharts not displaying data labels for Pie chart in arabic
- Highcharts not displaying data at some zoom levels
- Highcharts stacked bar chart hide data labels not to overlap
- Converting svg from Highcharts data into data points
- data label is not shown Highcharts
- Highcharts scatter plot with lots of data points running really slow
- highcharts with null data points
- Labels are not rendering for plotLines highcharts
- Not rendering VU-meter Gauge chart using HighCharts in Durandal
- Find number of data points in each series in highcharts
- Highcharts not drawing lines between points
- Highcharts spline chart points not showing unless zoomed in
- Highcharts gauge not rendering text
- Highcharts - Global configuration with common code and unique data & Headings
- Highcharts x axis date full range even if there is not enough data
- Highcharts not displaying series data for graph with multiple Y-axes
- Rails collecting and rendering JSON data in to a Highcharts graph
- Data Not Showing in Highcharts
- Highcharts will not render if element in series data is empty
- Highcharts.js variable pie chart not rendering data correctly along percentage dataLabels
More Query from same tag
- Highstock - why is min/maxPadding on xAxis ignored
- Highcharts - Redraw/Resize chart after destroying legend?
- HighCharts offline-exporting module not working
- Highchart line chart tooltip issues with large dataset
- ColorAxis with HighChart not working as expected with different set of library
- Highstock can use {point.tt}, but Highcharts can not , why?
- change data point value inside load event in HighCharts
- Heat map with time line
- Animate change in piechart start angle with highcharts-ng
- How to use selenium IDE to find/check if a div object has children?
- Highcharts change look of tooltip
- Live data with highcharts
- Have an issue with JavaScript, AJAX code displaying data
- Highcharts: plot a number that was too small to detect?
- Highchart - Remove date form tooltip
- How to change circle to rectangle when mouse hovers on the heat map charts
- Cannot display a legend with special character in highchart from the serie name
- Highcharts with custom scaling in upper regions
- SyntaxError: JSON.parse: expected property name or '}' while using highcharts
- Highcharts: "Print all" button
- Highcharts event handler after finishing redraw
- JSON data not showing in highstock Candlestick chart using PHP & MYSQL
- How to add box shadow for highchart chart?
- HighMaps: Add second data series to tooltip
- Highchart, how to add commas to point data in tooltips
- Highstocks change range selector to dropdown
- Disable the UTC timezone
- Display HTML table inside a DIV using Javascript switch statement
- Highcharts: changing color on hover ranking chart
- High Charts Column Chart - Y axis Label Formatting