• Stars
    star
    426
  • Rank 101,884 (Top 3 %)
  • Language
    JavaScript
  • License
    Apache License 2.0
  • Created almost 12 years ago
  • Updated about 3 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Simple radar chart in D3.js

Radar Chart

A reusable radar chart implementation in D3.js. Styleable, configurable and transition-capable.

Radar Example

Usage

Install

bower install [email protected]:alangrafu/radar-chart-d3.git --save

Data structure

var data = [
  {
    className: 'germany', // optional, can be used for styling
    axes: [
      {axis: "strength", value: 13, yOffset: 10},
      {axis: "intelligence", value: 6},
      {axis: "charisma", value: 5},  
      {axis: "dexterity", value: 9},  
      {axis: "luck", value: 2, xOffset: -20}
    ]
  },
  {
    className: 'argentina',
    axes: [
      {axis: "strength", value: 6},
      {axis: "intelligence", value: 7},
      {axis: "charisma", value: 10},  
      {axis: "dexterity", value: 13},  
      {axis: "luck", value: 9}
    ]
  }
];

xOffset and yOffset are optional values that allows a developer to change the position of a specific label. It is important to add them in the first group of axes.

Simple single chart drawing

<div class="chart-container"></div>
<script>
RadarChart.draw(".chart-container", data);
</script>

D3.js reusable chart API

var chart = RadarChart.chart();
var svg = d3.select('body').append('svg')
  .attr('width', 600)
  .attr('height', 800);

// draw one
svg.append('g').classed('focus', 1).datum(data).call(chart);

// draw many radars
var game = svg.selectAll('g.game').data(
  [
    data,
    data,
    data,
    data
  ]
);
game.enter().append('g').classed('game', 1);
game
  .attr('transform', function(d, i) { return 'translate(150,600)'; })
  .call(chart);

Style with CSS

.radar-chart .area {
  fill-opacity: 0.7;
}
.radar-chart.focus .area {
  fill-opacity: 0.3;
}
.radar-chart.focus .area.focused {
  fill-opacity: 0.9;
}
.area.germany, .germany .circle {
  fill: #FFD700;
  stroke: none;
}
.area.argentina, .argentina .circle {
  fill: #ADD8E6;
  stroke: none;
}

Configure

// retrieve config
chart.config();
// all options with default values
chart.config({
  containerClass: 'radar-chart', // target with css, the default stylesheet targets .radar-chart
  w: 600,
  h: 600,
  factor: 0.95,
  factorLegend: 1,
  levels: 3,
  maxValue: 0,
  minValue: 0,
  radians: 2 * Math.PI,
  color: d3.scale.category10(), // pass a noop (function() {}) to decide color via css
  axisLine: true,
  axisText: true,
  circles: true,
  radius: 5,
  open: false,  // whether or not the last axis value should connect back to the first axis value
                // if true, consider modifying the chart opacity (see "Style with CSS" section above)
  axisJoin: function(d, i) {
    return d.className || i;
  },
  tooltipFormatValue: function(d) {
    return d;
  },
  tooltipFormatClass: function(d) {
    return d;
  },
  transitionDuration: 300
});

Example

###CSV2Radar

Display a csv file as a radar chart at http://alangrafu.github.io/radar-chart-d3/csv2radar.html.

Example http://bl.ocks.org/tpreusse/2bc99d74a461b8c0acb1

More Repositories

1

timeknots

Minimalist timeline in javascript based on d3.js. This work was inspired by https://github.com/mquan/timeline
JavaScript
181
star
2

visualRDF

Visual representation of RDF
PHP
106
star
3

lodspeakr

Framework to create Linked Data-based applications (formerly Linked Open Data Simple Publishing Kit)
PHP
32
star
4

visualbox

Visualization server based on LODSPeaKr
PHP
20
star
5

github-open-data-portal

Ejemplo de Repositorio Open Data en github
JavaScript
12
star
6

visualSparql

Create SPARQL queries in a graphical way
JavaScript
10
star
7

flod

A Framework for Linked Open Data
Python
8
star
8

farrah

Farrah, The Fawcetted Browser
JavaScript
6
star
9

votaciones-senado-congreso.cl

Extracci贸n, parsing y conversi贸n de votaciones del senado de Chile a RDF
JavaScript
6
star
10

manifiesto-pensamiento-computacional

Manifiesto de qu茅 entendemos como programaci贸n y porqu茅 es importante
CSS
5
star
11

turtle-in-html

Bookmark to visualize RDF embedded in HTML as Turtle
JavaScript
4
star
12

docuspeakr

Easy live documentation of OWL ontologies
PHP
4
star
13

dspace_metadata_rdf

Tool for converting dspace metadata into RDF and viceversa
JavaScript
4
star
14

semanticogpl

Module for the Open Government Platform to expose metadata using semantic technologies
PHP
3
star
15

drupspeakr

Drupal module for integration with LODSPeaKr
PHP
2
star
16

recursos-nlp-castellano

Recursos para el procesamiento de lenguaje natural en castellano.
2
star
17

bioequivalencia

componentes para aplicaci贸n de bioequivalencia de medicamentos para hackathon cxc2012
JavaScript
2
star
18

WWW2012-mobile-webapp

Components and configuration for the mobile webapp for www2012
JavaScript
2
star
19

flod-demo-mediaparty2014

Demo de FLOD usado en la MediaParty2014
JavaScript
1
star
20

opendatavis

JavaScript
1
star
21

WWW-2012-Mobile-Assistant

Webapp that provides information about WWW2012 conference
1
star
22

0n.cl

Python
1
star
23

rest-server-data

rest server for data
JavaScript
1
star
24

POMELo2

New version of POMELo
PHP
1
star
25

mapa-educacion

Proyecto ganador de Scrapat贸n 2013
JavaScript
1
star
26

lodspk-bundle

Bundle including Fuseki and LODSPeaKr with GUI for administration
PHP
1
star
27

SRoIS

Semantic Representation of Internet Services
1
star
28

log2rdf

My scripts to parse my own custom logs. Don't use them, they are awful!
Python
1
star
29

ghi

Demo showing LODSPeaKr displaying data from the Global Hunger Index and DBpedia
PHP
1
star
30

rss2tweet

A bot that reads RSS feeds and publishes them as tweets
JavaScript
1
star
31

VocabForms

Instance editor base on a particular vocabulary (based on LODSPeaKr)
JavaScript
1
star
32

ghi-flod-app

FLOD app showing data for the Global Hunger Index
JavaScript
1
star
33

pmse

Poor Man's SPARQL Endpoint. When you just need to have a CORS-enabled SPARQL endpoint for small RDF files
Python
1
star
34

flod-tutorial-app

Flod application that shows the features of FLOD :-)
JavaScript
1
star
35

console.js

Simple javascript-based console in screen
JavaScript
1
star