update(props) { this.x = d3.scaleLinear() .rangeRound([0,props.width.inner]); const bins = d3.histogram() .domain(this.x.domain()) .thresholds(this.x.ticks(20)) (props.data); this.y = d3.scaleLinear() .domain([0, d3.max(bins.map(d => d.length))]) .range([props.height.inner,0]); this.setState({ bins }); }
updateD3(props) { this.histogram .thresholds(props.bins) .value(props.value); const bars = this.histogram(props.data), counts = bars.map((d) => d.length); this.widthScale .domain([d3.min(counts), d3.max(counts)]) .range([0, props.width-props.axisMargin]); this.yScale .domain([0, d3.max(bars, (d) => d.x1)]) .range([0, props.height-props.y-props.bottomMargin]); }
d3.max(processedData.map((datum) => { return datum.year }))
drawChart(){ const data = this.props.data; const x = d3.scaleLinear() .domain([0, d3.max(data)]) .range([0, 400]) d3.select(this.refs.myDiv) .selectAll("div") .data(data) .enter() .append("div") .style("width", d => x(d) + "px") .text(d => d); }
d3 .scaleLinear() .range([70, 10]) .domain([0, d3.max(stackedValues[stackedValues.length - 1], dp => dp[1])])
d3 .scale.linear() .domain([0, d3.max(data, function(d){return d.y;}) * (6/5)]) .range([height, 0])
d3.scaleMagma() .domain([d3.max(bins, function(d) { return d.length; }), 0])
updateD3(props) { this.yScale .domain([0, d3.max(props.data, props.value)]) .range([0, props.height-props.y-props.bottomMargin]); }
d3.max(processedData.map((datum) => { return datum.people }))
d3.scaleLinear() .domain([0, d3.max(bins, d => d.length)]) .range([this.innerHeight - 10, 0])
d3.max(processedData.map((datum) => { return datum.age }))
updateD3(props) { this.yScale .domain([0, d3.max(props.data, props.value)]) .range([0, props.height-props.y-props.bottomMargin]); }
updateD3(props) { this.histogram .thresholds(props.bins) .value(props.value); const bars = this.histogram(props.data), counts = bars.map((d) => d.length); this.widthScale .domain([d3.min(counts), d3.max(counts)]) .range([0, props.width-props.axisMargin]); this.yScale .domain([0, d3.max(bars, (d) => d.x1)]) .range([0, props.height-props.y-props.bottomMargin]); }