简体   繁体   English

HighChart图表切换到StockChart时显示不正确的数据

[英]HighChart Chart displaying incorrect data when switched to StockChart

I'm using Highcharts to render a HighStock chart. 我正在使用Highcharts渲染HighStock图表。 For some reason when I switch it to a HighStock chart it changes the labels to random data. 由于某些原因,当我将其切换到HighStock图表时,它将标签更改为随机数据。

When you change the 当您更改

Chart_650422 = new Highcharts.Chart({

在此处输入图片说明

into 进入

Chart_650422 = new Highcharts.StockChart({

在此处输入图片说明

The xAxis labels are changed to random data. xAxis标签更改为随机数据。

Here is the demo: http://jsfiddle.net/14we85px/ 这是演示: http : //jsfiddle.net/14we85px/

In short: Highstock doesn't support categorized xAxis, see API - options type or categories are not listed. 简而言之:Highstock不支持分类的xAxis,请参阅API-未列出选项typecategories

However, you don't have to switch to Highstock - if you have highstock.js file included, then you can create Highcharts chart with enabled features from Highstock, see demo: http://jsfiddle.net/14we85px/3/ ( changes: removed scroolbar (?) and added scrollbar.enabled = true ). 不过,你不必切换到Highstock -如果你有包括highstock.js文件,那么你就可以创建Highcharts图表从Highstock启用的功能,请参阅演示: http://jsfiddle.net/14we85px/3/变化:删除了scroolbar (?),并添加了scrollbar.enabled = true )。

xAxis categories are not shown because you used max:2 in xAxis , it will show only 0th,1st 2nd category. 由于您在xAxis中使用了max:2,因此未显示xAxis类别,它将仅显示0th,1st 2nd类别。 when you will comment "max"2 it will show missing category. 当您评论“最大” 2时,它将显示缺少的类别。

        "min": 0,
        "max": 2,

Your fiddle updated here 您的小提琴在这里更新

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM