To add ReGraph to an existing app you need to make your license available to the app, and then install the ReGraph bundle.
Next, download the latest version of ReGraph:
Download the latest version of ReGraph:
For Safari browsers, hold the ⌥ Option key when pressing the Download button to download the correct .tgz format.
Copy the ReGraph bundle into your project directory. Do not change the file name.
cd ~/path/to/project
cp ~/Downloads/your_downloaded_file_name.tgz .Install the bundle as a local package from inside your project directory using a package manager:
npm install file:your_downloaded_file_name.tgzyarn add ./your_downloaded_file_name.tgzpnpm install file:your_downloaded_file_name.tgzNow you can import ReGraph into your project:
import React from "react";
import { createRoot } from "react-dom/client"; // enables concurrent rendering
import { Chart } from "regraph";
const items = {
node1: { label: { text: "Hello World!" } }, // data in JSON where node1 is node id
};
const jsx = <Chart items={items} />;
const container = document.getElementById("root");
const root = createRoot(container);
root.render(jsx);