将CSV文件调整为HighStock

时间:2015-09-08 16:49:01

标签: javascript highcharts highstock

我想制作一个简单的 Highstock图(类似于this)。我想我从文档中了解了这个例子。

就我而言,它不是JSON文件,而是来自Yahoo Finance API的 CSV 。 示例:

Date,Open,High,Low,Close,Volume,Adj Close
2010-01-25,39.965,41.57,39.115,41.225,5301000,33.403
2010-01-18,41.75,42.93,40.13,40.465,4340200,32.787
2010-01-11,44.285,44.435,41.375,41.565,4399300,33.678
2010-01-04,43.46,44.85,43.35,44.02,2939200,35.667

(来自Yahoo

1 个答案:

答案 0 :(得分:0)

当您加载CSV(按class A { val a: String = b //a will be null, since b is not yet evaled val b = "A" } )时,您需要解析数据。

解析器示例:

class TestClass(arg: String) extends {
  override val foo = "hey"
} with Parent(arg) with TestTrait

trait TestTrait extends Parent {
  val bar = foo
}

abstract class Parent(arg: String) {
  val foo = arg
}

scala> new TestClass("hello").bar
res0: String = hey