Gathering detailed insights and metrics for d3plus-plot
Gathering detailed insights and metrics for d3plus-plot
Gathering detailed insights and metrics for d3plus-plot
Gathering detailed insights and metrics for d3plus-plot
d3plus-common
Common functions and methods used across D3plus modules.
d3plus
Data visualization made easy. A javascript library that extends the popular D3.js to enable fast and beautiful visualizations.
d3plus-text
A smart SVG text box with line wrapping and automatic font size scaling.
d3plus-color
Color functions that extent the ability of d3-color.
npm install d3plus-plot
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
7 Stars
858 Commits
5 Watching
4 Branches
10 Contributors
Updated on 24 Oct 2024
JavaScript (100%)
Cumulative downloads
Total Downloads
Last day
-61.1%
63
Compared to previous day
Last week
1.6%
645
Compared to previous week
Last month
-1.9%
3,032
Compared to previous month
Last year
-5%
32,980
Compared to previous year
A reusable javascript x/y plot built on D3.
If using npm, npm install d3plus-plot
. Otherwise, you can download the latest release from GitHub or load from a CDN.
1import modules from "d3plus-plot";
d3plus-plot can be loaded as a standalone library or bundled as part of D3plus. ES modules, AMD, CommonJS, and vanilla environments are supported. In vanilla, a d3plus
global is exported:
1<script src="https://cdn.jsdelivr.net/npm/d3plus-plot@1"></script> 2<script> 3 console.log(d3plus); 4</script>
Live examples can be found on d3plus.org, which includes a collection of example visualizations using d3plus-react. These examples are powered by the d3plus-storybook repo, and PRs are always welcome. :beers:
This is a global class, and extends all of the methods and functionality of Plot
.
# new AreaPlot()
Creates an area plot based on an array of data.
the equivalent of calling:
1new d3plus.Plot() 2 .baseline(0) 3 .discrete("x") 4 .shape("Area")
This is a global class, and extends all of the methods and functionality of Plot
.
# new BarChart()
Creates a bar chart based on an array of data.
the equivalent of calling:
1new d3plus.Plot() 2 .baseline(0) 3 .discrete("x") 4 .shape("Bar")
This is a global class, and extends all of the methods and functionality of Plot
.
# new BoxWhisker()
Creates a simple box and whisker based on an array of data.
the equivalent of calling:
1new d3plus.Plot() 2 .discrete("x") 3 .shape("Box")
This is a global class, and extends all of the methods and functionality of Plot
.
# new BumpChart()
Creates a bump chart based on an array of data.
the equivalent of calling:
1new d3plus.Plot()
2 .discrete("x")
3 .shape("Line")
4 .x("x")
5 .y2(d => this._y(d))
6 .yConfig({
7 tickFormat: val => {
8 const data = this._formattedData;
9 const xDomain = this._xDomain;
10 const startData = data.filter(d => d.x === xDomain[0]);
11 const d = startData.find(d => d.y === val);
12 return this._drawLabel(d, d.i);
13 }
14 })
15 .y2Config({
16 tickFormat: val => {
17 const data = this._formattedData;
18 const xDomain = this._xDomain;
19 const endData = data.filter(d => d.x === xDomain[xDomain.length - 1]);
20 const d = endData.find(d => d.y === val);
21 return this._drawLabel(d, d.i);
22 }
23 })
24 .ySort((a, b) => b.y - a.y)
25 .y2Sort((a, b) => b.y - a.y)
This is a global class, and extends all of the methods and functionality of Plot
.
# new LinePlot()
Creates a line plot based on an array of data.
the equivalent of calling:
1new d3plus.Plot() 2 .discrete("x") 3 .shape("Line")
This is a global class, and extends all of the methods and functionality of Viz
.
Viz
# new Plot()
Creates an x/y plot based on an array of data.
# Plot.annotations(annotations) <>
Allows drawing custom shapes to be used as annotations in the provided x/y plot. This method accepts custom config objects for the Shape class, either a single config object or an array of config objects. Each config object requires an additional parameter, the "shape", which denotes which Shape sub-class to use (Rect, Line, etc).
Additionally, each config object can also contain an optional "layer" key, which defines whether the annotations will be displayed in "front" or in "back" of the primary visualization shapes. This value defaults to "back" if not present.
This is a static method of Plot
, and is chainable with other methods of this Class.
# Plot.axisPersist([value]) <>
Determines whether the x and y axes should have their scales persist while users filter the data, the timeline being the prime example (set this to true
to make the axes stay consistent when the timeline changes).
This is a static method of Plot
, and is chainable with other methods of this Class.
# Plot.backgroundConfig([value]) <>
A d3plus-shape configuration Object used for styling the background rectangle of the inner x/y plot (behind all of the shapes and gridlines).
This is a static method of Plot
, and is chainable with other methods of this Class.
Sets the pixel space between each bar in a group of bars.
This is a static method of Plot
, and is chainable with other methods of this Class.
Sets the baseline for the x/y plot. If value is not specified, returns the current baseline.
This is a static method of Plot
, and is chainable with other methods of this Class.
Determines whether or not to add additional padding at the ends of x or y scales. The most commone use for this is in Scatter Plots, so that the shapes do not appear directly on the axis itself. The value provided can either be true
or false
to toggle the behavior for all shape types, or a keyed Object for each shape type (ie. {Bar: false, Circle: true, Line: false}
).
This is a static method of Plot
, and is chainable with other methods of this Class.
Sets the confidence to the specified array of lower and upper bounds.
This is a static method of Plot
, and is chainable with other methods of this Class.
Can be called with accessor functions or static keys:
1 var data = {id: "alpha", value: 10, lci: 9, hci: 11}; 2 ... 3 // Accessor functions 4 .confidence([function(d) { return d.lci }, function(d) { return d.hci }]) 5 6 // Or static keys 7 .confidence(["lci", "hci"])
# Plot.confidenceConfig([value]) <>
If value is specified, sets the config method for each shape rendered as a confidence interval and returns the current class instance.
This is a static method of Plot
, and is chainable with other methods of this Class.
Sets the discrete axis to the specified string. If value is not specified, returns the current discrete axis.
This is a static method of Plot
, and is chainable with other methods of this Class.
# Plot.discreteCutoff(value) <>
When the width or height of the chart is less than or equal to this pixel value, the discrete axis will not be shown. This helps produce slick sparklines. Set this value to 0
to disable the behavior entirely.
This is a static method of Plot
, and is chainable with other methods of this Class.
# Plot.groupPadding([value]) <>
Sets the pixel space between groups of bars.
This is a static method of Plot
, and is chainable with other methods of this Class.
# Plot.labelConnectorConfig([value]) <>
The d3plus-shape config used on the Line shapes created to connect lineLabels to the end of their associated Line path.
This is a static method of Plot
, and is chainable with other methods of this Class.
Draws labels on the right side of any Line shapes that are drawn on the plot.
This is a static method of Plot
, and is chainable with other methods of this Class.
# Plot.lineMarkerConfig(value) <>
Shape config for the Circle shapes drawn by the lineMarkers method.
This is a static method of Plot
, and is chainable with other methods of this Class.
# Plot.lineMarkers([value]) <>
Draws circle markers on each vertex of a Line.
This is a static method of Plot
, and is chainable with other methods of this Class.
A JavaScript sort comparator function that receives each shape Class (ie. "Circle", "Line", etc) as it's comparator arguments. Shapes are drawn in groups based on their type, so you are defining the layering order for all shapes of said type.
This is a static method of Plot
, and is chainable with other methods of this Class.
Sets the size of bubbles to the given Number, data key, or function.
This is a static method of Plot
, and is chainable with other methods of this Class.
Sets the size scale maximum to the specified number.
This is a static method of Plot
, and is chainable with other methods of this Class.
Sets the size scale minimum to the specified number.
This is a static method of Plot
, and is chainable with other methods of this Class.
Sets the size scale to the specified string.
This is a static method of Plot
, and is chainable with other methods of this Class.
If value is specified, toggles shape stacking. If value is not specified, returns the current stack value.
This is a static method of Plot
, and is chainable with other methods of this Class.
Sets the stack offset. If value is not specified, returns the current stack offset function.
This is a static method of Plot
, and is chainable with other methods of this Class.
Sets the stack order. If value is not specified, returns the current stack order function.
This is a static method of Plot
, and is chainable with other methods of this Class.
Sets the x accessor to the specified function or number. If value is not specified, returns the current x accessor.
This is a static method of Plot
, and is chainable with other methods of this Class.
Sets the x2 accessor to the specified function or number. If value is not specified, returns the current x2 accessor.
This is a static method of Plot
, and is chainable with other methods of this Class.
A pass-through to the underlying Axis config used for the x-axis. Includes additional functionality where passing "auto" as the value for the scale method will determine if the scale should be "linear" or "log" based on the provided data.
This is a static method of Plot
, and is chainable with other methods of this Class.
When the width of the chart is less than or equal to this pixel value, and the x-axis is not the discrete axis, it will not be shown. This helps produce slick sparklines. Set this value to 0
to disable the behavior entirely.
This is a static method of Plot
, and is chainable with other methods of this Class.
A pass-through to the underlying Axis config used for the secondary x-axis. Includes additional functionality where passing "auto" as the value for the scale method will determine if the scale should be "linear" or "log" based on the provided data.
This is a static method of Plot
, and is chainable with other methods of this Class.
Sets the x domain to the specified array. If value is not specified, returns the current x domain. Additionally, if either value of the array is undefined, it will be calculated from the data.
This is a static method of Plot
, and is chainable with other methods of this Class.
Sets the x2 domain to the specified array. If value is not specified, returns the current x2 domain. Additionally, if either value of the array is undefined, it will be calculated from the data.
This is a static method of Plot
, and is chainable with other methods of this Class.
Defines a custom sorting comparitor function to be used for discrete x axes.
This is a static method of Plot
, and is chainable with other methods of this Class.
Defines a custom sorting comparitor function to be used for discrete x2 axes.
This is a static method of Plot
, and is chainable with other methods of this Class.
Sets the y accessor to the specified function or number. If value is not specified, returns the current y accessor.
This is a static method of Plot
, and is chainable with other methods of this Class.
Sets the y2 accessor to the specified function or number. If value is not specified, returns the current y2 accessor.
This is a static method of Plot
, and is chainable with other methods of this Class.
A pass-through to the underlying Axis config used for the y-axis. Includes additional functionality where passing "auto" as the value for the scale method will determine if the scale should be "linear" or "log" based on the provided data. Note:* If a "domain" array is passed to the y-axis config, it will be reversed.
This is a static method of Plot
, and is chainable with other methods of this Class.
When the height of the chart is less than or equal to this pixel value, and the y-axis is not the discrete axis, it will not be shown. This helps produce slick sparklines. Set this value to 0
to disable the behavior entirely.
This is a static method of Plot
, and is chainable with other methods of this Class.
A pass-through to the underlying Axis config used for the secondary y-axis. Includes additional functionality where passing "auto" as the value for the scale method will determine if the scale should be "linear" or "log" based on the provided data.
This is a static method of Plot
, and is chainable with other methods of this Class.
Sets the y domain to the specified array. If value is not specified, returns the current y domain. Additionally, if either value of the array is undefined, it will be calculated from the data.
This is a static method of Plot
, and is chainable with other methods of this Class.
Sets the y2 domain to the specified array. If value is not specified, returns the current y2 domain. Additionally, if either value of the array is undefined, it will be calculated from the data.
This is a static method of Plot
, and is chainable with other methods of this Class.
Defines a custom sorting comparitor function to be used for discrete y axes.
This is a static method of Plot
, and is chainable with other methods of this Class.
Defines a custom sorting comparitor function to be used for discrete y2 axes.
This is a static method of Plot
, and is chainable with other methods of this Class.
This is a global class, and extends all of the methods and functionality of Viz
.
Viz
# new Radar()
Creates a radar visualization based on an array of data.
Sets the config method used for the radial spokes, circles, and labels.
This is a static method of Radar
, and is chainable with other methods of this Class.
Defines the value used as axis. If value is specified, sets the accessor to the specified metric function. If value is not specified, returns the current metric accessor.
This is a static method of Radar
, and is chainable with other methods of this Class.
# Radar.outerPadding([value]) <>
Determines how much pixel spaces to give the outer labels.
This is a static method of Radar
, and is chainable with other methods of this Class.
If value is specified, sets the value accessor to the specified function or number and returns the current class instance. If value is not specified, returns the current value accessor.
This is a static method of Radar
.
1function value(d) { 2 return d.value; 3}
This is a global class, and extends all of the methods and functionality of Area
.
# new StackedArea()
Creates a stacked area plot based on an array of data.
the equivalent of calling:
1new d3plus.AreaPlot() 2 .stacked(true)
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
no dangerous workflow patterns detected
Reason
license file detected
Details
Reason
6 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 5
Reason
dependency not pinned by hash detected -- score normalized to 3
Details
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
Found 0/30 approved changesets -- score normalized to 0
Reason
no SAST tool detected
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
Project has not signed or included provenance with any releases.
Details
Reason
12 existing vulnerabilities detected
Details
Score
Last Scanned on 2024-11-25
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More