Get started with dc CDN
Apache-2.0 licensed
DC.js: Web data visualization toolkit, D3.js-based, simplifies data handling and chart creation.
Tags:- visualization
- svg
- animation
- canvas
- chart
- dimensional
- crossfilter
- d3
Stable version
Copied!
How to start using dc CDN
<!DOCTYPE html>
<html>
<head>
<title>Get started with dc CDN - cdnhub.io</title>
<script src="https://cdn.cdnhub.io/dc/4.2.7/dc.min.js"></script>
<style>
#chart { width: 600px; height: 400px; }
</style>
</head>
<body>
<script>
dc.scripts(["https://cdnjs.cloudflare.com/ajax/libs/crossfilter/1.5.0/crossfilter.min.js"]);
// Sample data
var data = [
{ category: "Fruit", sales: 120 },
{ category: "Fruit", sales: 110 },
{ category: "Vegetables", sales: 150 },
{ category: "Vegetables", sales: 130 },
{ category: "Fruit", sales: 100 },
{ category: "Vegetables", sales: 160 }
];
// Initialize Crossfilter
var cf = crossfilter(data);
// Create a dimension and group
var dimCategory = cf.dimension(function(d) { return d.category; });
var grpSales = dimCategory.group();
// Create a chart
var chart = dc.barChart("#chart");
// Set the data source and dimensions
chart
.width(600)
.height(400)
.margins({top: 20, right: 20, bottom: 30, left: 40})
.dimension(dimCategory)
.group(grpSales)
.x(d3.scaleBand().rangeRound([0, 600]))
.xUnits(dc.units.ordinal)
.yAxisLabel("Sales")
.title(function(d) { return d.key + ": " + d.value; })
.render();
// Update the chart with the data
chart.redrawAll();
</script>
</body>
</html>
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
All versions
0.4.0
0.5.0
0.6.0
0.7.0
0.7.1
0.8.0
0.8.1
0.9.0
0.9.1
1.0.0
1.1.0
1.2.0
1.3.0
1.4.0
1.5.0
1.6.0
1.7.0
1.7.1
1.7.2
1.7.3
1.7.4
1.7.5
2.0.0
2.0.0-alpha
2.0.0-alpha.2
2.0.0-alpha.3
2.0.0-alpha.4
2.0.0-alpha.5
2.0.0-beta.1
2.0.0-beta.10
2.0.0-beta.11
2.0.0-beta.12
2.0.0-beta.14
2.0.0-beta.18
2.0.0-beta.19
2.0.0-beta.20
2.0.0-beta.21
2.0.0-beta.22
2.0.0-beta.23
2.0.0-beta.25
2.0.0-beta.26
2.0.0-beta.27
2.0.0-beta.28
2.0.0-beta.29
2.0.0-beta.3
2.0.0-beta.30
2.0.0-beta.31
2.0.0-beta.32
2.0.0-beta.33
2.0.0-beta.9
2.0.1
2.0.2
2.0.3
2.0.4
2.0.5
2.1.0
2.1.0-dev
2.1.1
2.1.10
2.1.2
2.1.3
2.1.4
2.1.5
2.1.6
2.1.7
2.1.8
2.1.9
2.2.0
2.2.1
2.2.2
3.0.0
3.0.0-beta.1
3.0.0-beta.2
3.0.10
3.0.11
3.0.12
3.0.2
3.0.3
3.0.4
3.0.5
3.0.6
3.0.7
3.0.8
3.0.9
3.1.0
3.1.1
3.1.2
3.1.3
3.1.4
3.1.5
3.1.6
3.1.7
3.1.8
3.1.9
3.2.0
3.2.1
4.0.0
4.0.0-beta.2
4.0.0-beta.3
4.0.0-beta.4
4.0.0-beta.5
4.0.1
4.0.2
4.0.3
4.0.4
4.0.5
4.1.0
4.1.1
4.2.0
4.2.3
4.2.4
4.2.5
4.2.6
*** 4.2.7
5.0.0-alpha0