You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+5-1
Original file line number
Diff line number
Diff line change
@@ -41,7 +41,11 @@ data - the data set used to build the sparkline
41
41
42
42
limit - optional, how many data points to display at once
43
43
44
-
width, height - dimensions of the component
44
+
width, height - dimensions of the generated sparkline in the SVG viewbox. This will be automatically scaled (i.e. responsive) inside the parent container by default.
45
+
46
+
svgWidth, svgHeight - If you want absolute dimensions instead of a responsive component set these attributes.
47
+
48
+
[preserveAspectRatio](https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/preserveAspectRatio) - default: 'none', set this to modify how the sparkline should scale
Copy file name to clipboardExpand all lines: src/Sparklines.js
+14-2
Original file line number
Diff line number
Diff line change
@@ -14,6 +14,9 @@ class Sparklines extends React.Component {
14
14
limit: React.PropTypes.number,
15
15
width: React.PropTypes.number,
16
16
height: React.PropTypes.number,
17
+
svgWidth: React.PropTypes.number,
18
+
svgHeight: React.PropTypes.number,
19
+
preserveAspectRatio: React.PropTypes.string,
17
20
margin: React.PropTypes.number,
18
21
style: React.PropTypes.object,
19
22
min: React.PropTypes.number,
@@ -24,6 +27,8 @@ class Sparklines extends React.Component {
24
27
data: [],
25
28
width: 240,
26
29
height: 60,
30
+
//Scale the graphic content of the given element non-uniformly if necessary such that the element's bounding box exactly matches the viewport rectangle.
0 commit comments