Security News
pnpm 10.0.0 Blocks Lifecycle Scripts by Default
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
A savvy library to create svg elements and charts with ease.
SVG is awesome. But writing SVG on a low level can be tedious. This library is designed to make SVG coding more declarative and enjoyable.
This Typescript library also comes with built-in charts, you can tailor to your needs. It is lowely opinionated.
This project just started. The basic blocks are there. Many more charts are on the cards.
npm install savyg
yarn add savyg
pnpm add savyg
bun add savyg
Making charts is easy. Here is how you can create a progression chart, with lines, bars and plots:
import { chartXy } from "savyg";
chartXy({
dataset: [
{
name: 'serie 1',
values: [0, -1, -1, -2, -3, -5, -8.13, -13.54, -21, -34, -55, -89],
type: "bar",
rounding: 1,
plotRadius: 0,
gradientFrom: "#FF000033",
gradientTo: "#0000FF33",
rx: 3
},
{
name: 'serie 2',
values: [0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89],
type: "line",
fill: "#FF000033"
},
{
name: 'serie 3',
values: [89, 55, 34, 21],
type: "plot",
plotRadius: 3
},
],
// The HTML element where the chart will be inserted:
parent: document.querySelector('#myDiv'),
options: {
barSpacing: 2,
showAxis: true,
xAxisLabels: ["JAN", "FEB", "MAR", "APR", "MAY", "JUN", "JUL", "AUG", "SEP", "OCT", "NOV", "DEC"],
title: "Title",
}
})
Here is how you can create a donut chart:
import { chartDonut } from "savyg";
chartDonut({
dataset: [
{
name: "serie 1",
value: 20,
},
{
name: "serie 2",
value: 10,
},
{
name: "serie 3",
value: 10,
},
{
name: "serie 4",
value: 20,
},
],
// The HTML element where the chart will be inserted:
parent: document.querySelector('#myDiv'),
options: {
title: "Title",
}
})
Here is how you can create a gauge chart:
import { chartGauge } from "savyg";
chartGauge({
value: 66.7,
segments: [
{
from: -100,
to: 0,
color: "red"
},
{
from: 0,
to: 100,
color: "green"
}
],
// The HTML element where the chart will be inserted:
parent: document.querySelector('#myDiv'),
options: {
title: "Title",
valueRounding: 1
}
})
Here is how you can create a sparkline chart:
import { chartSparkline } from "savyg";
chartSparkline({
dataset : {
name: 'Title',
values: [1, 2, 3, 5, 8, 13],
periods: ['JAN', 'FEB', 'MAR', 'APR', 'MAY', 'JUN']
},
// The HTML element where the chart will be inserted:
parent: document.querySelector('#myDiv'),
options: {
titleFontSize: 8,
showArea: true
}
});
If you need to write SVG close to the metal but want to spare the hassle, this api is for you.
Need a circle ?
import { circle } from "savyg";
circle({
options: {
x: 10,
y: 10,
r: 5,
fill: "red"
},
parent: document.querySelector('#mySvg')
})
...or a rectangle, to be used later ?
import { rect } from "savyg";
const myGreenRect = rect({
options: {
x: 0,
y: 0,
height: 10,
width: 10,
fill: "green"
}
})
alreadyDeclaredSvg.appendChild(myGreenRect)
savyg does not ship css files.
To further customize your charts, css classes are exposed.
FAQs
A savvy library to create svg elements and charts with ease
The npm package savyg receives a total of 22 weekly downloads. As such, savyg popularity was classified as not popular.
We found that savyg demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer 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
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
Product
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.
Research
Security News
Socket researchers have discovered multiple malicious npm packages targeting Solana private keys, abusing Gmail to exfiltrate the data and drain Solana wallets.