axes - Rickshaw - need help designing line + bar toggle chart -


i started using ricksaw animated graphs , i'm trying set x-axes list months. not in particular time series (yet), correspond specific data points. have simple coding program try , can't seem modify x-axes labels. there easy way this? also, how similar y-axis? thanks!

< script >    var mygraph = new rickshaw.graph({      element: document.queryselector("#mychart"),      renderer: 'multi',      width: 500,      height: 250,      min: 0,      max: 18,      series: [{        name: "population1",        color: "steelblue",        renderer: 'lineplot',        data: [{          x: 0,          y: 10,        }, {          x: 1,          y: 3,        }, {          x: 2,          y: 8,        }, {          x: 3,          y: 15,        }, {          x: 4,          y: 12,        }, {          x: 5,          y: 8,        }, {          x: 6,          y: 3,        }, {          x: 7,          y: 5,        }, {          x: 8,          y: 2,        }, {          x: 9,          y: 1,        }, {          x: 10,          y: 4,        }, ]      }, {        name: "population2",        color: "green",        renderer: 'bar',        data: [{          x: 0,          y: 5,        }, {          x: 1,          y: 3,        }, {          x: 2,          y: 8,        }, {          x: 3,          y: 6,        }, {          x: 4,          y: 3,        }, {          x: 5,          y: 12,        }, {          x: 6,          y: 13,        }, {          x: 7,          y: 14,        }, {          x: 8,          y: 12,        }, {          x: 9,          y: 8,        }, {          x: 10,          y: 9,        }, ]      }]    });  var xticks = new rickshaw.graph.axis.x({    graph: mygraph,    orientation: "bottom",    element: document.queryselector("#xaxis")  });  var yticks = new rickshaw.graph.axis.y({    graph: mygraph,    orientation: "left",    element: document.queryselector("#yaxis")  });  var graphhover = new rickshaw.graph.hoverdetail({    graph: mygraph  });  var mylegend = new rickshaw.graph.legend({    graph: mygraph,    element: document.queryselector("#mylegend")  });  var toggling = new rickshaw.graph.behavior.series.toggle({    graph: mygraph,    legend: mylegend  });  mygraph.render(); < /script>
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.11.4/jquery-ui.min.css"> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/rickshaw/1.5.1/rickshaw.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>  <script src="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.11.4/jquery-ui.js"></script>    <script src="https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.6/d3.min.js"></script>  <script src="https://cdnjs.cloudflare.com/ajax/libs/rickshaw/1.5.1/rickshaw.min.js"></script>    <body>    <div style="margin-bottom:10px; margin-left:20px" id="mylegend"></div>    <div style="display:block; float:left; width:20px; height:280px; padding-bottom:10px;" id="yaxis"></div>    <div>      <div style="margin-left:20px;" id="mychart"></div>      <div style="margin-left:20px" id="xaxis"></div>    </div>  </body>

try this

var xaxis = new rickshaw.graph.axis.time({      graph: graph,      tickformat: function(x){       return new date(x).tolocalestring(); }, ticks: 4 });  xaxis.render(); 

Comments

Popular posts from this blog

Ansible - ERROR! the field 'hosts' is required but was not set -

customize file_field button ruby on rails -

SoapUI on windows 10 - high DPI/4K scaling issue -