This commit is contained in:
Cmdr McDonald
2017-03-17 12:34:36 +00:00
parent 91cab5a4f1
commit 7259a666eb
4 changed files with 13 additions and 12 deletions

8
d3.min.js vendored

File diff suppressed because one or more lines are too long

View File

@@ -77,7 +77,7 @@
"less": "^2.5.3",
"less-loader": "^2.2.1",
"react-addons-test-utils": "^15.0.1",
"@types/react-measure": "^0.4.6",
"react-measure": "^1.4.6",
"react-testutils-additions": "^15.1.0",
"rimraf": "^2.4.3",
"rollup": "0.36",

View File

@@ -57,8 +57,8 @@ export default class PieChart extends Component {
return (
<g key={`group-${i}`}>
<path key={`arc-${i}`} d={this.arc(d)} style={{ fill: this.colors[i] }} />
<text key={`label-${i}`} transform={labelTranslate} stroke={LABEL_COLOUR} strokeWidth='1px' fill='None' textAnchor='middle'>{d.value}</text>
<text key={`key-${i}`} transform={keyTranslate} style={{ stroke: this.colors[i], strokeWidth:'1px', fill:'None' }} textAnchor='middle'>{d.data.label}</text>
<text key={`label-${i}`} transform={labelTranslate} style={{ strokeWidth: '0px', fill: LABEL_COLOUR }} textAnchor='middle'>{d.value}</text>
<text key={`key-${i}`} transform={keyTranslate} style={{ strokeWidth:'0px', fill: this.colors[i] }} textAnchor='middle'>{d.data.label}</text>
</g>
);
}

View File

@@ -102,8 +102,8 @@ export default class VerticalBarChart extends Component {
.attr('text-anchor', 'middle')
.attr('x', 100)
.attr('y', 100)
.attr('stroke', '#ffffff')
.attr('stroke-width', '1px')
.attr('stroke-width', '0px')
.attr('fill', '#ffffff')
.attr('x', d => this.x(d.label) + this.x.bandwidth() / 2)
.attr('y', d => this.y(d.value) + 15)
.text(d => d.value);
@@ -115,16 +115,17 @@ export default class VerticalBarChart extends Component {
*/
render() {
const { width } = this.state.dimensions;
const translate = `translate(${margin.left}, ${margin.top})`;
const height = width * ASPECT;
this._renderGraph(this.props);
return (
<Measure width='100%' whitelist={['width', 'top']} onMeasure={ (dimensions) => { this.setState({ dimensions }); }}>
<div width={width} height={width * ASPECT}>
<div width={width} height={height}>
{ this.x ?
<svg ref={ref => this.svg = ref} width={width} height={width * ASPECT} transform={translate}>
<svg ref={ref => this.svg = ref} width={width} height={height} transform={translate}>
<g transform={translate}></g>
</svg> : null }
</div>