jquery - 用jqplot标记特定数据

标签 jquery canvas jqplot

我有一个 jqplot 线图,它按日期显示用户计数。

我希望在特定日期添加一条标记线,描述我更新应用程序的时间,以便我可以查看应用程序更改是否会造成任何影响。有什么想法吗?

This是一个例子 看上面的图。

我希望在 x=3 上添加带有标签的垂直线。我该怎么做?

最佳答案

这很大程度上是一个黑客,但我发现当你想做“正常”之外的事情时,jqplot 非常不灵活:

$(document).ready(function(){
    plot1 = $.jqplot ('chart1', [[3,7,9,1,4,6,8,2,5],[]], // leave an empty series at the end
    {
      series: [{ 
        showMarker:true
      },
      { 
        showMarker:false,
          pointLabels: { show:true, location: 'ne' } // do not show marker, but do show point label
      }]
  });
  plot1.series[1].data = [[2,plot1.axes.yaxis.min],[2,plot1.axes.yaxis.max]]; //dynamically add the data for the empty series, we do this so we can get the auto-scaled yaxis min/max
  plot1.redraw(); // redraw the plot with adjusted 2nd series
  $('.jqplot-point-label.jqplot-series-1.jqplot-point-0').html('x=2'); // manually adjust the label on the 2nd series (I could not find a way to do this with the builtin methods)

})​

产品:

enter image description here

示例 here .

关于jquery - 用jqplot标记特定数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14031554/

相关文章:

iphone - 我的 HTML5 Canvas 效果可以在 iPhone 或 Android 上运行吗?

javascript - Canvas .fillText 方法似乎在 iPad 上不起作用

在 jqplot 中设置 y Axis 刻度/值的格式

javascript - 未捕获错误 : Syntax error, jQuery 升级后无法识别的表达式

javascript - 无法读取未定义的属性 - p5js

javascript - Protovis 和 JqPlot 性能

jquery - jqPlot 轴和图例在导出的图像中未正确呈现

jQuery - $(some_element) 是否存在于 $(this) 和 $(this).closest(container) 之间?

javascript - 存储 $.getJSON() 对本地变量的响应

javascript - 如何设置页面之间转换的加载图标?