_colorScale(movie) { return d3 .scaleOrdinal() .domain(['movie1', 'movie2', 'movie3', 'movie4', 'movie5', 'movie6']) .range(d3.schemeCategory10)(movie); }
constructor() { super() this.state = { circles: [] }; this.color = d3.scaleOrdinal(d3.schemeCategory10); this.calculateCircles.bind(this); this.renderCircle.bind(this); }
// Filter by identity // export function uniques(data, name) { // const uniques = []; // data.forEach((d) => { // if (uniques.indexOf(name(d)) < 0) { // uniques.push(name(d)); // } // }); // return uniques; // } export function nameId(data, name) { const uniqueNames = uniques(data, name); return d3.scaleOrdinal() .domain(uniqueNames) .range(d3.range(uniqueNames.length)); }
const AnimatedPiechart = ({ x, y, r, data }) => { let pie = d3.pie() .value((d) => d.value)(data) .sort((a, b) => d3.ascending(a.data.i, b.data.i)), translate = `translate(${x}, ${y})`, colors = d3.scaleOrdinal(d3.schemeCategory10); return ( <g transform={translate}> {pie.map((d, i) => ( <Arc key={`arc-${i}`} data={d} innerRadius="0" outerRadius={r} color={colors(d.data.i)} /> ))} </g> ); }
render(){ const {x,y,r,data} = this.props; let pie = d3.pie() .value((d)=>(d.value))(data) .sort((a,b)=>d3.ascending(a.data.i,b.data.i)); let translate = `translate(${x},${y})`; let colors = d3.scaleOrdinal(d3.schemeCategory10); return ( <g transform={translate}> { pie.map((d,i)=>( <Arc key={i} data={d} innerRadius="0" outerRadius={r} color={colors(d.data.i)}/> )) } </g> ); }
constructor() { super(); this.state = { nodes: [], links: [], highlight: [], innerDimension: 0 }; this.colorScheme = d3.scaleOrdinal(d3.schemeCategory20b); this.renderRow = this.renderRow.bind(this); this.renderColumn = this.renderColumn.bind(this); this.onCellHover = this.onCellHover.bind(this); this.sortMatrix = this.sortMatrix.bind(this); }
function ordinalScales() { const data = d3.range(30); const colors = d3.scaleOrdinal(d3.schemeCategory10); const points = d3.scalePoint() .domain(data) const categoryScheme = `schemeCategory${scheme}`; const selector = `rect.scheme-${scheme}`; const categoryColor = d3.scaleOrdinal(d3[categoryScheme]);
.text("a simple tooltip"); const color = d3.scaleOrdinal() .range(["red", "green", "blue", "#6b486b", "#a05d56", "#d0743c", "#ff8c00"]);
this.ref = ref; this.format = d3.format('.2f'); this.colors = d3.scaleOrdinal(d3.schemeCategory10); this.createPie = d3 .pie()
const radius = Math.min(width, height) / 2; var color = d3.scaleOrdinal([ '#98abc5', '#8a89a6',
var color = d3.scaleOrdinal(d3.schemeCategory20c);
_depthScale(depth) { return d3 .scaleOrdinal() .domain([0, 1, 2]) .range(d3.schemeCategory10)(depth); }
_depthScale(depth) { return d3 .scaleOrdinal() .domain([0, 1, 2]) .range(d3.schemeCategory10)(depth); }
_depthScale(depth) { return d3 .scaleOrdinal() .domain([0, 1, 2]) .range(d3.schemeCategory10)(depth); }
_colorScale(movie) { return d3 .scaleOrdinal() .domain(['movie1', 'movie2', 'movie3', 'movie4', 'movie5', 'movie6']) .range(d3.schemeCategory10)(movie); }