sc0ttj / component

A tiny library for isomorphic JavaScript components
MIT License
2 stars 1 forks source link

update: pass in params to xAxis and yAxis as an object #58

Closed sc0ttj closed 2 years ago

sc0ttj commented 2 years ago

This makes it easier/clearer to set up axes for a few reasons:

..on that last note, a "tickCentre" option has been added, so you can have the ticks centered next to the label, or split around it.

Usage

    .xAxis({
      range: [1999,2006],
      scale: 1,
      label: "Years",
      labelBelow: true,
      yPos: 0,
      tickLength: -3,
      tickCentered: true,
      tickLabelCentered: true,
      tickLabels: [],
    })

    .yAxis({
      range: [0,16],
      scale: 1,
      label: "Gold medals",
      labelLeft: true,
      xPos: 0,
      tickLength: -3,
      tickCentered: false,
      tickLabels: [],
    })