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

apex-react-charts

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

apex-react-charts - npm Package Compare versions

Comparing version 1.0.2 to 1.0.3

39

index.js

@@ -9,10 +9,12 @@ var React = require('react');

super(props);
this.genId = new window.Date().getTime();
this.options = props.options ? props.options : {};
this.options = props.options || {};
this.series = this.options.series = props.series || {};
this.style = props.style || {width: "100%", height: "100%", position: "relative"};
this.chartContainerId = "apexchart-container-" + this.genId;
this.chartRef = null;
this.chart = null;
this.setRef = (el => this.chartRef = el).bind(this);
}
componentDidMount() {
//Create Chart and Render
this.chart = new Apex(document.querySelector('#' + this.chartContainerId), this.options);
this.chart = new Apex(this.chartRef, this.options);
this.chart.render();

@@ -23,10 +25,17 @@

}
shouldComponentUpdate(props, state){
//Check if Chart-options has changed and determine if component has to be updated
return !(props.options === this.options);
}
componentDidUpdate() {
//Update Chart Options & Render
this.options = this.props.options;
this.chart.updateOptions(this.options);
componentDidUpdate(prevProps) {
if (!this.chart) return null
const currentOptions = JSON.stringify(this.props.options);
const currentSeries = JSON.stringify(this.props.series);
const prevOptions = JSON.stringify(prevProps.options);
const prevSeries = JSON.stringify(prevProps.series);
if(prevOptions !== currentOptions){
this.chart.updateOptions(currentOptions);
}
else if(currentSeries !== prevSeries){
this.chart.updateSeries(currentSeries);
}
}

@@ -40,3 +49,7 @@ componentWillUnmount() {

render() {
return React.createElement('div', { id: this.chartContainerId, style: this.style });
return React.createElement('div', {
ref: this.setRef,
style: this.style,
...this.props
});

@@ -43,0 +56,0 @@ }

{
"name": "apex-react-charts",
"version": "1.0.2",
"version": "1.0.3",
"description": "A React Component Wrapper for ApexCharts",

@@ -5,0 +5,0 @@ "main": "index.js",

Sorry, the diff of this file is too big to display

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