如何删除highcharts中的网格线重叠?

时间:2013-07-18 16:30:46

标签: highcharts

有没有办法删除左侧xAxis gridLine左侧yAxis gridLine边缘的像素?

grid lines overlapping

参见示例:http://jsfiddle.net/48LvK/

$(function () {
    var chart;
    $(document).ready(function() {
        chart = new Highcharts.Chart({
            chart: {
                renderTo: 'container',
                type: 'area',
                marginRight: 130,
                marginBottom: 25
            },
            "xAxis": {
                "tickWidth": 0,
                "gridLineWidth": 1,
                "gridLineDashStyle": "ShortDot",
                "gridLineColor": "#c1c2c3",
                "labels": {
                    "enabled": false
                },
            },
            "yAxis": {

            },
            "plotOptions": {
                "area": {
                    "fillColor": "transparent",
                    "marker": {
                        "enabled": false
                    }
                }
            }, 
            series: [{
                data: [7.0, 6.9, 9.5, 14.5, 18.2, 21.5, 25.2, 26.5, 23.3, 18.3, 13.9, 9.6]
            }]
        });
    });
});

1 个答案:

答案 0 :(得分:6)

您需要将startOnTick:true添加到您的xAxis中 http://jsfiddle.net/sppRL/

    "xAxis": {
        "tickWidth": 0,
        "gridLineWidth": 1,
        "gridLineDashStyle": "ShortDot",
        "gridLineColor": "#c1c2c3",
        "labels": {
            "enabled": false
        },
        "startOnTick": true
    },

您所看到的实际上并不是刻度线,它们是第一个xAxis刻度左侧y轴的延伸。

http://api.highcharts.com/highcharts#xAxis