在查看图表值时需要帮助

时间:2019-02-18 07:55:20

标签: javascript highcharts

柱形图工作正常。但是在查看图表值时我面临一个问题。如果两个值之间有很大差异,则较低的值未在图表中显示(这表示它在此处显示,但我无法看到),请参考https://jsfiddle.net/g18evj5x/1/

Highcharts.chart('container', {
    chart: {
        type: 'column'
    },
    title: {
        text: 'Monthly Average Rainfall'
    },
    subtitle: {
        text: 'Source: WorldClimate.com'
    },
    xAxis: {
        categories: [
            'Jan'
        ],
        crosshair: true
    },
    yAxis: {
        min: 0,
        title: {
            text: 'Rainfall (mm)'
        }
    },
    tooltip: {
        headerFormat: '<span style="font-size:10px">{point.key}</span><table>',
        pointFormat: '<tr><td style="color:{series.color};padding:0">{series.name}: </td>' +
            '<td style="padding:0"><b>{point.y:.1f} mm</b></td></tr>',
        footerFormat: '</table>',
        shared: true,
        useHTML: true
    },
    plotOptions: {
        column: {
            pointPadding: 0.2,
            borderWidth: 0
        }
    },
    series: [{
        name: 'Tokyo',
        data: [1000]

    }, {
        name: 'New York',
        data: [2]

    }, {
        name: 'London',
        data: [4]

    }, {
        name: 'Berlin',
        data: [6]

    }]
});

谢谢。

2 个答案:

答案 0 :(得分:2)

另一个解决方案可以是像这样使用dataLabels Api link

plotOptions: {
  column: {
    // minPointLength: 2, // You could use both solutions
    dataLabels:{
      enabled:true
    }
  }
}

Fiddle

答案 1 :(得分:0)

一种解决方案是设置plotOptions.column.minPointLengthAPI)。例如(JSFiddle):

plotOptions: {
    column: {
        minPointLength: 2
    }
}

这意味着该点将至少具有该高度,并因此显示在图表中。

相关问题