Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

datagovsg-plottable-charts

Package Overview
Dependencies
Maintainers
1
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

datagovsg-plottable-charts

Reusable Plottable chart components

  • 3.3.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
decreased by-50%
Maintainers
1
Weekly downloads
 
Created
Source

datagovsg-plottable-charts

Generate beautifully styled charts like those on data.gov.sg

Motivation

Generating a chart is easy, making it looks beautiful requires much more effort. Numerous charting libraries have been written to solves the basic problem of converting data to chart objects. Regardless of the library you choose, out-of-the-box defaults hardly produces the look you want.

Charts on Data.gov.sg are rendered using the Plottable library. Based on D3, it is highly flexible and gives you many low level controls to fine-tune every single detail. However, this power comes at the price of additional configurations. We want to abstract away these configurations by creating wrappers that pre-apply all the styles we want on our component. That's why we created this library.

Some cool things it does

Tooltips

popovers

Pie chart labels

outerlabels

Using the chart components

npm install --save datagovsg-plottable-charts
import {
  SimplePie,
  SimpleBar,
  GroupedBar,
  StackedBar,
  SimpleLine,
  MultipleLine
} from 'datagovsg-plottable-charts'

// Instantiate the chart component
var pie = new SimplePie(props)

// Mount component
pie.mount(document.getElementById('ctn'))

// Update chart
pie.update(newProps)

Using plugins

import {
  highlightOnHover,
  setupOuterLabel
} from 'datagovsg-plottable-charts/dist/plugins'

highlightOnHover(pie)
setupOuterLabel(pie)

Debugging guide

  1. Clone the datagovsg/datagovsg-plottable-charts repo
  2. cd to the cloned repo
  3. Run npm install
  4. Change main field in the package.json to "main": "src/index.js"
  5. Set up a symlink sudo npm link
  6. cd to your working directory
  7. Run npm link datagovsg-plottable-charts

FAQs

Package last updated on 15 Oct 2017

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc