Skip to content

Instantly share code, notes, and snippets.

@timelyportfolio
Created October 18, 2016 14:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save timelyportfolio/04832df8bad50a58e659707d3b8f423d to your computer and use it in GitHub Desktop.
Save timelyportfolio/04832df8bad50a58e659707d3b8f423d to your computer and use it in GitHub Desktop.
react-sparklines bar troubles
license: mit

Built with blockbuilder.org

While playing with react-sparklines in R, I noticed that the bars would not line up perfectly. This is a quick demo of the problem that I can hopefully help resolve with a quick pull request. I would be delighted to contribute to such a great package.

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<script src="https://unpkg.com/react@15.3.1/dist/react.min.js"></script>
<script src="https://unpkg.com/react-dom@15.3.2/dist/react-dom.min.js"></script>
<script src="https://unpkg.com/react-sparklines"></script>
</head>
<body style="background-color:white;">
<script>
ReactDOM.render(
React.createElement(
ReactSparklines.Sparklines,
{data:[175,245,180,180,180,205,215,230,150,150,245,175,264,335], svgHeight:300, svgWidth:500, min: 0, max:350, margin: 20},
React.createElement(
ReactSparklines.SparklinesBars,
{style:{stroke:"lightblue",strokeWidth:2}}
)
),
document.body
)
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment