jQplot有峰值的工具提示吗?

时间:2014-04-02 08:59:32

标签: graph highcharts jqplot

有没有办法按照下图显示工具提示或气泡,以显示折线图中的最高值?它应该始终可见,而不仅仅是用鼠标滚动。

jQplot是否支持此功能?如果没有,是否有任何其他图形库可以做到这一点?

非常感谢。

enter image description here

2 个答案:

答案 0 :(得分:1)

使用jqplot,可以使用pointLabels插件:

JS:

$(document).ready(function(){
  var line1 = [[0,14,null],[1,32,null], [2,41,null], [3,44,'Hello World!'], [4,40,null], [5,47,null], [6,53,null], [7,67,null]]; // Only the 'Hello World' will have a label
  var plot1 = $.jqplot('chart1', [line1], {
      title: 'Chart with Point Labels', 
      seriesDefaults: { 
        showMarker:false,
        pointLabels: { show:true } 
      }
  });
});

泡泡CSS(来自here):

#chart1 .jqplot-point-label {
    width: 100px;
    height: 25px;
    padding: 0px;
    background: #CC857E;
    -webkit-border-radius: 10px;
    -moz-border-radius: 10px;
    border-radius: 10px;
    text-align: center;
    padding-top: 10px;
    margin-bottom: 8px;
}
.jqplot-point-label:after 
{
    content: '';
    position: absolute;
    border-style: solid;
    border-width: 15px 10px 0;
    border-color: #CC857E transparent;
    display: block;
    width: 0;
    z-index: 1;
    bottom: -10px;
    left: 40px;
}

生成此(fiddle here):

enter image description here

答案 1 :(得分:0)

在高档中,您可以使用this

等标记

其他选项是使用渲染器添加自定义形状:http://api.highcharts.com/highstock#Renderer

相关问题