【问题标题】:Highcharts: y-axis labels are missingHighcharts:缺少 y 轴标签
【发布时间】:2014-01-17 01:11:51
【问题描述】:

我已经写了几十个这样的图表,从来没有遇到过这个问题。我的 y 轴标签未显示在此特定图表中:

$(function () {
$('#container').highcharts({
    chart: {
        alignTicks: false,
        animation: {
            animation: false
        },
        height: 180,
        reflow: true,
        width: 425,
        zoomType: 'x'
    },
    credits: {
        enabled: false
    },
    legend: {
        enabled: false,
        layout: 'horizontal'
    },
    plotOptions: {
        line: {
            animation: false,
            marker: {
                radius: 0
            },
            stickyTracking: false,
            turboThreshold: 5000000,
            zIndex: 1
        },
        spline: {
            animation: false,
            marker: {
                radius: 0
            },
            turboThreshold: 5000
        }
    },
    title: {
        text: ''
    },
    tooltip: {
        backgroundColor: '#303030',
        borderColor: 'white',
        borderRadius: 0,
        borderWidth: 1,
        style: {
            font: '20pt [FontFamily: Name=Microsoft Sans Serif]',
            padding: '10px',
            color: 'white'
        },
        valueDecimals: 0,
        valueSuffix: 'F'
    },
    xAxis: {
        categories: ['Wed', 'Thu', 'Fri', 'Sat', 'Sun', 'Mon', 'Tue'],
        lineColor: 'black',
        lineWidth: 2
    },
    yAxis: {
        endOnTick: false,
        gridLineWidth: 0,
        lineWidth: 2,
        maxPadding: 0,
        minPadding: 0,
        startOnTick: false,
        id: 'ForecastData',
        lineColor: 'black',
        linkedTo: 0,
        offset: 0,
        title: {
            text: ''
        },
        type: "linear"
    },
    exporting: {
        buttons: {
            exportButton: {
                enabled: false
            },
            printButton: {
                enabled: false
            }
        },
        enabled: false
    },
    series: [{
        data: [33, 31, 35, 33, 36, 37, 36],
        labelText: 'Daily Min Temperature',
        name: 'Daily Min Temperature',
        type: 'spline',
        color: '#2177E0'
    }]

});

});

http://jsfiddle.net/5QBzv/

我似乎无法弄清楚我错过了什么。有什么想法吗?

谢谢!

【问题讨论】:

  • yAxis.linkedTo 似乎导致了问题,但不知道为什么,似乎是一个错误。
  • 很好地抓住了弗洛里安!谢谢!

标签: javascript highcharts


【解决方案1】:

尝试用这个替换你的 x 和 y 轴

xAxis: {
        categories: ['Wed', 'Thu', 'Fri', 'Sat', 'Sun', 'Mon', 'Tue'],
        lineColor: 'black',
        lineWidth: 2
            },
yAxis: {
         title: {
                  text: 'DATA'
                },
                lineColor: 'black',
                lineWidth: 2
                 categories: ['1', '2', '3', '4', '5', '6', '7'],
            },

或者从你的代码中删除linkedTo。

【讨论】:

    猜你喜欢
    • 2022-01-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-11-11
    • 1970-01-01
    • 2019-08-30
    相关资源
    最近更新 更多