Highstock:悬停工具提示格式

时间:2015-12-18 00:18:27

标签: javascript highstock

我正在阅读highstock文档并将其悬停在格式化上,但它没有达到我希望它用于悬停工具提示的格式。我想要做的是,当用户将鼠标悬停在图表上的某个点上时,它应显示名称和值,如此jsfiddle http://jsfiddle.net/w5h6rffo/7/

中所示

从悬停在一点上可以看出,格式是 日期在行的顶部,下一行是系列1:当前点。 我想摆脱日期线,我该如何做到这一点?

<HTML>
<script src="https://code.highcharts.com/stock/highstock.js"></script>
<script src="https://code.highcharts.com/stock/modules/exporting.js"></script>

<button type="button" class="btn" onclick="graphX();">Details</button>
<div id="container" style="height: 400px; min-width: 310px"></div>
</HTML>

<CSS>
.btn {
  background: #3498db;
  border-radius: 0px;
  font-family: Arial;
  color: #ffffff;
  font-size: 12px;
  padding: 2px 2px 2px 2px;
  text-decoration: none;
  height: 30px;
  width: 70px;
  margin-top: 5px;
  margin-bottom: 5px;
  display: block;
}

.btn.active, .btn:active {
    background: #000000;
    text-decoration: none;
}
</CSS>

<JavaScript>
$('.btn').click(function() {
    $(this).toggleClass('active');
});

$(function graphX() {
  var data = [];
  for(var i = 0; i < 899; i++) {
    data[i] = {X: i};
  }

  var processedData = [];
  Highcharts.each(data, function (d) {
    processedData.push(Math.sin(d.X));
  });

  // Create the chart
  $('#container').highcharts('StockChart', {
    rangeSelector: {
      selected: 1
    },

    series: [{
      data: processedData,
      pointStart: Date.UTC(2010, 1, 1),
    }],

  });
});
</JavaScript>

我一直在提及以下文件

http://www.highcharts.com/docs/chart-concepts/tooltip

http://api.highcharts.com/highcharts#tooltip

1 个答案:

答案 0 :(得分:1)

您可以通过粘贴空字符串重置headerFormat

headerFormat:''

See this