简体   繁体   English

在Highcharts中的导出按钮上添加文本

[英]Add text over export button in Highcharts

Currently I am using the Highcharts API here and here to style the export button for Highcharts. 目前,我在此处此处使用Highcharts API 为Highcharts设置导出按钮的样式。 I am trying to get an ellipsis positioned inside of the export button to create a button that meets some styling guidelines, but due to the limitations of the API options, the closest I can get is placing it next to the symbol. 我试图在导出按钮的内部放置一个省略号,以创建一个符合某些样式准则的按钮,但是由于API选项的限制,我能获得的最接近的符号是将其放置在符号旁边。

Current used options: 当前使用的选项:

exportButton: {
    text: '...',
    symbolFill: 'rgb(250, 168, 0)',
    symbolStroke: 'transparent',
    symbol: 'circle'
},

this is the current result: JsFiddle 这是当前结果: JsFiddle

Ultimately, I want the end result to be something like this: 最终,我希望最终结果是这样的:

圆内的省略号

Does anyone know a way I can acheive this without using an image? 有谁知道不使用图片就可以实现此目的的方法?

With the use of Renderer , you can render a proper shape and add it to the exporting button group. 使用Renderer ,您可以渲染适当的形状并将其添加到导出按钮组中。

Highcharts.Chart.prototype.callbacks.push(function(chart) {
var exportElements = chart.exportSVGElements,
  exportButton = exportElements[0],
  cx = exportButton.width / 2,
  cy = exportButton.height / 2,
  r = cx,
  renderer = chart.renderer;

    exportElements.push(renderer.circle({
      cx: cx,
      cy: cy,
      r: r,
      fill: '#ADD8E6'
    }).add(exportButton));

    [0.65, 1, 1.35].forEach(scx => {
      exportElements.push(renderer.circle({
        cx: scx * cx,
        cy: cy,
        r: r * 0.12,
        fill: 'white'
      }).add(exportButton));
    });
});

Then specify exporting width, height and you can set symbol to null 然后指定导出宽度,高度,您可以将符号设置为null

    exporting: {
  buttons: {
    contextButton: {
      symbol: null,
      height: 50,
      width: 50,
    }
  }
},

example: http://jsfiddle.net/0wd08pjw/ 例如: http//jsfiddle.net/0wd08pjw/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM