Skip to content

gshohat/web-component-amazing-chart

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Web Component Amazing Chart

NPM License

Lightweight stock line chart < 15k 😎
Compatible with React, Vue, Angular & other frameworks. Optional animation.

amazing-chart

Vue usage

npm i web-component-amazing-chart

main.js

import AmazingChart from "web-component-amazing-chart";

customElements.define('amazing-chart', AmazingChart);

App.vue

onMounted(() => {
  let amazingChartElement = document.querySelector('#amazing-chart');
  amazingChartElement.options = {
      data: [
        { time: 1672084591000, price: 5 }, { time: 1674762991000, price: 6 },
        { time: 1677441391000, price: 5 }, { time: 1679860591000, price: 6 },
        ....
      ],
      animate: true,
    };

});

<template>
<amazing-chart id="amazing-chart"/>
</template

vite config:

export default defineConfig({
  plugins: [
    vue({
      template: {
        compilerOptions: {
          isCustomElement: (tag) => tag.includes('amazing-chart')
        }
      }
    })
  ],

Contact

hi@giladshohat.com 💫

Releases

No releases published

Packages

No packages published