Security News
PyPI Introduces Digital Attestations to Strengthen Python Package Security
PyPI now supports digital attestations, enhancing security and trust by allowing package maintainers to verify the authenticity of Python packages.
@vx/shape is a part of the vx library, which is a collection of reusable low-level visualization components. The @vx/shape package provides a set of components for creating various shapes and paths in SVG, which can be used to build complex visualizations like charts and graphs.
Bar
The Bar component allows you to create bar charts. The code sample demonstrates how to create a simple bar chart using SVG rectangles.
const Bar = ({ data }) => (
<svg width={500} height={500}>
{data.map((d, i) => (
<rect
key={i}
x={i * 30}
y={500 - d}
width={25}
height={d}
fill="teal"
/>
))}
</svg>
);
LinePath
The LinePath component is used to create line charts. The code sample shows how to create a simple line chart using an SVG path element.
const LinePath = ({ data }) => (
<svg width={500} height={500}>
<path
d={`M ${data.map((d, i) => `${i * 30},${500 - d}`).join(' L ')}`}
fill="none"
stroke="blue"
/>
</svg>
);
Pie
The Pie component is used to create pie charts. The code sample demonstrates how to create a simple pie chart using SVG path elements.
const Pie = ({ data }) => (
<svg width={500} height={500}>
{data.map((d, i) => (
<path
key={i}
d={`M250,250 L${250 + 200 * Math.cos(2 * Math.PI * i / data.length)},${250 + 200 * Math.sin(2 * Math.PI * i / data.length)} A200,200 0 0,1 ${250 + 200 * Math.cos(2 * Math.PI * (i + 1) / data.length)},${250 + 200 * Math.sin(2 * Math.PI * (i + 1) / data.length)} Z`}
fill={d.color}
/>
))}
</svg>
);
d3-shape is a part of the D3.js library that provides functions for creating complex shapes and paths. It is more comprehensive and flexible compared to @vx/shape, but also more complex to use.
react-vis is a React-based visualization library that provides a set of high-level components for creating charts and graphs. It is easier to use compared to @vx/shape but offers less customization and flexibility.
Victory is another React-based library for creating data visualizations. It provides a wide range of pre-built components for different types of charts and is easier to use compared to @vx/shape, but it may not offer the same level of customization.
v0.0.159
<Axis />
components now use @vx/text
to render tick labels. This enables multi line labels and scaling text to fit in a certain amount of space. #260Example:
<Axis
{...axisProps}
tickLabelProps = (tickValue, index) => ({
textAnchor: 'middle',
verticalAnchor: 'middle',
width: 100,
scaleToFit: true
})
/>
<Axis />
components got a new prop tickComponent
to enable rendering of custom ticks. With this prop one can completely customize ticks without having to create a new custom <Axis />
component. #260Example:
<Axis
{...axisProps}
tickComponent={({ x, y, formattedValue }) => (
<g>
<circle cx={x} cy={y} r={2} fill='rebeccapurple' />
<text x={x + 4} y={y}>{formattedValue}</text>
</g>
)}
/>
tickComponent
accepts a function and gets called with the following attribute:
tickComponent({ x, y, formattedValue, ...tickLabelPropsObj })
@vx/axis
documentation. #260@vx/text
package. #257Changes:
- @vx/axis: 0.0.158 => 0.0.159
- @vx/demo: 0.0.158 => 0.0.159
- @vx/text: 0.0.153 => 0.0.159
- @vx/vx: 0.0.158 => 0.0.159
FAQs
vx shape
The npm package @vx/shape receives a total of 23,052 weekly downloads. As such, @vx/shape popularity was classified as popular.
We found that @vx/shape demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 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
PyPI now supports digital attestations, enhancing security and trust by allowing package maintainers to verify the authenticity of Python packages.
Security News
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.