All Projects → sgratzl → chartjs-chart-graph

sgratzl / chartjs-chart-graph

Licence: MIT license
Chart.js Graph-like Charts (tree, force directed)

Programming Languages

typescript
32286 projects
javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to chartjs-chart-graph

Chart
Quick & smart charting for STDIN
Stars: ✭ 521 (+405.83%)
Mutual labels:  graphs, chartjs
chartjs-plugin-doughnutlabel
Chart.js plugin for doughnut chart to display text in the center
Stars: ✭ 48 (-53.4%)
Mutual labels:  chartjs, chartjs-plugin
chartjs-plugin-piechart-outlabels
Highly customizable Chart.js plugin that displays labels outside the pie/doughnut chart.
Stars: ✭ 46 (-55.34%)
Mutual labels:  chartjs, chartjs-plugin
chartjs-chart-wordcloud
Chart.js Word Clouds
Stars: ✭ 34 (-66.99%)
Mutual labels:  chartjs, chartjs-plugin
chartjs-plugin-datasource-prometheus
Chart.js plugin for Prometheus data loading
Stars: ✭ 77 (-25.24%)
Mutual labels:  chartjs, chartjs-plugin
powir
Powir is a Windows 10 based tool to monitor and analyze your system's power and battery usage.
Stars: ✭ 119 (+15.53%)
Mutual labels:  chartjs
competiwatch-desktop
Desktop app built in Electron for tracking your competitive match history in Overwatch.
Stars: ✭ 94 (-8.74%)
Mutual labels:  chartjs
SeaPearl.jl
Julia hybrid constraint programming solver enhanced by a reinforcement learning driven search.
Stars: ✭ 119 (+15.53%)
Mutual labels:  graphs
nova-chartjs
A Chart JS component for Laravel Nova
Stars: ✭ 47 (-54.37%)
Mutual labels:  chartjs
nxontology
NetworkX-based Python library for representing ontologies
Stars: ✭ 45 (-56.31%)
Mutual labels:  graphs
phpchartjs
A PHP library that makes it easy to generate data for ChartJS.
Stars: ✭ 24 (-76.7%)
Mutual labels:  chartjs
CondGen
Conditional Structure Generation through Graph Variational Generative Adversarial Nets, NeurIPS 2019.
Stars: ✭ 46 (-55.34%)
Mutual labels:  graphs
github-user-languages
Browser extension that adds little language pie charts to a user's profile page on GitHub.
Stars: ✭ 41 (-60.19%)
Mutual labels:  chartjs
GraphIO.jl
Graph IO functionality for various formats.
Stars: ✭ 54 (-47.57%)
Mutual labels:  graphs
Ticket-Travel-Management-System
It's a e_Ticketing platform, it has whole ticket reservation system as like ixigo.com. Now three types of traveling such as Flight, Bus and Train reservation system. It's a responsive and dynamic PHP website.
Stars: ✭ 39 (-62.14%)
Mutual labels:  chartjs
Erdos.jl
A library for graph analysis written Julia.
Stars: ✭ 37 (-64.08%)
Mutual labels:  graphs
Voice4Rural
A complete one stop solution for all the problems of Rural area people. 👩🏻‍🌾
Stars: ✭ 12 (-88.35%)
Mutual labels:  chartjs
asyncmachine
Relational State Machine with a visual inspector
Stars: ✭ 67 (-34.95%)
Mutual labels:  graphs
chartjs-chart-timeline
Google-like timeline chart for Chart.js.
Stars: ✭ 44 (-57.28%)
Mutual labels:  chartjs
chart
📊📉 Add beautiful and reusable charts with one line of ruby for Rails 5.x
Stars: ✭ 42 (-59.22%)
Mutual labels:  chartjs

Chart.js Graphs

NPM Package Github Actions

Chart.js module for charting graphs. Adding new chart types: graph, forceDirectedGraph, dendrogram, and tree.

force

dend_h

tree_v

radial

Works great with https://github.com/chartjs/chartjs-plugin-datalabels or https://github.com/chrispahm/chartjs-plugin-dragdata

data label

Open in CodePen

Related Plugins

Check out also my other chart.js plugins:

Install

npm install --save chart.js chartjs-chart-graph

Usage

see Samples on Github

CodePens

Graphviz Dot File Parsing

A Graphviz Dot File parsing package is located at https://github.com/sgratzl/chartjs-chart-graph-dot-parser. It creates compatible data structures to be consumed by this plugin.

Styling

The new chart types are based on the existing line controller. Tho, instead of showing a line per dataset it shows edges as lines. Therefore, the styling options for points and lines are the same. See also https://www.chartjs.org/docs/latest/charts/line.html. However, to avoid confusion, the line options have a default line prefix, e..g lineBorderColor to specify the edge border color and pointBorderColor to specify the node border color.

Data Structure

data: {
  labels: ['A', 'B', 'C'], // node labels
  datasets: [{
    data: [ // nodes as objects
      { x: 1, y: 2 }, // x, y will be set by the force directed graph and can be omitted
      { x: 3, y: 1 },
      { x: 5, y: 3 }
    ],
    edges: [ // edge list where source/target refers to the node index
      { source: 0, target: 1},
      { source: 0, target: 2}
    ]
  }]
},

Alternative structure for trees

data: {
  labels: ['A', 'B', 'C'], // node labels
  datasets: [{
    data: [ // nodes as objects
      { x: 1, y: 2 }, // x, y will be set by the force directed graph and can be omitted
      { x: 3, y: 1, parent: 0 },
      { x: 5, y: 3, parent: 0 }
    ]
  }]
},

Force Directed Graph

chart type: forceDirectedGraph

Computes the x,y position of nodes based on a force simulation. It is based on https://github.com/d3/d3-force/.

force

Open in CodePen

Options

Dendrogram, Tree

chart types: dendrogram, tree

The tree and dendrograms layouts are based on https://github.com/d3/d3-hierarchy.

Dendrogram Horizontal

dend_h

Open in CodePen

Dendrogram Vertical

dend_v

Open in CodePen

Dendrogram Radial

radial

Open in CodePen

Tidy Tree Horizontal

tree_h

Open in CodePen

Tidy Tree Vertical

tree_v

Open in CodePen

Tidy Tree Radial

radial

Open in CodePen

Options

ESM and Tree Shaking

The ESM build of the library supports tree shaking thus having no side effects. As a consequence the chart.js library won't be automatically manipulated nor new controllers automatically registered. One has to manually import and register them.

Variant A:

import { Chart, LinearScale, PointElement } from 'chart.js';
import { ForceDirectedGraphController, EdgeLine } from 'chartjs-chart-graph';

// register controller in chart.js and ensure the defaults are set
Chart.register(ForceDirectedGraphController, EdgeLine, LinearScale, PointElement);
...

new Chart(ctx, {
  type: ForceDirectedGraphController.id,
  data: [...],
});

Variant B:

import { ForceDirectedGraphChart } from 'chartjs-chart-graph';

new ForceDirectedGraphChart(ctx, {
  data: [...],
});

Development Environment

npm i -g yarn
yarn install
yarn sdks vscode

Building

yarn install
yarn build
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].