ttdtrang / d3-colorbar

d3-colorbar plugin

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

d3-colorbar

This plugin provides a quick method to generate a color bar which can be created in a similar way to an axis, e.g.

var colorScale = d3.scaleSequential(d3.interpolateWarm).domain([-1,1]);
var cb = d3.colorbarV(colorScale, 20,100);
svg.append("g").call(cb);

Some examples

image

Installing

If you use NPM, npm install d3-colorbar. Otherwise, download the latest release.

API Reference

# d3.colorbarH(colorScale, width, height)

Create a horizontal color bar of size width x height that maps the given colorScale.

# d3.colorbarV(colorScale, width, height)

Create a vertical color bar of size width x height that maps the given colorScale.

colorbar.tickValues(array)

Set the tick values to be shown on the color bar.

About

d3-colorbar plugin

License:BSD 3-Clause "New" or "Revised" License


Languages

Language:JavaScript 59.3%Language:HTML 40.7%