如何删除人力车直方图中的垂直线?

时间:2014-12-24 08:17:45

标签: javascript histogram rickshaw

现在我在数据中有1个元素,我的直方图看起来像:

Rickshaw histogram

如何删除垂直线并删除x轴组件的副本?如何设置直方图高度使矩形比直方图高度放大?

注意:代码:

 var graph = new Rickshaw.Graph({
     element: document.querySelector("#chart"),
     renderer: 'bar',
     width: 540,
     height: 240,
     series: [{
                data: createArray(data),
                color: 'steelblue'
       }]
     });


  var x_axis = new Rickshaw.Graph.Axis.X({
      graph: graph,
      tickFormat:  function(x){
          return (new Date(x)).toLocaleString();
      }
    });

  var y_axis = new Rickshaw.Graph.Axis.Y({
        graph: graph,
        orientation: 'left',
        tickFormat: Rickshaw.Fixtures.Number.formatKMBT,
        element: document.getElementById('y_axis')
    });

  graph.render();

1 个答案:

答案 0 :(得分:1)

如果你不想要垂直线删除它:

  var x_axis = new Rickshaw.Graph.Axis.X({
      graph: graph,
      tickFormat:  function(x){
          return (new Date(x)).toLocaleString();
      }
    });

来自你的代码。

请按照:http://code.shutterstock.com/rickshaw/tutorial/introduction.html