Giter Club home page Giter Club logo

d3-boxplot's Issues

Whiskers going the wrong way

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.

How to implement without NPM?

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.