npm.io
0.1.3 • Published 5 years ago

covid-charts

Licence
ISC
Version
0.1.3
Deps
2
Size
221 kB
Vulns
0
Weekly
0

covid-charts

Interactive charts with the number of Coronavirus confirmed cases, deaths, and recovered cases for your country.

example

Data from pomber/covid19

install

with npm

npm i covid-charts
import createChart from "covid-charts";

const chart = createChart(document.body, {
  country: "France",
  width: 400,
  height: 300
});
with CDN via unpkg
<script src="https://unpkg.com/covid-charts/index.js"></script>
<script>
  const chart = createChart(document.body, {
    country: "France",
    width: 400,
    height: 300
  });
</script>

api

createChart params:

  • dom element: chart will be added to this place to DOM
  • options:
    • width (default: 400)
    • height (default: 300)
    • country (default: 'China')

createChart return object with next methods:

  • remove: destroy and remove chart from DOM
  • countries: return a promise with available countries
  • changeCountry: change country to the specified

acknowledgements

Thanks @pomber for the data.

Special thanks to tradingview for supa-dupa charts.