Highly customizable, animated, responsive, and dependency-free Evolution Graph implementation

Overview

Evolution Graph

Highly customizable, animated, responsive, and dependency-free Evolution Graph implementation. The package is built with Vanilla JavaScript and is used to create flexible data visualizations and present evolution relationships between entities.

Examples of Usage

React

Custom graph demo | Repository

Vanilla JavaScript

Custom graph demo | Repository

Thanks to Abraham Hernandez for the programming-languages-logos, used in the above demos.

React Usage

Install

$ npm install evolution-graph

or

$ yarn add evolution-graph

Code Example

{ let graph = null; // graph.goToNextStep() // graph.goToPreviousStep() // graph.pause() // graph.play() // graph.setCurrentStep(3) return (
{ graph = controllerInstance; }} onChange={(currentStep) => { console.log(currentStep); }} renderBarValue={(value) => `${value}k`} renderGraphTitle={(title) => `Date - ${title}`} />
); }; export default App;">
import React from "react";
import EvolutionGraph from "evolution-graph";
import "evolution-graph/src/css/styles.css";

const data = [
  {
    label: "Python",
    className: "python",
    color: "#387EB8",
    image: "./assets/images/python.svg",
    values: [0, 3, 4, 7, 8, 9, 9, 10, 11, 12, 13, 15],
  },
  {
    label: "Ruby",
    className: "ruby",
    color: "#E82609",
    image: "./assets/images/ruby.svg",
    values: [0, 2, 4, 5, 6, 8, 10, 13, 14, 17, 20, 21],
  },
  {
    label: "JavaScript",
    className: "javascript",
    color: "#F0DB4F",
    image: "./assets/images/javascript.svg",
    values: [0, 2, 3, 6, 7, 10, 14, 20, 20, 24, 28, 32],
  },
];

const labels = [
  "01/01/2021",
  "01/02/2021",
  "01/03/2021",
  "01/04/2021",
  "01/05/2021",
  "01/06/2021",
  "01/07/2021",
  "01/08/2021",
  "01/09/2021",
  "01/10/2021",
  "01/11/2021",
  "01/12/2021",
];

const App = () => {
  let graph = null;

  // graph.goToNextStep()
  // graph.goToPreviousStep()
  // graph.pause()
  // graph.play()
  // graph.setCurrentStep(3)

  return (
    <div className="app">
      <EvolutionGraph
        data={data}
        labels={labels}
        autoPlay={false}
        barDataGap={4}
        barLabelWidth={100}
        barThickness={20}
        barTransitionTopInterval={750}
        className="custom-evolution-graph"
        gap={10}
        order="desc"
        stepInterval={1500}
        showActionButtons
        timelineTrackColor="#cecece"
        timelineTrackFillColor="#0984e3"
        timelineMarkerColor="#cecece"
        timelineMarkerSize={14}
        timelineTrackThickness={4}
        getController={(controllerInstance) => {
          graph = controllerInstance;
        }}
        onChange={(currentStep) => {
          console.log(currentStep);
        }}
        renderBarValue={(value) => `${value}k`}
        renderGraphTitle={(title) => `Date - ${title}`}
      />
    </div>
  );
};

export default App;

Vanilla JavaScript Usage

Install

Download the latest package version and unpack it in your project.

Code Example

Evolution Graph
">
>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <link rel="stylesheet" href="./vendor/evolution-graph/src/css/styles.css" />
    <title>Evolution Graphtitle>
  head>
  <body>
    <div id="evolution-graph-example">div>
    <script type="module">
      import EvolutionGraph from "./vendor/evolution-graph/Controller.js";

      const data = [
        {
          label: "Python",
          className: "python",
          color: "#387EB8",
          image: "./assets/images/python.svg",
          values: [0, 3, 4, 7, 8, 9, 9, 10, 11, 12, 13, 15],
        },
        {
          label: "Ruby",
          className: "ruby",
          color: "#E82609",
          image: "./assets/images/ruby.svg",
          values: [0, 2, 4, 5, 6, 8, 10, 13, 14, 17, 20, 21],
        },
        {
          label: "JavaScript",
          className: "javascript",
          color: "#F0DB4F",
          image: "./assets/images/javascript.svg",
          values: [0, 2, 3, 6, 7, 10, 14, 20, 20, 24, 28, 32],
        },
      ];

      const labels = [
        "01/01/2021",
        "01/02/2021",
        "01/03/2021",
        "01/04/2021",
        "01/05/2021",
        "01/06/2021",
        "01/07/2021",
        "01/08/2021",
        "01/09/2021",
        "01/10/2021",
        "01/11/2021",
        "01/12/2021",
      ];

      const graph = new EvolutionGraph({
        data,
        labels,
        autoPlay: false,
        barDataGap: 4,
        barLabelWidth: 100,
        barThickness: 20,
        barTransitionTopInterval: 750,
        className: "custom-evolution-graph",
        gap: 10,
        order: "desc",
        showActionButtons: true,
        stepInterval: 1500,
        timelineTrackColor: "#cecece",
        timelineTrackFillColor: "#0984e3",
        timelineMarkerColor: "#cecece",
        timelineMarkerSize: 14,
        timelineTrackThickness: 4,
        onChange: (currentStep) => {
          console.log(currentStep);
        },
        renderBarValue: (value) => `${value}k`,
        renderGraphTitle: (title) => `Date - ${title}`,
      });

      // graph.goToNextStep()
      // graph.goToPreviousStep()
      // graph.pause()
      // graph.play()
      // graph.setCurrentStep(3)

      graph.render("#evolution-graph-example");
    script>
  body>
html>

Required Props

data

type: Array

Array of objects, each representing one bar on the graph. Must have the same length as labels.

labels

type: Array

Array of strings, each representing one label on the graph timeline. Must have the same length as data.

Optional Props

autoPlay

type: Boolean

default: false

Play the graph on component mount.

barDataGap

type: Number

default: 4

Gap between bar and bar data, in pixels.

barLabelWidth

type: Number

default: 100

Width of the bar labels, in pixels.

barThickness

type: Number

default: 20

Bar thickness, in pixels.

barTransitionTopInterval

type: Number

default: stepInterval / 2

Bar transition top time, in milliseconds.

className

type: String

default: ""

Custom CSS class applied to the graph container.

gap

type: Number

default: "desc"

Gap between graph bars, in pixels.

order

type: String

default: "desc"

Graph bars order. Can be either "desc" or "asc".

showActionButtons

type: Boolean

default: true

Action buttons visibility.

stepInterval

type: Number

default: 1500

Step transition time, in milliseconds.

timelineTrackColor

type: String

default: "#cecece"

Background color of the timeline track.

timelineTrackFillColor

type: String

default: "#0984e3"

Background color of the timeline track fill.

timelineMarkerColor

type: String

default: "#cecece"

Background color of the timeline markers.

timelineMarkerSize

type: Number

default: 14

Width and height of the timeline markers, in pixels.

timelineTrackThickness

type: Number

default: 4

Height of the timeline track, in pixels.

Callback Props

getController

default: (controller:Controller) => controller

Returns the graph controller instance. React prop only.

onChange

default: (currentStep:Number) => currentStep

Returns the current step when the graph changes.

renderBarValue

default: (value:Number) => value

Returns the current bar value for handling.

renderGraphTitle

default: (title:String) => title

Returns the current graph title for handling.

API Methods

goToNextStep

Go to the next step.

goToPreviousStep

Go to the previous step.

pause

Pause the graph if it is playing.

play

Play step by step.

render

argument: selector

argument type: String

Create and append the graph as a child of the element selected by the selector passed as an argument.

setCurrentStep

argument: step

argument type: Number

Set the current step using the index passed as argument.

To Do

  • renderBarLabel callback prop
  • playIcon prop
  • pauseIcon prop
  • previousIcon prop
  • nextIcon prop
  • manage labels exibition on window resize
  • Global types declaration
  • Tests
  • showBarLabel prop
  • showBarValue prop
  • showBarImage prop
  • onClickTimelineLabel prop
  • onClickBar prop
You might also like...

A web app that shows visualizations of the most used graphs algorithms such as BFS, DFS, Dijsktra, Minimum spanning tree, etc. It allows you to draw your own graph.

Graph Visualizer Draw your own graphs and visualize the most common graph algorithms This web application allows you to draw a graph from zero, with p

Jul 29, 2022

CyberGraph is a 3D-graph based, user based social connection explorer

CyberGraph is a 3D-graph based, user based social connection explorer

CyberGraph is a 3D-graph based, user based social connection explorer. It has some cool features like 3d node graph, dynamic loading bar, immersive user experience, cyber mode(10-hops friendship network display) and focus mode(aggregated connection display).

Nov 25, 2022

📊 A highly interactive data-driven visualization grammar for statistical charts.

📊 A highly interactive data-driven visualization grammar for statistical charts.

English | 简体中文 G2 A highly interactive data-driven visualization grammar for statistical charts. Website • Tutorial Docs • Blog • G2Plot G2 is a visua

Dec 30, 2022

svgMap is a JavaScript library that lets you easily create an interactable world map comparing customizable data for each country.

svgMap svgMap is a JavaScript library that lets you easily create an interactable world map comparing customizable data for each country. Live demo: h

Dec 25, 2022

:dango: An interactive and responsive charting library

:dango:  An interactive and responsive charting library

English | 简体中文 G2Plot A charting library based on the Grammar of Graphics. G2Plot is an interactive and responsive charting library. Based on the gram

Dec 30, 2022

Simple responsive charts

Simple responsive charts

Big welcome by the Chartist Guy Checkout the documentation site at http://gionkunz.github.io/chartist-js/ Checkout this lightning talk that gives you

Dec 30, 2022

Simple, responsive, modern SVG Charts with zero dependencies

Simple, responsive, modern SVG Charts with zero dependencies

Frappe Charts GitHub-inspired modern, intuitive and responsive charts with zero dependencies Explore Demos » Edit at CodePen » Contents Installation U

Jan 4, 2023

An implementation of Bézier curve rendering and manipulation, using the HTML5 Canvas API.

An implementation of Bézier curve rendering and manipulation, using the HTML5 Canvas API.

Bézier Curves An implementation of Bézier curve rendering and manipulation, using the HTML5 Canvas API. How does it work? Bézier curves can be simply

Apr 13, 2022

An HTML5/Canvas implementation of 8-bit color cycling

An HTML5/Canvas implementation of 8-bit color cycling

Overview Here is the JavaScript and C++ source code to my color cycling engine, written in 2010. I am releasing it under the LGPL v3.0. The package co

Dec 1, 2022
Owner
Nathan S. Santos
Front-end Engineer
Nathan S. Santos
Free Bootstrap 5 Admin and Dashboard Template that comes with all essential dashboard components, elements, charts, graph and application pages. Download now for free and use with personal or commercial projects.

PlainAdmin - Free Bootstrap 5 Dashboard Template PlainAdmin is a free and open-source Bootstrap 5 admin and dashboard template that comes with - all e

PlainAdmin 238 Dec 31, 2022
Simple tiny dependency graph engine, MobX inspired

?? Quarx Simple tiny dependency graph engine, MobX inspired Introduction In less than 200 lines of code and zero dependencies Quarx supports most of M

Dmitry Maevsky 22 Nov 2, 2022
HTML5 Canvas Gauge. Tiny implementation of highly configurable gauge using pure JavaScript and HTML5 canvas. No dependencies. Suitable for IoT devices because of minimum code base.

HTML Canvas Gauges v2.1 Installation Documentation Add-Ons Special Thanks License This is tiny implementation of highly configurable gauge using pure

Mykhailo Stadnyk 1.5k Dec 30, 2022
a graph visualization library using web workers and jQuery

arbor.js -------- Arbor is a graph visualization library built with web workers and jQuery. Rather than trying to be an all-encompassing framework, a

Christian Swinehart 2.6k Dec 19, 2022
A JavaScript library dedicated to graph drawing

sigma.js - v1.2.1 Sigma is a JavaScript library dedicated to graph drawing, mainly developed by @jacomyal and @Yomguithereal. Resources The website pr

Alexis Jacomy 10.3k Jan 3, 2023
Minimalistic, animated SVG gauge. Zero dependencies

SVG Gauge Minmalistic, configurable, animated SVG gauge. Zero dependencies Buy me a coffee ☕ If you like my work please consider making a small donati

Aniket Naik 264 Dec 17, 2022
Data visualization library for depicting quantities as animated liquid blobs

liquidity.js A data visualization library for depicting quantities as animated liquid blobs. For a demonstration of what the final product can look li

N Halloran 91 Sep 20, 2022
A React toolkit for graph visualization based on G6

Graphin A React toolkit for graph analysis based on G6 English | 简体中文 ✨ Features ?? Good-looking elements, standardized style configuration Graphin st

AntV team 823 Jan 7, 2023
Gephi - The Open Graph Viz Platform

Gephi - The Open Graph Viz Platform Gephi is an award-winning open-source platform for visualizing and manipulating large graphs. It runs on Windows,

Gephi 5.1k Jan 4, 2023
3D graph viewer powered by WebGL (three.js)

Graphosaurus A three-dimensional static graph viewer. (click the image to try it out) Demos EVE Online map Add nodes incrementally Documentation JSDoc

Corey Farwell 362 Dec 4, 2022