All Projects → jwilber → Roughviz

jwilber / Roughviz

Reusable JavaScript library for creating sketchy/hand-drawn styled charts in the browser.

Programming Languages

javascript
184084 projects - #8 most used programming language
HTML
75241 projects

Projects that are alternatives of or similar to Roughviz

Matplotplusplus
Matplot++: A C++ Graphics Library for Data Visualization 📊🗾
Stars: ✭ 2,433 (-59.6%)
Mutual labels:  data-science, data-visualization, charting-library
Krisk
Statistical Interactive Visualization with pandas+Jupyter integration on top of Echarts.
Stars: ✭ 111 (-98.16%)
Mutual labels:  data-science, data-visualization, dashboard
Dash.jl
Dash for Julia - A Julia interface to the Dash ecosystem for creating analytic web applications in Julia. No JavaScript required.
Stars: ✭ 248 (-95.88%)
Mutual labels:  data-science, data-visualization, dashboard
Just Dashboard
📊 📋 Dashboards using YAML or JSON files
Stars: ✭ 1,511 (-74.91%)
Mutual labels:  data-science, data-visualization, dashboard
Anychart
AnyChart is a lightweight and robust JavaScript charting solution with great API and documentation. The chart types and unique features are numerous, the library works easily with any development stack.
Stars: ✭ 288 (-95.22%)
Mutual labels:  data-visualization, charting-library, dashboard
Rweekly.org
R Weekly
Stars: ✭ 406 (-93.26%)
Mutual labels:  data-science, data-visualization
Flutter echarts
A Flutter widget to use Apache ECharts (incubating) in a reactive way.
Stars: ✭ 420 (-93.03%)
Mutual labels:  data-visualization, charting-library
Courses
Quiz & Assignment of Coursera
Stars: ✭ 454 (-92.46%)
Mutual labels:  data-science, data-visualization
Best Of Ml Python
🏆 A ranked list of awesome machine learning Python libraries. Updated weekly.
Stars: ✭ 6,057 (+0.58%)
Mutual labels:  data-science, data-visualization
Kbn network
Network Plugin for Kibana
Stars: ✭ 339 (-94.37%)
Mutual labels:  data-visualization, dashboard
Reactochart
📈 React chart component library 📉
Stars: ✭ 459 (-92.38%)
Mutual labels:  data-visualization, charting-library
Ipython Dashboard
A stand alone, light-weight web server for building, sharing graphs created in ipython. Build for data science, data analysis guys. Aiming at building an interactive visualization, collaborated dashboard, and real-time streaming graph.
Stars: ✭ 664 (-88.97%)
Mutual labels:  data-science, dashboard
Dash Table
A First-Class Interactive DataTable for Dash
Stars: ✭ 382 (-93.66%)
Mutual labels:  data-science, data-visualization
Data Science
Collection of useful data science topics along with code and articles
Stars: ✭ 315 (-94.77%)
Mutual labels:  data-science, data-visualization
Teaching
Teaching Materials for Dr. Waleed A. Yousef
Stars: ✭ 435 (-92.78%)
Mutual labels:  data-science, data-visualization
Articles
A repository for the source code, notebooks, data, files, and other assets used in the data science and machine learning articles on LearnDataSci
Stars: ✭ 350 (-94.19%)
Mutual labels:  data-science, data-visualization
Book Socialmediaminingpython
Companion code for the book "Mastering Social Media Mining with Python"
Stars: ✭ 462 (-92.33%)
Mutual labels:  data-science, data-visualization
Lets Plot
An open-source plotting library for statistical data.
Stars: ✭ 531 (-91.18%)
Mutual labels:  data-science, data-visualization
Moderndive book
Statistical Inference via Data Science: A ModernDive into R and the Tidyverse
Stars: ✭ 527 (-91.25%)
Mutual labels:  data-science, data-visualization
Abixen Platform
Abixen Platform
Stars: ✭ 530 (-91.2%)
Mutual labels:  data-visualization, dashboard

roughViz.js
npm version npm bundle size (version)

roughViz.js is a reusable JavaScript library for creating sketchy/hand-drawn styled charts in the browser, based on D3v5, roughjs, and handy.

roughViz.js

Why?

Use these charts where the communication goal is to show intent or generality, and not absolute precision. Or just because they're fun and look weird.

Features

Chart Types (more to come!)

Apply the features of roughjs to each chart:

roughness:

roughness examples

fillStyle fillStyle examples

fillWeight fillStyle examples

As well as additional chart-specific options (see API below)

Installation

Via CDN (expose the roughViz global in html):

<script src="https://unpkg.com/[email protected]"></script>

Via npm:

npm install rough-viz

Want to use with React? There's a wrapper!:

npm install react-roughviz

Want to use with Vue? There's a wrapper!:

npm install vue-roughviz

Want to use it with Python? Go crazy:

pip install py-roughviz

How to use

Create some container elements, one for each chart:

<!--you can name each id whatever you want -->
<div id="viz0"></div>
<div id="viz1"></div>

In the javascript, just create charts, referencing the desired container:

// create Bar chart from csv file, using default options
 new roughViz.Bar({
    element: '#viz0', // container selection
    data: 'https://raw.githubusercontent.com/jwilber/random_data/master/flavors.csv',
    labels: 'flavor',
    values: 'price'
});

// create Donut chart using defined data & customize plot options
new roughViz.Donut(
  {
    element: '#viz1',
    data: {
      labels: ['North', 'South', 'East', 'West'],
      values: [10, 5, 8, 3]
    },
    title: "Regions",
    width: window.innerWidth / 4,
    roughness: 8,
    colors: ['red', 'orange', 'blue', 'skyblue'],
    stroke: 'black',
    strokeWidth: 3,
    fillStyle: 'cross-hatch',
    fillWeight: 3.5,
  }
);

API

roughViz.Bar

Required

  • element [string]: Id or class of container element.

  • data: Data with which to construct chart. Can be either an object or string.

    • If object: must contain labels and values keys:
    new roughViz.Bar({
       element: '.viz',
       data: {labels: ['a', 'b'], values: [10, 20]}
     })
    • If string: must be a path/url to a csv or tsv, and you must also specify the labels and values as separate attributes that represent columns in said file:
    new roughViz.Bar({
      element: '#viz0',
      data: 'stringToDataUrl.csv',
      labels: 'nameOfLabelsColumn',
      values: 'nameOfValuesColumn',
    })

Optional

  • axisFontSize [string]: Font-size for axes' labels. Default: '1rem'.
  • axisRoughness [number]: Roughness for x & y axes. Default: 0.5.
  • axisStrokeWidth [number]: Stroke-width for x & y axes. Default: 0.5.
  • bowing [number]: Chart bowing. Default: 0.
  • color [string]: Color for each bar. Default: 'skyblue'.
  • fillStyle [string]: Bar fill-style. Should be one of fillStyles shown above.
  • fillWeight [number]: Weight of inner paths' color. Default: 0.5.
  • font: Font-family to use. You can use 0 or gaegu to use Gaegu, or 1 or indie flower to use Indie Flower. Or feed it something else. Default: Gaegu.
  • highlight [string]: Color for each bar on hover. Default: 'coral'.
  • innerStrokeWidth [number]: Stroke-width for paths inside bars. Default: 1.
  • interactive [boolean]: Whether or not chart is interactive. Default: true.
  • labelFontSize [string]: Font-size for axes' labels. Default: '1rem'.
  • margin [object]: Margin object. Default: {top: 50, right: 20, bottom: 70, left: 100}
  • padding [number]: Padding between bars. Default: 0.1.
  • roughness [number]: Roughness level of chart. Default: 1.
  • simplification [number]: Chart simplification. Default 0.2.
  • stroke [string]: Color of bars' stroke. Default: black.
  • strokeWidth [number]: Size of bars' stroke. Default: 1.
  • title [string]: Chart title. Optional.
  • titleFontSize [string]: Font-size for chart title. Default: '1rem'.
  • tooltipFontSize [string]: Font-size for tooltip. Default: '0.95rem'.
  • xLabel [string]: Label for x-axis.
  • yLabel [string]: Label for y-axis.

roughViz.BarH

Required

  • element [string]: Id or class of container element.

  • data: Data with which to construct chart. Can be either an object or string.

    • If object: must contain labels and values keys:
    new roughViz.BarH({
       element: '.viz',
       data: {labels: ['a', 'b'], values: [10, 20]}
     })
    • If string: must be a path/url to a csv or tsv, and you must also specify the labels and values as separate attributes that represent columns in said file:
    new roughViz.BarH({
      element: '#viz0',
      data: 'stringToDataUrl.csv',
      labels: 'nameOfLabelsColumn',
      values: 'nameOfValuesColumn',
    })

Optional

  • axisFontSize [string]: Font-size for axes' labels. Default: '1rem'.
  • axisRoughness [number]: Roughness for x & y axes. Default: 0.5.
  • axisStrokeWidth [number]: Stroke-width for x & y axes. Default: 0.5.
  • bowing [number]: Chart bowing. Default: 0.
  • color [string]: Color for each bar. Default: 'skyblue'.
  • fillStyle [string]: Bar fill-style. Should be one of fillStyles shown above.
  • fillWeight [number]: Weight of inner paths' color. Default: 0.5.
  • font: Font-family to use. You can use 0 or gaegu to use Gaegu, or 1 or indie flower to use Indie Flower. Or feed it something else. Default: Gaegu.
  • highlight [string]: Color for each bar on hover. Default: 'coral'.
  • innerStrokeWidth [number]: Stroke-width for paths inside bars. Default: 1.
  • interactive [boolean]: Whether or not chart is interactive. Default: true.
  • labelFontSize [string]: Font-size for axes' labels. Default: '1rem'.
  • margin [object]: Margin object. Default: {top: 50, right: 20, bottom: 70, left: 100}
  • padding [number]: Padding between bars. Default: 0.1.
  • roughness [number]: Roughness level of chart. Default: 1.
  • simplification [number]: Chart simplification. Default 0.2.
  • stroke [string]: Color of bars' stroke. Default: black.
  • strokeWidth [number]: Size of bars' stroke. Default: 1.
  • title [string]: Chart title. Optional.
  • titleFontSize [string]: Font-size for chart title. Default: '1rem'.
  • tooltipFontSize [string]: Font-size for tooltip. Default: '0.95rem'.
  • xLabel [string]: Label for x-axis.
  • yLabel [string]: Label for y-axis.

roughViz.Donut

Required

  • element [string]: Id or class of container element.

  • data: Data with which to construct chart. Can be either an object or string.

    • If object: must contain labels and values keys:
    new roughViz.Donut({
       element: '.viz',
       data: {labels: ['a', 'b'], values: [10, 20]}
     })
    • If string: must be a path/url to a csv, json, or tsv, and you must also specify the labels and values as separate attributes that represent columns in said file:
    new roughViz.Donut({
      element: '#viz0',
      data: 'stringToDataUrl.csv',
      labels: 'nameOfLabelsColumn',
      values: 'nameOfValuesColumn',
    })

Optional

  • bowing [number]: Chart bowing. Default: 0.
  • colors [array]: Array of colors for each arc. Default: ['coral', 'skyblue', '#66c2a5', 'tan', '#8da0cb', '#e78ac3', '#a6d854', '#ffd92f', 'tan', 'orange'].
  • fillStyle [string]: Bar fill-style. Should be one of fillStyles shown above.
  • fillWeight [number]: Weight of inner paths' color. Default: 0.85.
  • font: Font-family to use. You can use 0 or gaegu to use Gaegu, or 1 or indie flower to use Indie Flower. Or feed it something else. Default: Gaegu.
  • highlight [string]: Color for each arc on hover. Default: 'coral'.
  • innerStrokeWidth [number]: Stroke-width for paths inside arcs. Default: 0.75.
  • interactive [boolean]: Whether or not chart is interactive. Default: true.
  • legend [boolean]: Whether or not to add legend. Default: 'true'.
  • legendPosition [string]: Position of legend. Should be either 'left' or 'right'. Default: 'right'.
  • margin [object]: Margin object. Default: {top: 50, right: 20, bottom: 70, left: 100}
  • padding [number]: Padding between bars. Default: 0.1.
  • roughness [number]: Roughness level of chart. Default: 1.
  • simplification [number]: Chart simplification. Default 0.2.
  • strokeWidth [number]: Size of bars' stroke. Default: 1.
  • title [string]: Chart title. Optional.
  • titleFontSize [string]: Font-size for chart title. Default: '1rem'.
  • tooltipFontSize [string]: Font-size for tooltip. Default: '0.95rem'.

roughViz.Line

Required

  • element [string]: Id or class of container element.
  • data: Must be a path/url to a csv or tsv, and you must also specify the each y as separate attributes that represent columns in said file. Each attribute prefaced with y (except yLabel) will receive its own line:
    new roughViz.Line({
      element: '#viz0',
      data: 'https://raw.githubusercontent.com/jwilber/random_data/master/profits.csv',
      y1: 'revenue',
      y2: 'cost',
      y3: 'profit'
    })

Optional

  • axisFontSize [string]: Font-size for axes' labels. Default: '1rem'.
  • axisRoughness [number]: Roughness for x & y axes. Default: 0.5.
  • axisStrokeWidth [number]: Stroke-width for x & y axes. Default: 0.5.
  • bowing [number]: Chart bowing. Default: 0.
  • circle [boolean]: Whether or not to add circles to chart. Default: true.
  • circleRadius [number]: Radius of circles. Default: 10.
  • circleRoughness [number]: Roughness of circles. Default: 2.
  • colors [array or string]: Array of colors for each arc. Default: ['coral', 'skyblue', '#66c2a5', 'tan', '#8da0cb', '#e78ac3', '#a6d854', '#ffd92f', 'tan', 'orange']. If string (e.g. 'blue'), all circles will take that color.
  • fillStyle [string]: Bar fill-style. Should be one of fillStyles shown above.
  • fillWeight [number]: Weight of inner paths' color. Default: 0.5.
  • font: Font-family to use. You can use 0 or gaegu to use Gaegu, or 1 or indie flower to use Indie Flower. Or feed it something else. Default: Gaegu.
  • interactive [boolean]: Whether or not chart is interactive. Default: true.
  • labelFontSize [string]: Font-size for axes' labels. Default: '1rem'.
  • legend [boolean]: Whether or not to add legend. Default: true.
  • legendPosition [string]: Position of legend. Should be either 'left' or 'right'. Default: 'right'.
  • margin [object]: Margin object. Default: {top: 50, right: 20, bottom: 70, left: 100}
  • roughness [number]: Roughness level of chart. Default: 1.
  • simplification [number]: Chart simplification. Default 0.2.
  • stroke [string]: Color of lines' stroke. Default: this.colors.
  • strokeWidth [number]: Size of lines' stroke. Default: 1.
  • title [string]: Chart title. Optional.
  • titleFontSize [string]: Font-size for chart title. Default: '0.95rem'.
  • tooltipFontSize [string]: Font-size for tooltip. Default: '0.95rem'.
  • xLabel [string]: Label for x-axis.
  • yLabel [string]: Label for y-axis.

roughViz.Pie

Required

  • element [string]: Id or class of container element.

  • data: Data with which to construct chart. Can be either an object or string.

    • If object: must contain labels and values keys:
    new roughViz.Pie({
       element: '.viz',
       data: {labels: ['a', 'b'], values: [10, 20]}
     })
    • If string: must be a path/url to a csv, json, or tsv, and you must also specify the labels and values as separate attributes that represent columns in said file:
    new roughViz.Pie({
      element: '#viz0',
      data: 'stringToDataUrl.csv',
      labels: 'nameOfLabelsColumn',
      values: 'nameOfValuesColumn',
    })

Optional

  • bowing [number]: Chart bowing. Default: 0.
  • colors [array]: Array of colors for each arc. Default: ['coral', 'skyblue', '#66c2a5', 'tan', '#8da0cb', '#e78ac3', '#a6d854', '#ffd92f', 'tan', 'orange'].
  • fillStyle [string]: Bar fill-style. Should be one of fillStyles shown above.
  • fillWeight [number]: Weight of inner paths' color. Default: 0.85.
  • font: Font-family to use. You can use 0 or gaegu to use Gaegu, or 1 or indie flower to use Indie Flower. Or feed it something else. Default: Gaegu.
  • highlight [string]: Color for each arc on hover. Default: 'coral'.
  • innerStrokeWidth [number]: Stroke-width for paths inside arcs. Default: 0.75.
  • interactive [boolean]: Whether or not chart is interactive. Default: true.
  • legend [boolean]: Whether or not to add legend. Default: true.
  • legendPosition [string]: Position of legend. Should be either 'left' or 'right'. Default: 'right'.
  • margin [object]: Margin object. Default: {top: 50, right: 20, bottom: 70, left: 100}
  • padding [number]: Padding between bars. Default: 0.1.
  • roughness [number]: Roughness level of chart. Default: 1.
  • simplification [number]: Chart simplification. Default 0.2.
  • strokeWidth [number]: Size of bars' stroke. Default: 1.
  • title [string]: Chart title. Optional.
  • titleFontSize [string]: Font-size for chart title. Default: '1rem'.
  • tooltipFontSize [string]: Font-size for tooltip. Default: '0.95rem'.

roughViz.Scatter

Required

  • element [string]: Id or class of container element.

  • data: Data with which to construct chart. Can be either an object or string.

    • If object: must contain x and y keys:
    new roughViz.Scatter({
       element: '.viz',
       data: {x: [1, 2, 35], y: [10, 20, 8]}
     })
    • If string: must be a path/url to a csv or tsv, and you must also specify the x and y as separate attributes that represent columns in said file:
    new roughViz.Scatter({
      element: '#viz0',
      data: 'stringToDataUrl.csv',
      x: 'nameOfLabelsColumn',
      y: 'nameOfValuesColumn',
    })

Optional

  • axisFontSize [string]: Font-size for axes' labels. Default: '1rem'.
  • axisRoughness [number]: Roughness for x & y axes. Default: 0.5.
  • axisStrokeWidth [number]: Stroke-width for x & y axes. Default: 0.5.
  • bowing [number]: Chart bowing. Default: 0.
  • colors [array or string]: Array of colors for each arc. Default: ['coral', 'skyblue', '#66c2a5', 'tan', '#8da0cb', '#e78ac3', '#a6d854', '#ffd92f', 'tan', 'orange']. If string (e.g. 'blue'), all circles will take that color.
  • colorVar [string]: If input data is csv or tsv, this should be an ordinal column with which to color points by. curbZero [boolean]: Whether or not to force (x, y) axes to (0, 0). Default: false.
  • fillStyle [string]: Bar fill-style. Should be one of fillStyles shown above.
  • fillWeight [number]: Weight of inner paths' color. Default: 0.5.
  • font: Font-family to use. You can use 0 or gaegu to use Gaegu, or 1 or indie flower to use Indie Flower. Or feed it something else. Default: Gaegu.
  • highlight [string]: Color for each bar on hover. Default: 'coral'.
  • highlightLabel [string]: If input data is csv or tsv, this should be a column representing what value to display on hover. Otherwise, (x, y) values will be shown on hover.
  • innerStrokeWidth [number]: Stroke-width for paths inside circles. Default: 1.
  • interactive [boolean]: Whether or not chart is interactive. Default: true.
  • labelFontSize [string]: Font-size for axes' labels. Default: '1rem'.
  • margin [object]: Margin object. Default: {top: 50, right: 20, bottom: 70, left: 100}
  • radius [number]: Circle radius. Default: 8.
  • roughness [number]: Roughness level of chart. Default: 1.
  • simplification [number]: Chart simplification. Default 0.2.
  • stroke [string]: Color of circles' stroke. Default: black.
  • strokeWidth [number]: Size of circles' stroke. Default: 1.
  • title [string]: Chart title. Optional.
  • titleFontSize [string]: Font-size for chart title. Default: '0.95rem'.
  • tooltipFontSize [string]: Font-size for tooltip. Default: '0.95rem'.
  • xLabel [string]: Label for x-axis.
  • yLabel [string]: Label for y-axis.

roughViz.StackedBar

Required

  • element [string]: Id or class of container element.

  • data: Data with which to construct chart. Should be an object.

  • labels: String name of label key in data object.

    new roughViz.StackedBar({
       element: '#vis0',
       data: [
           {month:'Jan', A:20, B: 5},
           {month:'Feb', A:25, B: 10},    
       ],
       labels: 'month',
     })

Optional

  • axisFontSize [string]: Font-size for axes' labels. Default: '1rem'.
  • axisRoughness [number]: Roughness for x & y axes. Default: 0.5.
  • axisStrokeWidth [number]: Stroke-width for x & y axes. Default: 0.5.
  • bowing [number]: Chart bowing. Default: 0.
  • colors [string]: Array of colors for each bar grouping.
  • fillStyle [string]: Bar fill-style. Should be one of fillStyles shown above.
  • fillWeight [number]: Weight of inner paths' color. Default: 0.5.
  • font: Font-family to use. You can use 0 or gaegu to use Gaegu, or 1 or indie flower to use Indie Flower. Or feed it something else. Default: Gaegu.
  • highlight [string]: Color for each bar on hover. Default: 'coral'.
  • innerStrokeWidth [number]: Stroke-width for paths inside bars. Default: 1.
  • interactive [boolean]: Whether or not chart is interactive. Default: true.
  • labelFontSize [string]: Font-size for axes' labels. Default: '1rem'.
  • margin [object]: Margin object. Default: {top: 50, right: 20, bottom: 70, left: 100}
  • padding [number]: Padding between bars. Default: 0.1.
  • roughness [number]: Roughness level of chart. Default: 1.
  • simplification [number]: Chart simplification. Default 0.2.
  • stroke [string]: Color of bars' stroke. Default: black.
  • strokeWidth [number]: Size of bars' stroke. Default: 1.
  • title [string]: Chart title. Optional.
  • titleFontSize [string]: Font-size for chart title. Default: '1rem'.
  • tooltipFontSize [string]: Font-size for tooltip. Default: '0.95rem'.
  • xLabel [string]: Label for x-axis.
  • yLabel [string]: Label for y-axis.

Contributors

Acknowledgements

This library wouldn't be possible without the following people:

License

MIT License

Copyright (c) 2019 Jared Wilber

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

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].