score:1
Accepted answer
to convert your datetime object to the JS milliseconds convention, just call
DateTime.now.to_i*1000
or in your case
def index
@data = {"status" => "ok", "data" => [{"2014-06-16 16:00:00" => 24.2},{"2014-06-17 12:00:00" => 30.2},{"2014-06-18 17:00:00" => 42.9}]}
d = []
@data['data'].each do |data|
d << [DateTime.parse(data.keys.first).to_i*1000, data.values.first]
end
@chart = LazyHighCharts::HighChart.new('chart') do |f|
f.chart(:height => '400')
f.yAxis [:title => {:text => "Temperature", :margin => 20, style: { color: '#333'}}]
f.xAxis(type: 'datetime')
f.series(:type => 'area', :name => '24hrs', :data => d)
end
end
score:1
Your dates should be timestamps (time in miliseconds like 12323311000) not in the form like this: "2014-06-16 16:00:00" So you need to convert it.
Source: stackoverflow.com
Related Query
- Lazy HighCharts and Loading Json Data
- Highcharts csv data loading and parse into separate array and json
- Highcharts with JSON data and multiple series
- Highcharts Beta 3: Best Practice loading JSON data
- Highcharts - Global configuration with common code and unique data & Headings
- Rails collecting and rendering JSON data in to a Highcharts graph
- Highcharts and Json data
- Highcharts with ajax and json data what am i doing wrong?
- Loading JSON data in Ruby on rails to use HIGHCHARTS
- Highcharts loading data and not plotting
- JSON, Highcharts and Coldfusion json data
- Loading json data to highcharts with multiple series
- Server-side c# and client side javascript with json loading Highcharts gantt chart Task Progress Indicator, need to change Tooltip and Label name
- HighCharts Bubble graph JSON as data source
- Parsing JSON Data for Lazy Highcharts
- Bars does not show up when loading JSON encoded data from PHP in Highcharts
- Highcharts API - loading and no data
- Highcharts JSON formatting - splitting up and preprocessing data for charts?
- Highcharts pie/bar combo. How to load json and how are the data series expressed
- Highcharts data loading from a JSON file error in setting up datetime
- Highcharts displays series names but missing data points from json source
- Highcharts - Get and plot data with MySQLi + JSON (step by step)
- How to format Highcharts columnRange to get json data for temperature Min and Max
- Highcharts and JSON data from PHP
- PHP and MySQL, get JSON data to feed HighCharts
- Server side chart .svg export with Highcharts and PhantomJS, error loading data from .csv file
- Reload chart data via JSON with Highcharts
- Loading Highcharts via shim using RequireJS and maintaining jQuery dependency
- Highcharts How to Show Loading Animation At Set Data
- Highcharts data series issue with ajax/json and PHP
More Query from same tag
- how to reduce/increase gap between horizontal legends- highcharts
- HighCharts Heatmap yAxis title
- Can I create such chart with highcharts
- highcharts yaxis start on 1 min:1 not working
- HighCharts, how to change the coloring on the headline on the y-axis?
- Highcharts: X-axis labels inside columns
- Draw symbols between bars in highcharts
- AngularJs choose charts framework d3.js vs highcharts
- Highcharts Change Bar Color Based on Value
- Highcharts error #13 and AngularJs
- Add tooltip to highcharts javascript
- Is there any way to draw a pie chart using highstock latest version?
- Highcharts: Change scale sizes
- Highstock no rangeSelector appear with async loading
- Highcharts: Restricting nth label on a category axis
- How to access any particular data in highchart tooltip?
- Displaying time series data in a highchart
- Highcharts - Multiple Subtitle (2)
- highchart - display value in xaxis as the value I get from the chart data as is without conversion
- Highcharts - manually trigger hover event on a point
- Handle checkbox input in x-axis label with Highcharts and AngularJS
- How to remove margin gap in area spline chart for highcharts?
- which is best to use Fusionchart or Highcharts?
- Why isn't the xAxis showing the date?
- Repeated values in x axis in dotnet highchart controls
- How to popup a file dialog/print dialog in a html file that is rendered in a WebEngineView?
- Highcharts type flags with custom legend icon
- In Highcharts, for a 3D chart, are we able to set up labels of the z-axis?
- in highchars can we give x axis and y axis plots together
- install highcharts exporting server