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 Articles
- Lazy HighCharts and Loading Json Data
- Highcharts Beta 3: Best Practice loading JSON data
- Loading JSON data in Ruby on rails to use HIGHCHARTS
- Loading json data to highcharts with multiple series
- HighCharts Bubble graph JSON as data source
- Highcharts csv data loading and parse into separate array and json
- Parsing JSON Data for Lazy Highcharts
- Bars does not show up when loading JSON encoded data from PHP in Highcharts
- Highcharts data loading from a JSON file error in setting up datetime
- Highcharts displays series names but missing data points from json source
- Reload chart data via JSON with Highcharts
- Highcharts How to Show Loading Animation At Set Data
- How to pass json data to highcharts series?
- Send JSON data to highcharts pie from asp.net MVC controller in C#
- Highcharts with JSON data and multiple series
- Formatting JSON data monthwise for HighCharts using MySQL
- Highcharts - Global configuration with common code and unique data & Headings
- Highcharts C# To JSON - Structuring Series Data
- Formatting JSON Data with ColdFusion for HighCharts
- 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?
- Highcharts bargraph from json data in angularJS
- Parsing JSON data for Highcharts
- How to format my json data for stack column chart in HighCharts
- Loading data from API into a highcharts vue component
- react-highcharts-official lazy loading data
- Formatting JSON from a Pandas data frame for Highcharts within a Django template
- How to make Highcharts fetch data from external JSON file?
- dynamic highcharts with json data
- Highstock: How to combine lazy loading AND dynamic data?
- Display text inside pie chart
- Highcharts Wind rose increase surface bar
- Changing tootip data on pie chart in highcharts
- Highcharts - navigation by 3rd element in series 'hidden' in plot
- Connect points of Highcharts x-range series
- Is it possible to specify a date type to use?
- how to draw dynamic series in Highchart based on data
- Cannot plot scatter and columnrange graph with multiple y-axis
- HighCharts not working on Safari but works fine on Firefox and Chrome
- accentued character Encoding issue with highcharter in Shiny
- Using a JSON Object in HighCharts
- HighChart Tooltip word-break issue
- How to change Time Zone in Angular2-HighCharts?
- Highcharts - Add bar graph to a pie chart
- How to handle HighCharts zooming with large data sets
- Give different color to each stack in stacked bar in Highcharts
- Local Angular library using Highcharts breaks in production mode
- highcharts - is it possible to zoom pie charts
- MVC 5 Highcjarts ajax call