Code Monkey home page Code Monkey logo

Dice Graph

DiceGraph

👀 Use graph out of box.

⚠️ Still in development, will change fast and add more GraphClass

Quick Start

Static Usage

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <title>DiceGraph</title>
    <script src="https://unpkg.com/dice-graph@latest"></script>
  </head>
  <body>
    <div id="blabrablah"></div>
  </body>
  <script>
    const { GraphClass } = DiceGraph;
    const instance = new GraphClass({
      width: 800,
      height: 600
    });

    instance.setData(data);
    instance.mount(document.getElementById("blabrablah"));
  </script>
</html>

Module Usage

npm install --save dice-graph
yarn add dice-graph

Vanilla JS

import { GraphClass } from "dice-graph";

const instance = new GraphClass({ ...options });

instance.setData(graphData);

instance.mount(targetDOMElement)

React Hook

import React, { useEffect, useRef } from "react";
import { GraphClass } from "dice-graph";
import data from "./data";
import "./styles.css";

export default function App() {
  const el = useRef();

  useEffect(() => {
    const mindmap = new GraphClass({});
    mindmap.setData(data);
    mindmap.mount(el.current);
  }, []);

  return (
    <div className="App">
      <div style={{ width: 800, height: 600 }} ref={el} />
    </div>
  );
}

Vue Template

<template>
  <div id="target"></div>
</template>

<script>
import { GraphClass } from "dice-graph";
import data from "../assets/data";

export default {
  name: "DiceGraph",
  mounted() {
    const instance = new GraphClass({});

    // DOM node that your graph render
    const el = document.getElementById("target");

    instance.setData(data);
    instance.mount(el);
  },
};
</script>

<style scoped>
#target {
  width: 800px;
  height: 600px;
}
</style>

Angular Component

import { Component } from "@angular/core";
import { MindMapGraph } from "dice-graph";
import data from "../assets/data";

@Component({
  selector: "app-root",
  templateUrl: "./app.component.html",
  styleUrls: ["./app.component.css"]
})
export class AppComponent {
  title = "CodeSandbox";

  ngOnInit() {
    const mindmap = new MindMapGraph({});
    mindmap.setData(data);
    mindmap.mount(document.getElementById("target"));
  }
}

Graph Class

MindMapGraph

MindMapGraph

FamilyTreeGraph

MindMapGraph

DecisionGraph

DecisionGraph

ERGraph

ERGraph

SankeyGraph

SankeyGraph

Release Notes

  • 0.3.6
    • 🎉 Make Mindmap Editable
  • 0.3.5
    • 🎉 Support Sankey Graph
  • 0.3.3
    • 🎉 Support ER Graph
  • 0.3.2
    • 🎉 Support Decision Tree
  • 0.3.0
    • 🎉 Support Mindmap and Familytree

dicegraph's Projects

g-paint icon g-paint

G Paint - An easy drawing board on canvas powered by @antv/g

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.