Files
DefinitelyTyped/nvd3/nvd3-test-boxplot.ts
Tom Wanzek 0500bd3558 Replace D3 Legacy (#12256)
* Replace D3 v3 definition with D3 v4 (bundle)
* Replaces the legacy D3 v3 definitions in `d3` with a definition file representing the D3 version 4 standard bundle
* Add `package.json` file with legacy dependency to @types/d3 version >=3.5.36 <4.0.0

* Updated tsconfig.json, package.json, versions
* Updated tsconfig.json to control typings resolution for D3 v3
* Updated package.json to use caret notation of D3 typings
* Updated certain affected definitions header comments with version numbers, where version number was missing buit seemed reasonably ascertainable as latest.
* Added comments to each affected definition file with TODO once upgrade to D3 v4 is considered

* Chore changes as per review.

* Removed TODO "upgrade-to-v4" comments

* Removed added empty lines.
2016-10-27 13:35:57 -07:00

58 lines
1.2 KiB
TypeScript

/// <reference types="d3" />
nv.addGraph(function() {
var chart = nv.models.boxPlotChart()
.x(function(d) { return d.label })
.y(function(d) { return d.values.Q3 })
.staggerLabels(true)
.maxBoxWidth(75) // prevent boxes from being incredibly wide
.yDomain([0, 500])
;
d3.select('#chart1 svg')
.datum(exampleData())
.call(chart);
nv.utils.windowResize(chart.update);
return chart;
});
function exampleData() {
return [
{
label: "Sample A",
values: {
Q1: 120,
Q2: 150,
Q3: 200,
whisker_low: 115,
whisker_high: 210,
outliers: [50, 100, 225]
},
},
{
label: "Sample B",
values: {
Q1: 300,
Q2: 350,
Q3: 400,
whisker_low: 225,
whisker_high: 425,
outliers: [175]
},
},
{
label: "Sample C",
values: {
Q1: 50,
Q2: 100,
Q3: 125,
whisker_low: 25,
whisker_high: 175,
outliers: [0]
},
}
];
}