首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Highstock标志onSeries

Highstock标志onSeries
EN

Stack Overflow用户
提问于 2016-04-29 20:38:44
回答 1查看 363关注 0票数 1

我正在使用高库存,并希望将标志添加到我的图表中。

我在同一个容器中有两个图表,并使用"onSeries“将标志添加到正确的图表上。然而,即使我在我的标志配置中的"onSeries“参数中指定了,这些标志也总是应用于上面的图形。

小提琴手:https://jsfiddle.net/rick822/mtw0oxxy/

代码语言:javascript
复制
$(function () {
    $('#container').highcharts('StockChart', {

        chart: {
          height: 1800
        },
        title : {
            text : 'AAPL Stock Price'
        },
        yAxis: [
            {
              labels: {},
              title: {
                text: 'test1'
              },
              height: 100,
              opposite: false,
              offset: 0
            },
            {
              labels: {},
              title: {
                text: 'test2'
              },
              height: 100,
              top: 300,
              opposite: false,
              offset: 0
            }
        ],
        series : [{
                name : 'AAPL',
                data : [[1241136000000,18.18],[1243555200000,19.40],[1246320000000,20.35]],
                id: 'test1',
                tooltip: {
                    valueDecimals: 2
                }
                ,
                yAxis: 0
            },
            {
                name : 'AAPL',
                data : [[1241136000000,18.18],[1243555200000,19.40],[1246320000000,20.35]],
                id: 'test2',
                tooltip: {
                    valueDecimals: 2
                },
                yAxis: 1
            },
            {
              type: 'flags',
              data: [{x: 1241136000000, title: "TEST1" }],
              onSeries: 'test1',
              shape: 'squarepin',
              width: 16,
              fillColor: 'red'
            },
            {
              type: 'flags',
              data: [{x: 1243555200000, title: "TEST2" }],
              onSeries: 'test2',
              shape: 'squarepin',
              width: 16,
              fillColor: 'lightgreen'
            }
        ]
    });
});
EN

回答 1

Stack Overflow用户

发布于 2016-04-29 23:04:14

由于您有多个y轴,因此您还必须为标志系列指定关联的y轴,至少当它们不在索引0 y轴上时是这样。

例如(JSFiddle):

代码语言:javascript
复制
{
  type: 'flags',
  data: [{x: 1241136000000, title: "TEST1" }],
  onSeries: 'test1',
  shape: 'squarepin',
  width: 16,
  fillColor: 'red',
  yAxis: 0
},
{
  type: 'flags',
  data: [{x: 1243555200000, title: "TEST2" }],
  onSeries: 'test2',
  shape: 'squarepin',
  width: 16,
  fillColor: 'lightgreen',
  yAxis: 1
}
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/36938568

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档