使用Plotly.js自定义垂直线

时间:2017-02-23 18:10:54

标签: javascript plotly

我的要求是使用Plotly.js在X轴的某些日期绘制垂直线。我是新手,我设法找到一个选项,使用' Shapes'选项。

shapes: [{
  type: 'line',
  x0: '2000-01-11',
  y0: 0,
  x1: '2000-01-11',
  y1: 7,
  line: {
    color: 'grey',
    width: 1.5,
    dash: 'dot'
  }
}]

但我面临的主要困难是如何在绘制垂直线时定义Y轴值,因为Y轴比例将根据数据而不同。我希望它是动态的东西,比如y0:0; y1:(d3中的height-margin.top-margin.bottom),用于绘制垂直线。

请帮助,代码在这里 http://codepen.io/anon/pen/VpwWmV?editors=0010#0

0 个答案:

没有答案