如何在dygraph中隐藏y2轴?

时间:2015-05-26 17:12:55

标签: javascript charts dygraphs

如何使用Dygraph中的drawAxis选项隐藏下图中的y2轴(Z轴)? drawAxis:false选项在下面的示例代码段中不起作用。

我从http://dygraphs.com/的播放示例中提取了以下示例,并进行了修改以解决我的问题。



g = new Dygraph(document.getElementById("graph"),
  // For possible data formats, see http://dygraphs.com/data.html
  // The x-values could also be dates, e.g. "2012/03/15"
  "X,Y,Z\n" +
  "1,0,3\n" +
  "2,2,6\n" +
  "3,4,8\n" +
  "4,6,9\n" +
  "5,8,9\n" +
  "6,10,8\n" +
  "7,12,6\n" +
  "8,14,3\n", {
    // options go here. See http://dygraphs.com/options.html
    legend: 'always',
    animatedZooms: true,
    title: 'dygraphs chart template',
    series: {
      'Z': {
        axis: 'y2'
      }
    },
    axes: {
      y2: {
        drawAxis: false
      }
    }
  });

/*
Relevant CSS classes include:

Labels on the X & Y axes:
.dygraph-axis-label
.dygraph-axis-label-x
.dygraph-axis-label-y
.dygraph-axis-label-y2

Chart labels, see http://dygraphs.com/tests/styled-chart-labels.html
.dygraph-title
.dygraph-xlabel
.dygraph-ylabel
.dygraph-y2label

The legend, see http://dygraphs.com/tests/series-highlight.html
.dygraph-legend
*/

.dygraph-title {
  color: gray;
}

<script src="http://dygraphs.com/dygraph-dev.js"></script>
<!-- You may set style: "width: ...; height: ..." to size the chart -->
<div id="graph"></div>
&#13;
&#13;
&#13;

0 个答案:

没有答案