All Projects â†’ andreaferretti â†’ Paths Js

andreaferretti / Paths Js

Licence: apache-2.0
Generate SVG paths for geometric shapes 📊

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Paths Js

Illustatus
🌟A HTTP Status svg animation that can change color and text arbitrarily.
Stars: ✭ 127 (-92.4%)
Mutual labels:  svg
React Undraw Illustrations
React unDraw Components: MIT licensed illustrations by unDraw for your React projects
Stars: ✭ 129 (-92.28%)
Mutual labels:  svg
Swiftsvg
A simple, performant, and lightweight SVG parser
Stars: ✭ 1,719 (+2.93%)
Mutual labels:  svg
Wilderness
An SVG animation API
Stars: ✭ 127 (-92.4%)
Mutual labels:  svg
Svgiconimagelist
Three engines to render SVG (GDI+, Direct2D or Cairo) and four components to simplify use of SVG images (resize, fixedcolor, grayscale...): TSVGIconImage, TSVGIconImageCollection, TSVGIconVirtualImageList and TSVGIconImageList (for VCL and FMX).
Stars: ✭ 127 (-92.4%)
Mutual labels:  svg
Earthjs
D3 Earth JS
Stars: ✭ 128 (-92.34%)
Mutual labels:  svg
Zfont
💬 Text plugin for Zdog - works with any .ttf font!
Stars: ✭ 126 (-92.46%)
Mutual labels:  svg
Openjscad.org
JSCAD is an open source set of modular, browser and command line tools for creating parametric 2D and 3D designs with JavaScript code. It provides a quick, precise and reproducible method for generating 3D models, and is especially useful for 3D printing applications.
Stars: ✭ 1,851 (+10.84%)
Mutual labels:  svg
Php badge
This is an identification tag based on SVG, It can quickly generate various labels and status identifiers
Stars: ✭ 101 (-93.95%)
Mutual labels:  svg
Svgo
Go Language Library for SVG generation
Stars: ✭ 1,779 (+6.53%)
Mutual labels:  svg
Flagpack Core
Flagpack contains 260+ easily implementable flag icons to use in your design or code project.
Stars: ✭ 127 (-92.4%)
Mutual labels:  svg
Svg
Fast SVG in Elm
Stars: ✭ 128 (-92.34%)
Mutual labels:  svg
Vue Octicon
Octicon component for Vue.js, using inline SVG.
Stars: ✭ 129 (-92.28%)
Mutual labels:  svg
Vue Svg Transition
Create 2-state, SVG-powered transitions
Stars: ✭ 127 (-92.4%)
Mutual labels:  svg
Svg To Ts
Build performant SVG icon libraries by converting raw SVG files to TypeScript that is optimized for modern tree shaking mechanisms.
Stars: ✭ 131 (-92.16%)
Mutual labels:  svg
Opentype Svg Font Editor
A user-friendly tool for adding SVG to OpenType fonts
Stars: ✭ 126 (-92.46%)
Mutual labels:  svg
Geopattern
Generate beautiful SVG patterns
Stars: ✭ 1,687 (+1.02%)
Mutual labels:  svg
Convert Svg
Node.js packages for converting SVG into other formats using headless Chromium
Stars: ✭ 133 (-92.04%)
Mutual labels:  svg
Rmdi
React Material Design Icons – built with Pixo, Styled Components, and Styled System
Stars: ✭ 132 (-92.1%)
Mutual labels:  svg
Mathematical
Convert mathematical equations to SVGs, PNGs, or MathML. A general wrapper to Lasem and mtex2MML.
Stars: ✭ 129 (-92.28%)
Mutual labels:  svg

Paths.js

Build Status

Paths.js is a library to generate SVG paths, allowing you to create your own charts using a functional and testable API. It provides the primitives to create various shapes and charts starting from raw data, but it does not prescribe how you render these charts. This means you can use Paths.js to build components for your favorite frontend framework, and works even server-side on NodeJS.

Paths.js offers three APIs, of increasing abstraction. The lowest level is a chainable API to generate an arbitrary SVG path. On top of this, paths for simple geometric shapes such as polygons or circle sectors are defined. At the highest level, there is an API to generate some simple graphs (pie, line chart, radar...) for a collection of data, assembling the simple shapes.

Latest version is 0.4.6 - see this for the necessary changes from 0.3.5.

Table of contents

Demos

Of course, when judging a chart library, the first request is to have a look at results. But Paths.js is different: it provides the geometry, and you draw the charts.

That said, we have two demos. The first one is written using React (source here).

The old demo is written using Ractive (source here).

Philosophy

Drawing beautiful charts is a craft, and often one needs to add custom interactions, styling or animations. There are some beautiful chart libraries out there, such as Flotcharts or Dimple, and if those are enough for your needs, they can be a pleasure to use.

In many cases, though, what I really wanted was a library to take care of the generation of the chart, while still leaving me the possibility to render the actual thing. Paths.js does exactly this. It eventually generates SVG paths with a high level API. These paths can be then used together with a template engine such as Mustache or Handlebars to display SVG graphics in the browser. If instead of a static template engine, you use a data binding library, such as Facebook React, Ractive.js or Angular, you get animated graphics for free.

In designing Paths.js, I have tried to follow a few principles:

  • paths should be immutable
  • all exposed methods should be pure
  • from this follows that it is trivial to test components
  • and that they work on Node.js as well
  • it should be easy to integrate Paths.js into various frameworks

Documentation

A detailed documentation is available on the wiki. Here are links to the main entry points.

Paths.js offers three APIs, of increasing abstraction. The lowest level is a chainable API to generate an arbitrary SVG path. On top of this, paths for simple geometric shapes such as polygons or circle sectors are defined. At the highest level, there is an API to generate some simple graphs (pie, line chart, radar...) for a collection of data, assembling the simple shapes.

Those users who prefer explicit typed interfaces can browse the API of the Scala.js bindings.

Resources

These resources give a more detailed exposition of the philosophy behind Paths.js:

Browser support

Paths.js works in any environment that supports a modern version of Javascript, namely ES5. This includes any version of Node.js and all recent browsers. If you need support for older browsers, you can include an ES5 polyfill.

On the other hand, not every browser will be able to display the SVG graphics that you will generate. Usually, recent desktop browsers are ok, but mobile browser are slow in adopting the SVG specification. You can refer to caniuse for more detailed information.

Migration to 0.4

Version 0.4 was rewritten in ES6 instead of CoffeeScript for future-proofing. The currently published version is 0.4.0.

A few API changes were introduced, namely all keys are now camel cased.

In particular:

  • in the low-level verbose API, large_arc_flag has been renamed to largeArcFlag, and sweep_flag to sweepFlag
  • the rectangle width in the Sankey diagram, is now called rectWidth instead of rect_width

Also, the default for the gutter parameter is now 10 everywhere (that is, also in the Bar and Waterfall charts).

Everything else should be the same, so if you find any regression, please open a issue.

Using Paths.js with the Canvas API

Paths.js does not directly support the canvas element, essentially because there is no need to do so. The canvg project allows to draw SVG paths on a <canvas> element, and it seems that canvas will be able to support SVG paths natively. Of course, canvas-based solutions limit the possibilities offered by data binding libraries for interaction, but they could be used as a fallback on less recent browsers.

Using Paths.js with Scala.js

It is possible to use Paths.js with Scala.js - this library defines the bindings.

Contributing

Contributions to Paths.js are always welcome! See this wiki page for suggestions and guidelines.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].