角度2 Highcharts股票图表差异 [英] angular 2 Highcharts Stock Chart differences

查看:98
本文介绍了角度2 Highcharts股票图表差异的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在实施HighCharts以显示股票数据,但是我的图表没有像他们在



注意区别...
$ b


  1. 无法在图形上更改时间
  2. 日期不是管道
  3. li>
  4. 底部没有拖动条

在比较我的代码后,唯一的区别是我可以看到在html中。
在运动员有这条线



< chart type =StockChart[options] =options><<< ; / chart>



没有 type =StockChart上面的图像输出,当我添加该行时,我得到一个错误。 StockChart不是一种可接受的类型选项。



以下是我的所有代码:

  loadChart(){
this.jsonp.request('https://www.highcharts.com/samples/data/jsonp.php?filename='+ this.values +'-c.json& callback = {
this.options = {
title:{text:this.values +'Stock Price'},
series:[{$ b ='JSONP_CALLBACK')。subscribe(res => $ b name:this.values,
data:res.json(),
tooltip:{
valueDecimals:2
}
}]
} ;
});

$ / code>

值得注意的是:我使用的是角度cli,是的,我运行了npm install命令为高图,并将其添加到我的app.module。感谢您的任何帮助!!

解决方案

我遇到同样的问题,结果我不得不排序我的日期'Asencdingly' p>

I am implementing HighCharts to display stock data, However I am not getting as many options on my chart as they do on their

Notice the differences...

  1. No option for changing time on graph
  2. Date isn't piped
  3. No drag bar on bottom

after comparing my code, the only difference that I can see is in the html. In the plunker there is this line

<chart type="StockChart" [options]="options"></chart>

Without the type="StockChart" my code works with the above image output, when I add in that line I get an error. StockChart isnt an acceptable option for type.

Here is all my code

loadChart(){
    this.jsonp.request('https://www.highcharts.com/samples/data/jsonp.php?filename=' + this.values + '-c.json&callback=JSONP_CALLBACK').subscribe(res => {
            this.options = {
                title : { text : this.values + ' Stock Price' },
                series : [{
                    name : this.values,
                    data : res.json(),
                    tooltip: {
                        valueDecimals: 2
                    }
                }]
            };
        });
    }

Worth noting: I am using angular cli, and yes I ran the npm install command for highcharts, as well as added it to my app.module. Thanks for any help!!

解决方案

I had the same problems, Turns out I had to sort my date 'Asencdingly'

这篇关于角度2 Highcharts股票图表差异的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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