react-solidgauge
Advanced tools
Comparing version 1.0.14 to 1.0.15
@@ -48,6 +48,6 @@ import React, { Component } from 'react'; | ||
}} | ||
onClick={this.onClick} | ||
> | ||
<SolidGauge | ||
responsive | ||
selectable | ||
pathWidth={0.10} | ||
@@ -54,0 +54,0 @@ pathMargin={0.05} |
{ | ||
"name": "react-solidgauge", | ||
"version": "1.0.14", | ||
"version": "1.0.15", | ||
"description": "A Small React-D3 solid gauge chart inspired by amcharts", | ||
@@ -62,4 +62,4 @@ "main": "dist/index.js", | ||
"react-dom": "^15.4.1", | ||
"react-offcharts-core": "^0.1.2" | ||
"react-offcharts-core": "^0.1.6" | ||
} | ||
} |
@@ -16,2 +16,4 @@ import React, { Component, PropTypes } from 'react'; | ||
endAngle: PropTypes.number, | ||
selectable: PropTypes.bool, | ||
onSelect: PropTypes.func, | ||
} | ||
@@ -21,2 +23,5 @@ | ||
this.appendHover(); | ||
if (this.props.selectable) { | ||
this.appendSelect(); | ||
} | ||
} | ||
@@ -27,2 +32,12 @@ | ||
} | ||
appendSelect() { | ||
const el = select(this.container); | ||
el | ||
.selectAll(`path.${ch.MOUSE_PATH}`) | ||
.on('click', (d, i, p) => { | ||
console.log(p[i]); | ||
}); | ||
} | ||
appendHover() { | ||
@@ -43,2 +58,9 @@ const el = select(this.container); | ||
const mouseText = tool.select('text'); | ||
mouseText | ||
.select('tspan.label') | ||
.text(label); | ||
mouseText | ||
.select('tspan.value') | ||
.text(`${Math.floor(value)}%`); | ||
const textLength = dh.getTextLength(mouseText.node()); | ||
@@ -63,9 +85,3 @@ mw = textLength; | ||
mouseText | ||
.select('tspan.label') | ||
.text(label); | ||
mouseText | ||
.select('tspan.value') | ||
.text(`${Math.floor(value)}%`); | ||
tool | ||
@@ -72,0 +88,0 @@ .select('path') |
@@ -101,10 +101,16 @@ import React, { Component, PropTypes } from 'react'; | ||
} | ||
endCircle.attr('opacity', '1'); | ||
return (t) => { | ||
thisArc.endAngle((inter(t))); | ||
const newArc = dh.doubleArc(thisArc); | ||
endC.attr('transform', `translate(${newArc.centroid()})`); | ||
return thisArc(); | ||
}; | ||
}) | ||
.on('end', (d, i) => { | ||
if (this.props.selectable && i === this.props.values.length - 1) { | ||
this.appendSelectOnPaths(); | ||
} | ||
}); | ||
@@ -111,0 +117,0 @@ } |
@@ -44,2 +44,3 @@ import React, { PropTypes } from 'react'; | ||
mouseStrokeWidth={props.mouseStrokeWidth} | ||
selectable={props.selectable} | ||
/> | ||
@@ -81,2 +82,3 @@ </ReactIf> | ||
mouseStrokeWidth: PropTypes.number, | ||
selectable: PropTypes.bool, | ||
shadow: PropTypes.shape({ | ||
@@ -83,0 +85,0 @@ id: PropTypes.string, |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
62804
1520
Updatedreact-offcharts-core@^0.1.6