/d3-project

D3 Bubble Chart Project

Primary LanguageJavaScript

D3 Bubble Chart

Use a bubble chart to visualise data

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development purposes.

Prerequisites

Ensure that you have internet connection as the code requires some data from non-local repositories

Ensure that you have the latest version of node installed onto machine

Ensure that you have localhost port 8080 free; close programs like Skype/XAMPP

Ensure that you have a web browser such as Chrome, Brave Browser or Firefox

Enter this command into your terminal, ensure that you have this version of node installed

node --version

v12.14.10

If you see an error, the latest version of node can be installed from :

Node.js installation page

Installing

  1. Open git bash/cmd in the directory where you have the files installed
  2. In your html file make sure that you have a "div" container with the id "#vis"; this is where the visualisation will be drawn into
<div id="vis">
	
</div>
  1. Import your data onto the webpage either with d3 or other ajax request; you could also choose to pass a raw data object to the BubbleChart constructor
  2. In your javascipt file write the following code
let nameOfBubbleChart = new BubbleChart(data);

If you are using d3 remember to initalise the BubbleChart object within the callback function/ promise

d3.csv("path\to\csv", function(data){
	let nameOfBubbleChart = new BubbleChart(data);
});

Or you could pass raw data into bubbleChart

let nameOfBubblChart = new BubbleChart({"some_field":1234
"other_field": 456,
"foo_field", True	
});
  1. run command 'npm start' (Ignore the module not found error)
  2. View your visualislation at "localhost:8080/main" in your browser (Chrome, Firefox, Brave)
C:\Program Files\D3\> npm start

Built With

  • D3 - The web framework used
  • jQuery - Another web framework used
  • Wikipedia - Used to obtain a dataset

Authors

License

References

Images

Example 1 Vis 1 Example 2 Vis 2