Highstock工具提示“标签”未呈现

时间:2018-12-05 04:14:48

标签: highcharts

我正在尝试在highstock标志的工具提示中添加锚标签。
我正面临着几个问题:

  1. 锚标记未显示在工具提示中。
  2. 当我尝试将鼠标悬停在工具提示上时,工具提示会消失。

我的代码如下:

randomnumber = rnd.Next(100);
Form2 r2 = new Form2(randomnumber);
r2.ShowDialog();
$.getJSON('https://cdn.rawgit.com/highcharts/highcharts/057b672172ccc6c08fe7dbb27fc17ebca3f5b770/samples/data/usdeur.json', function (data) {

  var year = new Date(data[data.length - 1][0]).getFullYear(); // Get year of last data point

  // Create the chart
  Highcharts.stockChart('container', {


    rangeSelector: {
      selected: 4
    },

    title: {
      text: 'USD to EUR exchange rate'
    },

    yAxis: {
      title: {
        text: 'Exchange rate'
      }
    },

    series: [{
      name: 'USD to EUR',
      data: data,
      id: 'dataseries',
      tooltip: {
        valueDecimals: 4
      }
    },{
      type: 'flags',
      data: [{
        x: Date.UTC(year, 11, 1),
        title: 'B',
        text: 'make me clickable'
      }, {
        x: Date.UTC(year, 11, 1),
        title: 'B',
        text: '<a>make me clickable</a>'
      }],
      shape: 'circlepin',
      onSeries: 'dataseries',
      width: 16,
      tooltip: {                          
                          pointFormat: '<a href="#">{point.text}</a>'
                      }       ,
      style:{
        border:'1px solid green'
      }
    }]
  });
});


我在做什么错了?

1 个答案:

答案 0 :(得分:0)

您必须将工具提示的useHTML设置为true。为了更轻松地在工具提示上悬停,请增加hideDelay的值,并在系列上禁用stickyTracking

    tooltip: {
        useHTML: true,
        hideDelay: 5000
    }

实时演示:http://jsfiddle.net/BlackLabel/ncrgwvzu/

API:

https://api.highcharts.com/highstock/series.line.stickyTracking

https://api.highcharts.com/highstock/tooltip.useHTML