【问题标题】:HighCharts :(Solid Gauge) How to generate gauge dial with an arrow end.HighCharts :(Solid Gauge) 如何生成带箭头端的仪表盘。
【发布时间】:2017-07-21 12:18:57
【问题描述】:

我正在尝试使用高图表(实心仪表)创建自定义数据刻度盘。

请帮帮我。

我无法像实心量规的尖端刻度盘那样生成箭头末端。这是我目前的图表:

更新代码:请将代码复制粘贴到下面提供的小提琴链接中

$(function() {

var gaugeOptions = {

chart: {
  type: 'solidgauge',
  height: 80,
  width: 120,
  backgroundColor: null
},

title: null,

pane: {
  center: ['50%', '60%'],
  size: '100%',
  startAngle: -90,
  endAngle: 90,
  background: {
    innerRadius: '60%',
    outerRadius: '100%',
    shape: 'arc'
  }
},
credits: {
  enabled: false
},

tooltip: {
  enabled: false
},

plotOptions: {
  solidgauge: {
    dataLabels: {
      y: 5,
      borderWidth: 0,
      useHTML: true
    }
  },
  gauge: {
    dial: {
      baseWidth: 1,
      topWidth: 1
    },
    pivot: {
     radius: 3,
     borderWidth: 1
     }
    }
  }
};

  // The speed gauge
  $('#container-speed').highcharts(Highcharts.merge(gaugeOptions, {
    yAxis: {
       min: 0,
       max: 5,
       tickPositions: [],
       plotBands: [{ // mark the weekend
      color: {
      linearGradient: [0, 0, 300, 0],
      stops: [
        [0.1, '#55BF3B'], // green
        [0.2, '#DDDF0D'], // yellow
        [0.3, '#DF5353']
      ]
      },
      from: 0,
      to: 5,
      innerRadius: '60%',
      outerRadius: '100%',
  }],
},
series: [{
  name: 'Ship Average',
  type: 'gauge',
  data: [2],

  color: {
    linearGradient: [0, 0, 300, 0],
    stops: [
      [0.1, '#55BF3B'], // green
      [0.25, '#DDDF0D'], // yellow
      [0.4, '#DF5353']
    ]
  },
  dataLabels: {
    format: '<span style="font-size:10px;color:grey;">{y} delays</span></div>',
    y: 30,
    borderWidth: 0
  },
  tooltip: {
    valueSuffix: ' days'
  }
  }]

}));
});

http://jsfiddle.net/n9gfeor2/29/

预期结果:

【问题讨论】:

    标签: javascript css highcharts


    【解决方案1】:

    您可以通过包装拨号方法(翻译)和编辑路径来实现。

        point.shapeArgs = {
          d: dialOptions.path || [
          'M', -rearLength, -baseWidth / 2,
                              'L',
                              baseLength, -baseWidth / 2,
                              radius, -topWidth / 2,
                              radius - 10, -topWidth / 2 - 10,
                              'M',
                              radius, -topWidth / 2,
                              'L',
                              radius - 10, -topWidth / 2 + 10,
                              'M',
                              radius, -topWidth / 2,
                              baseLength, baseWidth / 2, -rearLength, baseWidth / 2,
                              'z'
        ],
    

    简单演示:

    【讨论】:

    • 谢谢你的回答。我是新手,所以我需要了解更多。这个例子完美地工作。我已经编辑了小提琴以满足我的需要
    • 感谢您的反馈:)
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-02-14
    • 1970-01-01
    • 2017-10-23
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多