Skip to content

ahrefs/melange-recharts

Repository files navigation

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);
  ...
};

you will use it like this:

<XAxis
  interval=PreserveStart
/>
<XAxis
  interval=Num(12)
/>

Check Recharts documentation for available props.