Security News
The Risks of Misguided Research in Supply Chain Security
Snyk's use of malicious npm packages for research raises ethical concerns, highlighting risks in public deployment, data exfiltration, and unauthorized testing.
simple-sparkline-chart
Advanced tools
📈 Simple SparkLine Chart
A lightweight, customizable, and easy-to-use SparkLine chart library written in TypeScript.
DEMO 👀
🚀 Features
npm install simple-sparkline-chart
<script src="https://www.unpkg.com/simple-sparkline-chart"></script>
You can then use it via the global SimpleSparkLineChart:
<script>
new SimpleSparkLineChart(".chart");
</script>
<div
class="sparkline"
data-values="1,2,3,4,5,6,7"
data-width="200"
data-height="40"
></div>
<script>
new SimpleSparkLineChart(".sparkline");
</script>
This will create a basic SparkLine chart using the specified data-values.
<div
class="sparkline"
data-values="0.5,1.5,2.3,3.8,2.9,3.4"
data-width="300"
data-height="60"
data-color-stroke="#00f"
data-filled="true"
data-filled-opacity="0.3"
data-tooltip="true"
data-aria-label="My SparkLine Chart"
></div>
<script>
new SimpleSparkLineChart(".sparkline");
</script>
Attribute Type Default Description data-values string null A comma-separated list of values or JSON data. data-width number 200 The width of the chart. data-height number 40 The height of the chart. data-color-stroke string #8956ff The color of the line (stroke). data-filled boolean false Whether to fill the area under the line. data-filled-opacity number 0.2 Opacity of the fill. data-tooltip boolean true Whether to show tooltips on hover. data-tooltip-position string above or below Position of the tooltip relative to the chart. data-aria-label string null Accessible label for the chart.
You can initialize the chart with the SimpleSparkLineChart constructor, and it automatically processes all matching elements.
new SimpleSparkLineChart(selector: string);
You can customize the following:
You can pass an array of objects with timestamps and values:
<div
class="sparkline"
data-values='[
{"timestamp":1693526400000,"value":0.93},
{"timestamp":1693612800000,"value":0.9315}
]'
data-tooltip="true"
></div>
<script>
new SimpleSparkLineChart(".sparkline");
</script>
🚀 Optimized for Performance
For quick usage without installing npm dependencies:
<script src="https://www.unpkg.com/simple-sparkline-chart"></script>
To build the project locally:
npm install
npm start
npm run build
npm run test
This project is licensed under the MIT License - see the LICENSE file for details.
💬 Feedback and Contributions
Feel free to open an issue if you find a bug or have a feature request. Pull requests are welcome! 🙌
Hope you enjoy using Simple SparkLine Chart! 🚀✨
FAQs
Simple SparkLine Chart with interactive tooltips, offering flexible customization options for effortless integration into any project.
The npm package simple-sparkline-chart receives a total of 7 weekly downloads. As such, simple-sparkline-chart popularity was classified as not popular.
We found that simple-sparkline-chart demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Snyk's use of malicious npm packages for research raises ethical concerns, highlighting risks in public deployment, data exfiltration, and unauthorized testing.
Research
Security News
Socket researchers found several malicious npm packages typosquatting Chalk and Chokidar, targeting Node.js developers with kill switches and data theft.
Security News
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.