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.4.4
  • Source
  • npm
  • Socket score

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

datagovsg-plottable-charts

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.

What it does for you

Tooltips

popovers

Pie chart labels

outerlabels

Automatically downsample tick marks

downsampleticks

And many more...

How to use

Dependencies
  • D3
  • Plottable
  • JQuery (optional, only if you require tooltip)
Use with bundler (Webpack, Rollup etc)
npm install --save datagovsg-plottable-charts
import {SimplePie} from 'datagovsg-plottable-charts'

// Instantiate the chart component
const 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)
Use without a bundler
<script src="lib/d3.min.js"></script>
<script src="lib/plottable.min.js"></script>
<script src="lib/datagovsg-charts.min.js"></script>
const {SimplePie, plugins} = DatagovsgCharts
const {highlightOnHover, setupOuterLabel} = plugins

const pie = new SimplePie(props)
highlightOnHover(pie)
setupOuterLabel(pie)

Full Component List

Pre-styled
Unstyled

Full Plugin List

Useful helpers

PivotTable

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. Delete module field in the package.json
  6. Set up a symlink sudo npm link
  7. cd to your working directory
  8. Run npm link datagovsg-plottable-charts

FAQs

Package last updated on 26 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