如何在y轴中将刻度线长度设置为0或从高轴图中的y轴移除刻度线?

时间:2015-04-01 07:26:11

标签: highcharts

对于x轴'tickLength:0'正在工作,我可以从x轴标签中删除刻度线,但同样的事情不适用于y轴。请建议我删除y轴刻度线的正确方法。

$(function () {
Highcharts.setOptions({
    colors: ['#C9F4F4']
});
$('.container').highcharts({        
    chart: {
        type: 'area',          
    },
    credits: {
        enabled: false
    },
    title: {
        text: ''
    },
    xAxis: {
        categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'June', 'Jul','Aug','Sep','Oct','Nov','Dec'],
        tickmarkPlacement: 'on', 
        overflow:'false',
        gridLineWidth: 1,
        //tickLength: 0,
        startOnTick:true,
        title: {
            enabled: false
        }
    },
    yAxis: {             
        min: 100, 
        max: 1000,
        tickInterval: 100,                           
        gridLineWidth: 1,               
        title: {
            enabled: false
        },
        labels: {                                
            formatter: function () {
                return this.value;
            }
        }
    },
    tooltip: {
        shared: true, 
        formatter: function () {
            return this.y;
        }
    },
    plotOptions: {
        series: {                
            lineColor: '#00CFCF',
            lineWidth: 1,
            marker: {
                lineWidth: 1,
                lineColor: '#00CFCF',
                enabled: false,                    
            }
        }
    },
    navigation: {
        buttonOptions: {
            enabled: false
        }
    },
    series: [{
        name: 'Asia',
        data: [502, 635, 809, 947, 900, 1000, 1000,200,750,630,400,75]
    }]
});

});

这是JSFiddle

1 个答案:

答案 0 :(得分:1)

这是预期的效果吗? http://jsfiddle.net/xznu95mv/5/

在xAxis部分,
startOnTick: true,更改为startOnTick: false,
添加min: 0.5

参考:How to remove the gap between yAxis and data?