- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在使用官方 highstock 图表 demo创建类似的东西,将 2 个图表堆叠在一起。问题是底部图表(成交量)未显示jsfiddle
aapl-ohlc.json的简要说明文件会有帮助。
...
const data = JSON.parse(document.getElementById('ohlc-data').innerHTML);
// split the data set into ohlc and volume
const ohlc = data.map((a) => [a[0], a[1], a[2], a[3], a[4]])
const volume = data.map((a) => [a[0], a[5]])
// set the allowed units for data grouping
const groupingUnits = [
[
'week', // unit name
[1] // allowed multiples
],
[
'month', [1, 2, 3, 4, 6]
]
]
// create the chart
Highcharts.stockChart('container', {
legend: {
enabled: false
},
credits: {
enabled: false
},
exporting: {
enabled: false
},
scrollbar: {
enabled: false
},
rangeSelector: {
selected: 4,
inputEnabled: false
},
title: {
text: ''
},
yAxis: [{
labels: {
align: 'right',
x: -3
},
title: {
text: ''
},
height: '60%',
lineWidth: 2
}, {
labels: {
align: 'right',
x: -3
},
title: {
text: ''
},
top: '65%',
height: '35%',
offset: 0,
lineWidth: 2
}],
tooltip: {
split: true
},
series: [{
type: 'candlestick',
name: 'AAPL',
data: ohlc,
dataGrouping: {
units: groupingUnits
}
}, {
type: 'column',
name: 'Volume',
data: volume,
yAxis: 1,
dataGrouping: {
units: groupingUnits
}
}],
navigator: {
enabled: false
}
});
最佳答案
这一行:
const volume = data.map((a) => [a[0], a[5]])
指向不存在的元素。 a[5]
未定义(每个子数组只有五个元素,没有第六个元素),因此数据中没有 y
值,因此没有要显示的数据系列。
我不知道什么数据元素应该代表体积,但作为引用,只是为了表明它确实有效,这里是一个使用
更新的 fiddleconst volume = data.map((a) => [a[0], a[1]])
编辑:
请注意,在您基于 fiddle 的演示示例中,他们使用的文件是 aapl-ohlcv.json
,而不是 aapl-ohlc.json
,后者事实上,每个子数组中都有第 6 个数据元素。
关于javascript - Highstock basemap 未显示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42205771/
我正在使用高库存图表(时间线图表)并在没有数据的情况下加载 60,000 个数据点分组图表的宽度和高度为 800 和 400。可能吗? 最佳答案 您可以禁用 http://api.highcharts
我有一个 highstock图表。例如,在该图表中,我想为用户可能输入的目标设置一条情节线。 yAxis: { plotLines: [{ value: 100
我有一个问题 我已经能够在 JFiddle 上复制 .链接:http://jsfiddle.net/h5sSR/ $(function() { var chart = new Highcharts.S
如何将 javascript Date 转换为 highstock 数据?这是来自 highstock 示例的数组: [ /* Nov 2008 */ [1227830400000,13.24], /
我想在 HighChart 中显示多年的历史股票数据。多年来的json数据大小为5mb,为什么我想避免一次加载。特别是因为大多数用户只需要最近 6 个月。 我想最初获取前 6 个月。如果用户缩小或及时
我在使用 highstock.js 时遇到问题 没有明显的原因,它似乎在生成图表时将日期偏移了一半。 发生这种情况是因为 3 月 25 日的日期在图表中显示两次,x 轴上的第二个条目的值为 0。没有数
HighStock 中的数据分组允许我们从一组点中得出一个唯一值的近似值。 文档说一些预先构建的近似函数可用: “average”、“open”、“high”、“low”、“close”和“sum”
如何在 Highstock(不是 Highcharts!)中显示日期的周数? 我的 SQL 是这样的 select unix_timestamp(date)*1000 week (....) grou
这个问题是由数小时谷歌搜索 highstocks、zoom、extremes、ranges 以及所有其他可能的单词变体产生的,所有这些都会导致高图表答案的自定义函数出现一些变化。 有没有一种方法可以在
我正在尝试在Highstock中将lazy loading与dynamically updated data结合起来。这个想法是要有一个庞大的历史记录(包括数百万个数据点),并且要实时更新(如果用户滚
当您将 xAxis 定义为“dateTime”类型时,工具提示应将其识别为“point.x”值并将其转换为 DateTime 格式。 xAxis: { title: {
我的工具提示有问题,它不反射(reflect)图表的数据系列。它在图表显示不同内容的地方显示 0 值。 它看起来是这样的: 我创建了JSFIDDLE这表明了问题。 要重现此情况,您需要将范围选择器移动
一直在努力将数据从数组转移到图表中。这是我的代码, $(document).ready(function () { $.ajax({ type: "P
我的 Angular 应用程序出现问题。我必须创建一个包含多个系列的图形,并显示带有 x 和 y 值以及与 x 和 y 不同的点 id 的工具提示。 为了收集数据,我创建了一个点对象数组,如下所示:
我试图在页面的三个选项卡中的每一个上显示不同的图表。第一个选项卡可以完美呈现,但第二个和第三个选项卡则不然。 Example of first chart ok Example of second a
我制作了一个自定义的tickPositioner(在xAxis下),并且我想在放大时动态更改它。我尝试通过以下方式添加setExtremes事件来做到这一点: xAxis: {
我必须使用共享格式的工具提示,如何获取我悬停的点的索引?我已经尝试过其他建议的堆栈溢出解决方案,但没有任何效果。 tooltip: {useHTML: true, shared: true, form
我正在创建一个 Highstock 图表来显示每天收到的电子邮件数量。我有一个每天更新的 JSON 文件,如下所示: [{ "name": "Month", "data": [147199320000
我有一个包含一列复选框的数据表。以及 HighStock 图表。我试图做到这一点,以便当选中数据表中的相应复选框时,它会显示/隐藏图表上相应的系列线以及该线正在使用的轴。 表:
我试图通过单击绘图区域并拖动光标来在简单的 highstock 图表上实现平滑平移。 我注意到,如果我的数据没有时间戳,它会很好地工作: data: [-25.1,-23.8,-19.9,-19.1,
我是一名优秀的程序员,十分优秀!