Skip to content

Latest commit

 

History

History
87 lines (67 loc) · 1.37 KB

README.md

File metadata and controls

87 lines (67 loc) · 1.37 KB

melange-recharts

These are the Melange bindings for Recharts. 🚧 It is not completed, we are adding bindings as we go. Doesn't follow semver at this point. 🚧

Install

Install opam package manager.

Then:

opam install melange-recharts

The bindings support the version ^2.1.12 of recharts npm package, which should be installed separately:

  "dependencies": {
    "recharts": "^2.1.12"
  }

Setup

Add melange-recharts to the libraries in your dune file:

; ...
  (libraries melange-recharts)
; ...

Usage Example

See Example.re;

Helpers

Some of polymorphic params are represented as a variant, list below:

module AxisInterval = {
  ...
  type arg =
    | PreserveStart
    | PreserveEnd
    | PreserveStartEnd
    | Num(int);
  ...
};

module PxOrPrc = {
  ...
  type arg =
    | Px(float)
    | Prc(float);
  ...
};

module StrOrNode = {
  ...
  type arg =
    | Str(string)
    | Node(ReasonReact.reactElement);
  ...
};

you will use it like this:

<XAxis
  interval=PreserveStart
  label=Str("text")
/>
<XAxis
  interval=Num(12)
  label=Node(
    <span>
      (ReasonReact.stringToElement("text"))
    </span>
  )
/>

Check Recharts documentation for available props.