jquery - 工具提示尖箭头饼图 Highcharts

标签 jquery html css highcharts

enter image description here

enter image description here

栏上的工具提示有向下的箭头,但对于饼图,它只显示矩形框。

我也想要饼图的相同尖箭头。

最佳答案

您可以通过扩展 Highcharts 来更改工具提示的形状。

(function(Highcharts) {
      Highcharts.Renderer.prototype.symbols.callout = function(x, y, w, h, options) {
      var arrowLength = 6,
        halfDistance = 6,
        r = Math.min((options && options.r) || 0, w, h),
        safeDistance = r + halfDistance,
        anchorX = options && options.anchorX,
        anchorY = options && options.anchorY,
        path;

      path = [
        'M', x + r, y,
        'L', x + w - r, y, // top side
        'C', x + w, y, x + w, y, x + w, y + r, // top-right corner
        'L', x + w, y + h - r, // right side
        'C', x + w, y + h, x + w, y + h, x + w - r, y + h, // bottom-right corner
        'L', x + r, y + h, // bottom side
        'C', x, y + h, x, y + h, x, y + h - r, // bottom-left corner
        'L', x, y + r, // left side
        'C', x, y, x, y, x + r, y // top-right corner
      ];

      path.splice(23, 3,
        'L', w / 2 + halfDistance, y + h,
        w / 2, y + h + arrowLength,
        w / 2 - halfDistance, y + h,
        x + r, y + h
      );

      return path;
    };
  }(Highcharts));

http://jsfiddle.net/p0vk50o6/

文档: - http://www.highcharts.com/docs/extending-highcharts/extending-highcharts

关于jquery - 工具提示尖箭头饼图 Highcharts ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34543009/

相关文章:

javascript - 文本垂直居中 Canvas

html - 图片标签中的背景位置

javascript - jquery javascript 停止在嵌套数组迭代中计算 undefined object

javascript - 条形图不适合图表区域

javascript - 使用 d3.js 在多个 div 中创建 SVG

html - 全尺寸链接作为缩进嵌套无序列表中的 block ?

css - 幻灯片在 IE 和 Div 中消失不响应 IE 中的 CSS 样式/定位

html - 当兄弟元素挡道时,SVG 悬停事件不会触发

javascript - 在 AJAX 应用程序中重写 URL

javascript - Jquery 动画宽度 Accordion 样式横幅