All Projects → geoffreybr → D3 Parliament

geoffreybr / D3 Parliament

Licence: mit
A parliament chart based on D3js

Projects that are alternatives of or similar to D3 Parliament

Ngx Charts
📊 Declarative Charting Framework for Angular
Stars: ✭ 4,057 (+9120.45%)
Mutual labels:  dataviz, d3, d3js
Carbon Charts
📊 📈⠀Robust dataviz framework implemented using D3 & typescript
Stars: ✭ 287 (+552.27%)
Mutual labels:  dataviz, d3, d3js
Dex
Dex : The Data Explorer -- A data visualization tool written in Java/Groovy/JavaFX capable of powerful ETL and publishing web visualizations.
Stars: ✭ 1,238 (+2713.64%)
Mutual labels:  dataviz, d3, d3js
leaflet heatmap
简单的可视化湖州通话数据 假设数据量很大,没法用浏览器直接绘制热力图,把绘制热力图这一步骤放到线下计算分析。使用Apache Spark并行计算数据之后,再使用Apache Spark绘制热力图,然后用leafletjs加载OpenStreetMap图层和热力图图层,以达到良好的交互效果。现在使用Apache Spark实现绘制,可能是Apache Spark不擅长这方面的计算或者是我没有设计好算法,并行计算的速度比不上单机计算。Apache Spark绘制热力图和计算代码在这 https://github.com/yuanzhaokang/ParallelizeHeatmap.git .
Stars: ✭ 13 (-70.45%)
Mutual labels:  d3, dataviz, d3js
Vue D3 Workshop
Workshop content material and excercises for Suncoast Developers
Stars: ✭ 63 (+43.18%)
Mutual labels:  dataviz, d3, d3js
ddplot
Create D3 based SVG graphics easily from R
Stars: ✭ 43 (-2.27%)
Mutual labels:  d3, dataviz, d3js
d3-gridding
grids for rapid D3 charts mockups
Stars: ✭ 100 (+127.27%)
Mutual labels:  d3, dataviz, d3js
Neo4jd3
Neo4j graph visualization using D3.js
Stars: ✭ 843 (+1815.91%)
Mutual labels:  d3, d3js
turkeyvisited
Mark the cities you have visited in Turkey and share the map!
Stars: ✭ 82 (+86.36%)
Mutual labels:  d3, d3js
billboard
🎤 Lyrics/associated NLP data for Billboard's Top 100, 1950-2015.
Stars: ✭ 53 (+20.45%)
Mutual labels:  d3, d3js
multi-verse
lit-element components for fast and modular multivariate analysis
Stars: ✭ 34 (-22.73%)
Mutual labels:  d3, dataviz
game of life-elixir
An implementation of Conway's Game of Life in Elixir
Stars: ✭ 22 (-50%)
Mutual labels:  d3, d3js
D3 Extended
Extends D3 with some common jQuery functions and more
Stars: ✭ 269 (+511.36%)
Mutual labels:  d3, d3js
Treedu
Graphical Disk Usage command for the terminal, using Node.js, d3.js, blessed, and Drawille
Stars: ✭ 10 (-77.27%)
Mutual labels:  dataviz, d3
d3.geometer
[NOT MAINTAINED] A D3js library for drawing polytopes, angles, coordinates, geometries and more.
Stars: ✭ 18 (-59.09%)
Mutual labels:  d3, d3js
proteic
Streaming and static data visualization for the modern web.
Stars: ✭ 37 (-15.91%)
Mutual labels:  d3, dataviz
align covid
Coronavirus time series aligned by number of cases, not date.
Stars: ✭ 22 (-50%)
Mutual labels:  d3, d3js
Mozaik
Mozaïk is a tool based on nodejs / react / redux / nivo / d3 to easily craft beautiful dashboards
Stars: ✭ 3,546 (+7959.09%)
Mutual labels:  dataviz, d3
Party Mode
An experimental music visualizer using d3.js and the web audio api.
Stars: ✭ 690 (+1468.18%)
Mutual labels:  d3, d3js
D3 Dot Graph
This module provides D3js compatible library to parse and load files in graphviz DOT (.dot) (graph description language) format.
Stars: ✭ 23 (-47.73%)
Mutual labels:  d3, d3js

d3 Parliament chart

Quick Start

Install with Bower

bower install d3-parliament

Use it!

/* set up the parliament */
var parliament = d3.parliament();
parliament.width(500).height(500).innerRadiusCoef(0.4);
parliament.enter.fromCenter(true).smallToBig(true);
parliament.exit.toCenter(false).bigToSmall(true);

/* register event listeners */
parliament.on("click", function(d) { alert("You clicked on a seat of " + d.party.name); });
parliament.on("mouseover", function(d) { console.log("mouse on " + d.party.name); });
parliament.on("mouseout", function(d) { console.log("mouse out of " + d.party.name); });

/* add the parliament to the page */
d3.json("data.json", function(d) {
    d3.select("svg").datum(d).call(parliament);
});

Documentation

Parameters

You can set up the parameters of the parliament passing the values through the function named as the parameter (see the example):

  • width Number = The max. width of the parliament (which will always be half a circle)
  • height Number = The max. height of the parliament (which will always be half a circle)
  • innerRadiusCoef Number = The coefficient applied to get the free space in the middle (min=0: no space; max=0.99: very few space for the seats)

Events

All the mouse and touch events that can be thrown on the circles that will represent the seats are available : click, dblclick, mousedown, mouseenter, mouseleave, mousemove, mouseout, mouseover, mouseup, touchcancel, touchend, touchmove, touchstart

You can register event listeners calling on. The first parameter given to the event listener is an object containing the following fields:

  • polar Object = The polar coordinates of the seat
    • r Number = radius
    • teta Number = angle
  • cartesian Object = The cartesian coordinates of the seat, origin is centered on the bottom of the chart
    • x Number = number of pixels on x axe from the origin
    • y Number = number of pixels on y axe from the origin
  • party Object = data of a party that you put in the array (see Data)
  • data Object = data of this seat (see Data)

Data

The data given to datum before calling parliament (see example) should be an array of objects, one object per party in the parliament. These objects should contain the fields:

  • id String = the unique id of the party
  • seats Array | Number = if it is a number, it is the number of seats for this party in the parliament ; if it is an Array, one element is a seat (or MP), you can put all you want in it (String, Object...), you will retrieve it as data field in your event listener.

Then, you can add more data if you want to retrieve them in your event listeners.

License

MIT License

TODO

  • Check the data to avoid infinite loop or division by zero
  • Animation enter from / exit to outside of the playground svg
  • Other? Let me know!
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].