如何在Highcharts中将网格线与点对齐

时间:2016-01-26 14:05:58

标签: javascript highcharts

     {
"chart": {
    "type": "spline",
    "panning": true,
    "animation": false,
    "reflow": false,
    "events": {}
},
"plotOptions": {
    "series": {
        "lineWidth": 3,
        "cursor": "pointer",
        "states": {
            "hover": {
                "enabled": false,
                "marker": {
                    "enabled": false
                }
            }
        },
        "point": {
            "events": {}
        }
    }
},
"xAxis": {
    "categories": [] // "00:00" to "23:00",
    "gridLineWidth": 1,
    "gridLineColor": "#efefef",
    "minRange": 5,
    "lineWidth": 3
},
"yAxis": {
    "title": {
        "text": ""
    },
    "gridLineWidth": 1,
    "gridLineColor": "#efefef",
    "style": {
        "display": "none"
    },
    "minRange": 6
}
  }

Lines not aligned to dots

我是否可以将点与背景中的x轴网格线对齐?到目前为止,我附上了Highcharts对象。

由于

1 个答案:

答案 0 :(得分:2)

有一种方法可以使用,例如 jlbriggs 在评论中提出tickmarkPlacement - xAxis'选项。这将移动网格线和刻度线。

示例:http://jsfiddle.net/ztsesk7f/

其他方式可能是设置pointPlacement - 系列'选项。这将移动点。

示例:http://jsfiddle.net/7cc2ohe1/