Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
d3kit-gridmap
Advanced tools
Introduction | Demo | API Reference
A tile grid map component built on top of d3Kit
Note: If you are upgrading from v0.x.x to v1.x.x, this library now return the constructor d3KitGridmap
instead of d3Kit
. Please see the change logs for more detail.
npm install d3kit-gridmap --save
or
bower install d3kit-gridmap --save
For example, to draw a grid map of the US, create a grid map component and pass gridmap-layout-usa as the layout. View source of this demo for example.
var chart = new d3KitGridmap('#usa', {
col: function(d){return d.x;},
row: function(d){return d.y;},
fill: function(d){return color(d.name.length);}
})
.data(gridmapLayoutUsa)
.resizeToFitMap();
For more detailed usage please refer to the API Reference.
d3Kit-gridmap does not come with layout, which is an Array of tiles and their positions, which make it can be reused for a map of any region or country.
The layout has to be passed to the chart by calling chart.data(layout)
for this component to show something on the screen.
In the simplest way, you can just pass a custom Array as your own layout.
chart.data([
{key: 'region1', col: 1, row 2},
{key: 'region2', col: 1, row 3},
...
]);
Or use these available layouts:
Adding this library via <script>
tag is the simplest way. By doing this, d3KitGridmap
is available in the global scope.
<script src="bower_components/d3/d3.min.js"></script>
<script src="bower_components/d3kit/dist/d3kit.min.js"></script>
<script src="bower_components/d3kit-gridmap/dist/d3kit-gridmap.min.js"></script>
If you use requirejs, this library support AMD out of the box.
require.config({
paths: {
d3: 'path/to/d3',
d3kit: 'path/to/d3kit',
'd3kit-gridmap': 'path/to/d3kit-gridmap'
}
});
require(['d3kit-gridmap'], function(d3KitGridmap) {
// do something with d3KitGridmap
});
This module will be available as d3Kit.Gridmap
.
This library also supports usage in commonjs style.
var d3KitGridmap = require('d3kit-gridmap');
// do something with d3KitGridmap
Krist Wongsuphasawat / @kristw
Copyright 2016 Krist Wongsuphasawat. Licensed under the Apache License Version 2.0
FAQs
A grid map component based on d3kit
The npm package d3kit-gridmap receives a total of 0 weekly downloads. As such, d3kit-gridmap popularity was classified as not popular.
We found that d3kit-gridmap demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.