Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

d3plus-legend

Package Overview
Dependencies
Maintainers
1
Versions
99
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

d3plus-legend

A collection of chart legends and keys.

  • 0.4.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
621
decreased by-22.86%
Maintainers
1
Weekly downloads
 
Created
Source

d3plus-legend

NPM Release Build Status Dependency Status Slack

A collection of chart legends and keys.

Installing

If you use NPM, npm install d3plus-legend. Otherwise, download the latest release. The released bundle supports AMD, CommonJS, and vanilla environments. Create a custom bundle using Rollup or your preferred bundler. You can also load directly from d3plus.org:

<script src="https://d3plus.org/js/d3plus-legend.v0.4.full.min.js"></script>

API Reference

Classes

BaseClass
ScaleLegendBaseLegend
ShapeLegendBaseLegend

BaseClass

Kind: global class

new BaseClass()

Creates an SVG scale based on an array of data. If data is specified, immediately draws based on the specified array and returns the current class instance. If data is not specified on instantiation, it can be passed/updated after instantiation using the data method.

ScaleLegend ⇐ BaseLegend

Kind: global class
Extends: BaseLegend

new ScaleLegend()

Creates an SVG scale based on an array of data. If data is specified, immediately draws based on the specified array and returns the current class instance. If data is not specified on instantiation, it can be passed/updated after instantiation using the data method.

ScaleLegend.render([callback])

Renders the current ScaleLegend to the page. If a callback is specified, it will be called once the legend is done drawing.

Kind: static method of ScaleLegend

ParamType
[callback]function

ScaleLegend.align([value])

If value is specified, sets the horizontal alignment to the specified value and returns the current class instance. If value is not specified, returns the current horizontal alignment.

Kind: static method of ScaleLegend

ParamTypeDefaultDescription
[value]String"center"Supports "left" and "center" and "right".

ScaleLegend.domain([value])

If value is specified, sets the scale domain of the legend and returns the current class instance. If value is not specified, returns the current scale domain.

Kind: static method of ScaleLegend

ParamTypeDefault
[value]Array[0, 10]

ScaleLegend.orient([orient])

If orient is specified, sets the orientation of the shape and returns the current class instance. If orient is not specified, returns the current orientation.

Kind: static method of ScaleLegend

ParamTypeDefaultDescription
[orient]String"bottom"Supports "top", "right", "bottom", and "left" orientations.

ScaleLegend.scale([value])

If value is specified, sets the scale of the legend and returns the current class instance. If value is not specified, returns the current this._d3Scale

Kind: static method of ScaleLegend

ParamTypeDefault
[value]String"linear"

ScaleLegend.ticks([value])

If value is specified, sets the tick values of the legend and returns the current class instance. If value is not specified, returns the current tick values, which by default are interpreted based on the domain and the available width.

Kind: static method of ScaleLegend

ParamType
[value]Array

ScaleLegend.tickSize([value])

If value is specified, sets the tick size of the legend and returns the current class instance. If value is not specified, returns the current tick size.

Kind: static method of ScaleLegend

ParamTypeDefault
[value]Number5

ShapeLegend ⇐ BaseLegend

Kind: global class
Extends: BaseLegend

new ShapeLegend()

Creates an SVG shape legend based on an array of data. If data is specified, immediately draws based on the specified array and returns the current class instance. If data is not specified on instantiation, it can be passed/updated after instantiation using the data method.

ShapeLegend.textBoxConfig([config])

If config is specified, sets the methods that correspond to the key/value pairs for each shape and returns the current class instance. If config is not specified, returns the current shape configuration.

Kind: static method of ShapeLegend

ParamTypeDefault
[config]Object{}

ShapeLegend.render([callback])

Renders the current ShapeLegend to the page. If a callback is specified, it will be called once the legend is done drawing.

Kind: static method of ShapeLegend

ParamType
[callback]function

ShapeLegend.align([value])

If value is specified, sets the horizontal alignment to the specified value and returns the current class instance. If value is not specified, returns the current horizontal alignment.

Kind: static method of ShapeLegend

ParamTypeDefaultDescription
[value]String"center"Supports "left" and "center" and "right".

ShapeLegend.data([data])

If data is specified, sets the data array to the specified array and returns the current class instance. If data is not specified, returns the current data array. A shape key will be drawn for each object in the array.

Kind: static method of ShapeLegend

ParamTypeDefault
[data]Array[]

ShapeLegend.id([value])

If value is specified, sets the id accessor to the specified function and returns the current class instance. If value is not specified, returns the current id accessor.

Kind: static method of ShapeLegend

ParamType
[value]function

Example

function value(d) {
  return d.id;
}

ShapeLegend.label([value])

If value is specified, sets the label accessor to the specified function or string and returns the current class instance. If value is not specified, returns the current label accessor, which is the id accessor by default.

Kind: static method of ShapeLegend

ParamType
[value]function | String

ShapeLegend.orient([orient])

If orient is specified, sets the orientation of the shape and returns the current class instance. If orient is not specified, returns the current orientation.

Kind: static method of ShapeLegend

ParamTypeDefaultDescription
[orient]String"horizontal"Supports "horizontal" and "vertical" orientations.

ShapeLegend.shape([value])

If value is specified, sets the shape accessor to the specified function or string and returns the current class instance. If value is not specified, returns the current shape accessor.

Kind: static method of ShapeLegend

ParamTypeDefault
[value]function | String"Rect"

ShapeLegend.shapeConfig([config])

If config is specified, sets the methods that correspond to the key/value pairs for each shape and returns the current class instance. If config is not specified, returns the current shape configuration.

Kind: static method of ShapeLegend

ParamTypeDefault
[config]Object{}

ShapeLegend.verticalAlign([value])

If value is specified, sets the vertical alignment to the specified value and returns the current class instance. If value is not specified, returns the current vertical alignment.

Kind: static method of ShapeLegend

ParamTypeDefaultDescription
[value]String"middle"Supports "top" and "middle" and "bottom".
Documentation generated on Sat, 13 Aug 2016 14:48:17 GMT

Keywords

FAQs

Package last updated on 13 Aug 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc