DC.js Example Pie Chart

Developer
Size
2,016 Kb
Views
54,648

How do I make an dc.js example pie chart?

A simple template for testing out dc.js. What is a dc.js example pie chart? How do you make a dc.js example pie chart? This script and codes were developed by Alex Vazquez on 14 September 2022, Wednesday.

DC.js Example Pie Chart Previews

DC.js Example Pie Chart - Script Codes HTML Codes

<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>DC.js Example Pie Chart</title> <link rel='stylesheet prefetch' href='https://s3-us-west-2.amazonaws.com/s.cdpn.io/2/dc.css'> <link rel="stylesheet" href="css/style.css">
</head>
<body> <h2>Pie Chart</h2>
<div id="test"></div> <script src='https://d3js.org/d3.v3.min.js'></script>
<script src='https://s3-us-west-2.amazonaws.com/s.cdpn.io/2/crossfilter.js'></script>
<script src='https://s3-us-west-2.amazonaws.com/s.cdpn.io/2/dc.js'></script> <script src="js/index.js"></script>
</body>
</html>

DC.js Example Pie Chart - Script Codes CSS Codes

* { margin: 25px;
}

DC.js Example Pie Chart - Script Codes JS Codes

var chart = dc.pieChart("#test");
var data = [ { 'Expt': 1, 'Run': 1, 'Speed': 850, 'title': 'Title1' }, { 'Expt': 1, 'Run': 2, 'Speed': 740, 'title': 'Title2' }, { 'Expt': 1, 'Run': 3, 'Speed': 900, 'title': 'Title3' }, { 'Expt': 1, 'Run': 4, 'Speed': 1070, 'title': 'Title4' }
];
var ndx = crossfilter(data), runDimension = ndx.dimension(function(d) { return d.title; }); speedSumGroup = runDimension.group().reduceSum(function(d) { console.log(d); return d.Speed * d.Run; }); chart .width(568) .height(580) .slicesCap(4) .innerRadius(10) .dimension(runDimension) .group(speedSumGroup) // by default, pie charts will use group.key as the label .renderLabel(true) .label(function (d) { console.log('label'); console.log(d); return d.key.toUpperCase(); }); chart.render();
DC.js Example Pie Chart - Script Codes
DC.js Example Pie Chart - Script Codes
Home Page Home
Developer Alex Vazquez
Username quezo
Uploaded September 14, 2022
Rating 3
Size 2,016 Kb
Views 54,648
Do you need developer help for DC.js Example Pie Chart?

Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!

Alex Vazquez (quezo) Script Codes
Create amazing captions with AI!

Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!