标记出现在刻度之间

时间:2013-08-07 00:52:27

标签: highcharts markers

我希望标记出现在刻度之间。我搜索过但在google或highcharts API等上没有找到任何内容。

我的客户希望点数出现在数字之间 - 而不是反对它们。

这是代码,

jQuery('.graph').highcharts({
        chart: {
            type: 'line',
            marginRight: 10,
            marginBottom: 20,
            height: 117,
            plotBorderColor: '#E6DB41',
            plotBorderWidth: 2,
            borderColor: '#0793D1',
            borderRadius: 0,
            borderWidth: 2
        },
        credits: {
            enabled: false
        },
        title: {
            text: ''
        },

        legend: {
            enabled: false,

        },
        xAxis: {
            tickLength: 0,
            categories: ['11', '12','13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23', '24'],
            gridLineColor: '#cccccc',
            gridLineWidth: 1,
            tickmarkPlacement: 'on',

            labels: {
                formatter: function () {
                   return '<span style="fill: #0793D1;font-size:7px;">' + this.value + '</span>';
                }
            }

        },
        yAxis: {
            tickInterval: 50,
            max: 200,
            min: -5,
            startOnTick: false,
            title: {
                enabled: false
            },
            gridLineColor: '#cccccc',
            gridLineWidth: 1,
            labels: {
                formatter: function () {
                   return '<span style="fill: #0793D1;font-size:9px;">' + this.value + '</span>';
                }
            },
            offset:-5
        },
        series: [{
            name: 'Reservierunge',
            data: [<?php echo $hourlyData?>]

        }],
        plotOptions: {
            series: {
                marker: {
                    enabled: true
                }
            }
        },
        tooltip: {
            enabled: false
        },

        exporting: {
            enabled: false
        },
        colors: [
                 '#F80001', 
                 '#0d233a', 
                 '#8bbc21', 
                 '#910000', 
                 '#1aadce', 
                 '#492970',
                 '#f28f43', 
                 '#77a1e5', 
                 '#c42525', 
                 '#a6c96a'
              ]

    });

1 个答案:

答案 0 :(得分:1)

您需要将tickmarkPlacement: 'on'替换为tickmarkPlacement: 'between';

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

编辑: 解决方法: 您可以通过translate()函数移动标签组或移动每个元素。简单示例:http://jsfiddle.net/Z3Yqx/1