如何隐藏海图实规图的中间值

How to hide intermediate values of solid gauge chart of highcharts?

本文关键字:中间 何隐藏 隐藏      更新时间:2023-09-26

我想删除出现在固体压力表图表上的中间数字。例:我想从图表链接中隐藏100。

实心量规图

这是我的图表代码。

function myfun(data) {
var gaugeOptions = {
chart: {
  renderTo: 'mydiv',
  type: 'solidgauge'
},
title: null,
pane: {
  center: ['50%', '85%'],
  size: '140%',
  startAngle: -90,
  endAngle: 90,
  background: {
    backgroundColor: (window.Highcharts.theme && window.Highcharts.theme.background2) || '#EEE',
    innerRadius: '60%',
    outerRadius: '100%',
    shape: 'arc'
  }
},
tooltip: {
  enabled: false
},
// the value axis
yAxis: {
  stops: [
    [0.0, '#DF5353'], // red
    [0.5, '#DF5353'],
    [0.51, '#DDDF0D'],
    [0.79, '#DDDF0D'], // yellow
    [0.8, '#55BF3B'],
    [1, '#55BF3B'] // green
  ],
  lineWidth: 0,
  minTickInterval: 100,
  minorTickInterval: null,
  tickPixelInterval: 400,
  tickWidth: 0,
  title: {
    y: -110
  },
  labels: {
    y: 16
  }
},
plotOptions: {
  solidgauge: {
    dataLabels: {
      y: 5,
      borderWidth: 0,
      useHTML: true
    }
  }
}
};
// The speed gauge
$('#mydiv')
.highcharts(
  window.Highcharts
  .merge(
    gaugeOptions, {
      yAxis: {
        min: 0,
        max: 100,
        title: {
          text: ''
        }
      },
      credits: {
        enabled: false
      },
      series: [{
        name: 'Speed',
        data: [totalHealthScore],
        dataLabels: {
          format: '<div style="text-align:center"><span style="font-size:25px;color:' + ((window.Highcharts
              .theme && window.Highcharts.theme.contrastTextColor) || 'black') +
            '">{y}</span><br/>' + '<span style="font-size:12px;color:silver">Score</span></div>'
        },
        tooltip: {
          valueSuffix: ' Score'
        }
      }]
    }));
}

我如何隐藏值2.5和100从图表给出的链接??

您可以使用tickInterval和startOnTick来影响刻度的位置,例如

yAxis: {
        tickInterval:200,
        startOnTick:true,
http://jsfiddle.net/DdAr6/

http://api.highcharts.com/highcharts yAxis.tickInterval

需要为y轴定义步数。

在速度计代码中:

yAxis: {
    min: 0,
    max: 200,
    labels: {step:2},
    title: {
        text: 'Speed'
    }       
}

转速表代码:

yAxis: {
    min: 0,
    max: 5,
    labels: {step:2},
    title: {
        text: 'RPM'
    }       
}

完整代码见http://jsfiddle.net/y62sj/