javascript - 如何隐藏highcharts实体仪表图的中间值?

标签 javascript jquery charts highcharts

我想删除实体仪表图表上出现的中间数字。 例如我想从链接中给出的图表中隐藏 100。

Solid gauge chart

这是我的图表代码。

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

关于javascript - 如何隐藏highcharts实体仪表图的中间值?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24866499/

相关文章:

javascript - 为什么这个循环不会产生我想要的结果?

javascript - JS 将函数的结果传递给其他函数

ios - 在具有相同 X 位置的 Shinobicharts 上显示多个十字准线目标圆圈(iOS)

javascript - 将绝对 div 放置在彼此之间相同的距离上

javascript - 获取要重置的表单

javascript - 替换 href 链接文本

haskell - 使用 haskell-chart 叠加图

javascript - 如何防止在表中的多个下拉列表中选择相同的值并 POST 到服务器

javascript - React JS 在悬停时切换/添加类

excel - 无法在混合散点图/面积图上对齐 x 轴