从具有高库存的CSV读取数据 [英] Reading data from CSV with highstock

查看:79
本文介绍了从具有高库存的CSV读取数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

3天尝试所有将数据加载到Highstock图表中的方法 我的代码有一些问题:

3 days trying all methods of loading data into Highstock chart end I have some problems with my code:


1. Date on Xaxis is displayed "2013-04-23 21:07:40" in line; not sorted day, hour 
  1. Value temperature is rounded to the nearest value example 19.44 - in graph 19
  2. I dont have button "zoom" end window "from" "to"
  3. i dont have range selector I want graph like in this site: http://www.highcharts.com/stock/demo/data-grouping I'm not a good programmer, but I try. I find in this forum similar problem, but solution not working Somebody please help. Best regards
  1. Value temperature is rounded to the nearest value example 19.44 - in graph 19
  2. I dont have button "zoom" end window "from" "to"
  3. i dont have range selector I want graph like in this site: http://www.highcharts.com/stock/demo/data-grouping I'm not a good programmer, but I try. I find in this forum similar problem, but solution not working Somebody please help. Best regards


The data in the CSV is formatted like so:
2013-04-23 21:07:40,19.44
2013-04-23 21:30:50,19.38
2013-04-23 22:00:11,19.69
2013-04-23 22:45:02,19.44
2013-04-23 23:00:03,19.75
2013-04-23 23:45:03,19.19
2013-04-24 00:00:12,19.13
2013-04-24 00:45:03,19

我的HTML代码

推荐答案

valueDecimals:2无法正常工作,因为您正在将值解析为int

valueDecimals: 2 isn't working, because you are parsing your values in a int

d.push(parseInt(items[1]));

您应该使用

d.push(parseFloat(items[1]));

获取日期问题:如前所述,您需要解析日期,例如:

For the date Problem: As already said, you need to parse your date for ex.:

 var dateAndTime = itmes[0].split(' ');    
 var dateParts = dateAndTime[0].split('-');    
 var timeParts = dateAndTime[1].split(':');
 var date = Date.UTC(parseInt(dateParts[2]), parseInt(dateParts[1]) - 1, parseInt(dateParts[0]), parseInt(timeParts[0]), parseInt(timeParts[1]));

这篇关于从具有高库存的CSV读取数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆