Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions src/Sparklines.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ class Sparklines extends PureComponent {
style: PropTypes.object,
min: PropTypes.number,
max: PropTypes.number,
onMouseMove: PropTypes.func
onMouseMove: PropTypes.func,
className: PropTypes.string
};

static defaultProps = {
Expand All @@ -32,15 +33,16 @@ class Sparklines extends PureComponent {
height: 60,
//Scale the graphic content of the given element non-uniformly if necessary such that the element's bounding box exactly matches the viewport rectangle.
preserveAspectRatio: 'none', //https://www.w3.org/TR/SVG/coords.html#PreserveAspectRatioAttribute
margin: 2
margin: 2,
className: ''
};

constructor (props) {
super(props);
}

render() {
const { data, limit, width, height, svgWidth, svgHeight, preserveAspectRatio, margin, style, max, min} = this.props;
const { data, limit, width, height, svgWidth, svgHeight, preserveAspectRatio, margin, style, max, min, className} = this.props;

if (data.length === 0) return null;

Expand All @@ -51,7 +53,7 @@ class Sparklines extends PureComponent {
if (svgHeight > 0) svgOpts.height = svgHeight;

return (
<svg {...svgOpts}>
<svg className={className} {...svgOpts}>
{
React.Children.map(this.props.children, function(child) {
return React.cloneElement(child, { data, points, width, height, margin });
Expand Down