JSFiddle - React, Tailwind, and code Playground

by Ashokaditya Mohanty

HTML

<script type="text/javascript" src="https://rawgithub.com/NickQiZhu/dc.js/master/web/js/crossfilter.js"></script>

JavaScript

var data = crossfilter([
  // Fact data.
  { name: "Rusty",  type: "human", legs: 2 },
  { name: "Alex",   type: "human", legs: 2 },
  { name: "Lassie", type: "dog",   legs: 4 },
  { name: "Suki",   type: "cat",   legs: 4 },
  { name: "Frida",  type: "cat",   legs: 4 },
  { name: "Polly",  type: "bird",  legs: 2 },
  { name: "Fiona",  type: "plant", legs: 0 }
]);

var facts = crossfilter(data);
var n = data.groupAll().reduceCount().value();
var legs = data.groupAll().reduceSum( function(fact) { return fact.legs; } ).value()

var typeDim = data.dimension(function(d) { return d.type; });
typeDim.filter("cat")
console.log(typeDim)


//console.log("There are "+ c + " cats in the house")

/* console.log(facts)
console.log("There are "+ n + " living beings in the house")
console.log("There are "+ legs + " legs in the house")*/