score:1
Accepted answer
Your array should show up as [12283, 12281, 12280, etc.]
in console as well, instead it shows up as [Number, Number, ...]
. Try changing this line:
averageVoltage.push(res[i].average_volatage)
to:
averageVoltage.push(parseInt(res[i].average_volatage))
Additionally, instead of using dates as categories, it could be easier to use the highchart datetime axis. This would let you manipulate how you want the date displayed, have several series with different timestamps in one graph, and many other things. To get this to work, you could do this:
.then(function(res) {
var averageVoltage = []
var inputVoltage = []
for (var i = 0; i < 10; i++) {
if (res[i].average_volatage !== undefined) {
averageVoltage.push({x: new Date(res[i].timestamp).getTime(), y: parseInt(res[i].average_volatage)})
}
}
console.log(averageVoltage)
Highcharts.chart('battery_chart', {
chart: {
type: 'line'
},
title: {
text: id
},
yAxis: {
title: {
text: 'Measurement'
},
},
xAxis: {
type: 'datetime'
},
series: [{
name: 'Average Voltage',
data: averageVoltage
},
]
});
Source: stackoverflow.com
Related Query
- highcharts doesn't read data, works with fake data
- Highcharts - Global configuration with common code and unique data & Headings
- Highcharts series visibility with csv data source
- How to have multiple highcharts with different series data in vuejs without repeating code
- Highcharts cloud issue with data source when duplicating chart
- Highcharts code with same set of code/data works in PHP but does not work in JSfiddle
- Reload chart data via JSON with Highcharts
- Python: Read data from Highcharts after setExtreme
- Resize data points with highcharts
- Highcharts doesn't display series with lots of data points
- Highcharts data series issue with ajax/json and PHP
- Highcharts - Dyanmic graph with no initial data
- Load data into Highcharts with Ajax
- Highcharts custom visuals with Data binding PowerBI
- Updating data in charts, highcharts with angular, highcharts-ng
- Highcharts with JSON data and multiple series
- Highcharts scatter plot with lots of data points running really slow
- Appending Data with Highcharts (real time updating chart)
- highcharts with null data points
- Highcharts Angular with API data
- How to structure Angular with Highcharts and lots of dynamic data
- Add dynamic data to line chart from mysql database with highcharts
- Creating a line graph with highcharts and data in an external csv
- Alternatives to Highcharts for datasets with 10k data points?
- Highcharts v3.0.1 problems with rotating data labels in IE8 and jQuery v1.7.1
- Highcharts load data with ajax to populate the tooltip
- How to populate a Highcharts axis with string formatted data from a PHP array
- Show more data on Gauge chart with Highcharts
- Highcharts not displaying series data for graph with multiple Y-axes
- Formatting JSON Data with ColdFusion for HighCharts
More Query from same tag
- highcharts display all dates for all points on x-axis
- Highchart and yii not drawing a pie
- Highcharts Reflow Heavy Chart Lagging
- Require highcharts-browserify to use specific version of highcharts?
- Highcharts export chart new window/tab
- Highstock: Property 'firePointEvent' of object #<Object> is not a function
- How to do grouping in Array of Objects in angular 8
- Horizontal align of the legend. Highcharts
- How to make z-index for area lines in highcharts?
- Customize Highchart tooltip
- Highchart export filename with special characters
- Highcharts combining a column and spline chart from an html data table
- Hide Plot Line on Drill down Event (Highcharts.js)
- Made dynamic highstock with PHP data
- Highcharts - How can I remove starting and ending padding from area chart
- Highstock with datepicker and a non-default date
- Highcharts styledMode with highcharts.css import causes pie legend hover to apply to all legend items
- Trying to put points on a chart using a SharePoint list and Highcharts
- How to add image in Highcharts.If no data available
- Legend overlapping on drilldown pie chart
- I'm trying to have a hide series button on my highchart but it makes the chart disappear
- javascript highchart photo slide
- highcharts link series such that turn one off turns off the other
- Highcharts does not display years on Xaxis when data with NULL values
- Stacked bars chart not rendering on mobile
- Highcharts polar area label customization
- High chart Displaying wrong month value in xaxis
- Can I make a custom tooltip on a highcharts drilldown?
- Last y-axis label not displaying on highcharts spiderweb
- How to use images/icons as labels in highcharter? R shiny