akngs / d3-boxplot Goto Github PK
View Code? Open in Web Editor NEWd3js box plot plugin
License: ISC License
d3js box plot plugin
License: ISC License
For small datasets with outliers the whiskers sometimes end up inside the box. For example
boxplotStats([0, 0.8, 0.8, 1]).whiskers
produces
[ { "start": 0.8, "end": 0.6000000000000001 }, { "start": 1, "end": 0.8500000000000001 } ]
and d3box.boxplotStats([0, 0.8, 0.8, 1]).boxes
produces
[ { "start": 0.6000000000000001, "end": 0.8 }, { "start": 0.8, "end": 0.8500000000000001 } ]
Making the left whisker start at the median point.
Hi there
Thanks for your great work!
I would like to use your code to make a boxplot on my website, if that's ok?
I am, however, having difficulties using the code. I am not using NPM, Angular, React or anything, just standard html and js files. I am also quite new to GitHub, sorry for that.
I downloaded the files and tried the code snippet given as an example, but it didn't work for me:
<!DOCTYPE html>
<meta charset="utf-8">
<html>
<head>
<title>Boxplot</title>
</head>
<body>
<div id="svg_container"></div>
<script src="https://d3js.org/d3.v7.min.js"></script>
<script src="boxplot.js"></script>
<script>
var margin = {top: 10, right: 30, bottom: 30, left: 40},
width = 400 - margin.left - margin.right,
height = 400 - margin.top - margin.bottom;
var svg = d3.select("#svg_container")
.append("svg")
.attr("width", width + margin.left + margin.right)
.attr("height", height + margin.top + margin.bottom)
.append("g")
.attr("transform",
"translate(" + margin.left + "," + margin.top + ")");
let data = [1, 2, 3, 4, 5]
let stats = d3.boxplotStats(data)
let x = d3.scaleLinear()
.domain(d3.extent(data))
.range([0, 300])
let plot = d3.boxplot().scale(x)
d3.select('svg').datum(stats).call(plot)
</script>
</body>
</html>
Can you please tell what I need to do to make use of the code files? Thanks.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.