Highcharts remove gap between start of xAxis and first value

≯℡__Kan透↙ 提交于 2019-12-17 20:37:38

问题


In this HighCharts example, how do I remove the gap between where the xaxis starts and where the tick for Jan is.

http://jsfiddle.net/gh/get/jquery/1.7.2/highslide-software/highcharts.com/tree/master/samples/highcharts/xaxis/tickmarkplacement-on/

basically I want to put Jan right where the xAxis starts. I couldn't find how to do it in the API.


回答1:


There seems to be a problem with categories and startOnTick. But you can imitate categories and make it work:

var categories = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
$('#container').highcharts({
    chart: {},
    xAxis: {

        labels: {
            enabled: true,
            formatter: function () {
                return categories[this.value];
            }
        },
        tickInterval: 1,
        minPadding: 0,
        maxPadding: 0,
        startOnTick: true,
        endOnTick: true
    },

    series: [{
        data: [29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4]
    }]
});

http://jsfiddle.net/zdMTy/



来源:https://stackoverflow.com/questions/18593883/highcharts-remove-gap-between-start-of-xaxis-and-first-value

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!