npm.io
72.0.0 • Published 2 years ago

mkschart

Licence
—
Version
72.0.0
Deps
6
Size
14.2 MB
Vulns
0
Weekly
0

Getting Started with Create React App

This project was bootstrapped with Create React App.

Available Scripts

In the project directory, you can run:

yarn start

Runs the app in the development mode.
Open http://localhost:3000 to view it in your browser.

The page will reload when you make changes.
You may also see any lint errors in the console.

yarn build

Rollup bundle is created at dist/mkschart.js

Dependency

Need to import script in which react project we are going to import the mkschart

Package installation for react

yarn add mkschart

Import methods for react

import MKSChart from 'mkschart'

function App() { const data = { ticker: ticker, apiKey: apiKey, baseURL: baseURL, };

return ( <div style={{ width: '100%', height: '95vh' }}> //height and width must be define ); }

export default App;

Import method using mkschartHTML.js bundle

import { useEffect } from 'react'; import '../mkschartHTML.js'; //path from where the bundle is imported

const MKSChart = ({ data }) => {

useEffect(() => { if (window.createMksChart) { window.createMksChart(data); } else { console.error('createMksChart function not found in the global scope.'); } }, [data])

return ( <div style={{ width: '100%', height: '100%', position: 'relative' }}> <div id='chart-container' style={{ height: '100%' }} /> ) };

export default MKSChart;