Search code examples
javascripthistogramrickshaw

How to delete vertical lines in Rickshaw histogram?


Now I have 1 element in data and my histogram looks like:

Rickshaw histogram

How to delete vertical lines and delete copy of x-axis component? And how to set histogram height so rectangles was to enlarge than histogram height?

Note: code:

 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();

Solution

  • if you don't want vertical lines remove this:

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

    from your code.

    follow this:http://code.shutterstock.com/rickshaw/tutorial/introduction.html