Highcharts x-axis tick starts with an offset

后端 未结 4 1886
挽巷
挽巷 2020-12-06 14:47

I am trying to remove the offset on the tick of the x-axis.

I want the first tick 10/8 to start from the x-axis a

4条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-06 15:29

    Updated Fiddle:

    $(function () {
        $('#container').highcharts({
            xAxis: {
                categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
                tickInterval: 1,
                tickmarkPlacement: "on",
                startOnTick: true,
                endOnTick: true,
                minPadding: 0,
                maxPadding: 0,
                offset: 0
            },
            plotOptions: {
              series: {
                findNearestPointBy: 'x',
                label: {
                  connectorAllowed: false
                },
                pointPlacement: 'on'
              }
            },
            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]
            }]
        });
    });
    
    
    
    

    You Just Need to Add the following before series object:

    plotOptions: {
              series: {
                findNearestPointBy: 'x',
                label: {
                  connectorAllowed: false
                },
                pointPlacement: 'on'
              }
            },
    

提交回复
热议问题