react-jsx-highcharts
Advanced tools
Comparing version 1.3.2 to 1.3.3-pre.1
{ | ||
"name": "react-jsx-highcharts", | ||
"version": "1.3.2", | ||
"version": "1.3.3-pre.1", | ||
"description": "Highcharts charts built using React components", | ||
@@ -19,3 +19,4 @@ "main": "dist/react-jsx-highcharts.min.js", | ||
{ "name": "Alex Mayants", "url": "https://github.com/AlexMayants" }, | ||
{ "name": "mrawdon", "url": "https://github.com/mrawdon" } | ||
{ "name": "mrawdon", "url": "https://github.com/mrawdon" }, | ||
{ "name": "Ercan Akyürek", "url": "https://github.com/geforcefan" } | ||
], | ||
@@ -22,0 +23,0 @@ "license": "MIT", |
@@ -53,5 +53,5 @@ import React, { Component } from 'react'; | ||
addPlotBand={cleanPropsBeforeUpdate(addPlotBand)} | ||
removePlotBand={cleanPropsBeforeUpdate(removePlotBand)} | ||
removePlotBand={removePlotBand} | ||
addPlotLine={cleanPropsBeforeUpdate(addPlotLine)} | ||
removePlotLine={cleanPropsBeforeUpdate(removePlotLine)} | ||
removePlotLine={removePlotLine} | ||
getExtremes={getExtremes} | ||
@@ -58,0 +58,0 @@ setExtremes={setExtremes} |
import { Component } from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import addEventProps, { getNonEventHandlerProps } from '../../utils/events'; | ||
import { validSeriesTypes } from '../../utils/propTypeValidators'; | ||
@@ -9,3 +8,3 @@ class Chart extends Component { | ||
static propTypes = { | ||
type: validSeriesTypes.isRequired, | ||
type: PropTypes.string.isRequired, | ||
width: PropTypes.number, | ||
@@ -12,0 +11,0 @@ height: PropTypes.number, |
@@ -29,3 +29,3 @@ import React, { Component, Children, cloneElement, isValidElement } from 'react'; | ||
componentDidMount () { | ||
const { axisId, dimension, ...rest } = this.props; | ||
const { axisId, dimension, children, ...rest } = this.props; | ||
this.props.addPlotBand(rest); | ||
@@ -37,2 +37,8 @@ this.setState({ | ||
componentDidUpdate (prevProps) { | ||
this.props.removePlotBand(prevProps.id); | ||
const { axisId, dimension, children, ...rest } = this.props; | ||
this.props.addPlotBand(rest); | ||
} | ||
componentWillUnmount () { | ||
@@ -39,0 +45,0 @@ this.props.removePlotBand(this.props.id); |
@@ -10,4 +10,3 @@ import { Component } from 'react'; | ||
id: PropTypes.string, | ||
addPlotBand: PropTypes.func, // Provided by AxisProvider | ||
removePlotBand: PropTypes.func // Provided by AxisProvider | ||
getAxis: PropTypes.func // Provided by AxisProvider | ||
}; | ||
@@ -30,5 +29,4 @@ | ||
this.updatePlotBand = this.updatePlotBand.bind(this); | ||
this.updatePlotBandLabel = this.updatePlotBandLabel.bind(this); | ||
this.getLabelProps = this.getLabelProps.bind(this); | ||
this.getOtherProps = this.getOtherProps.bind(this); | ||
} | ||
@@ -38,3 +36,3 @@ | ||
const { children, ...rest } = this.props; | ||
this.updatePlotBand({ | ||
this.updatePlotBandLabel({ | ||
text: children, | ||
@@ -45,5 +43,13 @@ ...rest | ||
componentDidUpdate () { | ||
const { children, ...rest } = this.props; | ||
this.updatePlotBandLabel({ | ||
text: children, | ||
...rest | ||
}); | ||
} | ||
componentWillUnmount () { | ||
const { children, ...rest } = this.props; | ||
this.updatePlotBand({ | ||
this.updatePlotBandLabel({ | ||
text: null, | ||
@@ -60,19 +66,13 @@ ...rest | ||
getOtherProps (props) { | ||
return pickBy(props, (value, propName) => { | ||
return PlotBandLabel.labelProps.indexOf(propName) === -1; | ||
}); | ||
} | ||
updatePlotBandLabel (config) { | ||
const { id, getAxis } = this.props; | ||
const axis = getAxis(); | ||
updatePlotBand (config) { | ||
const { id, addPlotBand, removePlotBand } = this.props; | ||
const labelProps = this.getLabelProps(config); | ||
const otherProps = this.getOtherProps(config); | ||
removePlotBand(id); | ||
addPlotBand({ | ||
...otherProps, | ||
label: { | ||
...labelProps | ||
window.setTimeout(() => { | ||
const plotBand = axis.plotLinesAndBands.find(band => band.id === id); | ||
if (plotBand) { | ||
plotBand.options.label = this.getLabelProps(config); | ||
plotBand.render(); | ||
} | ||
}); | ||
}, 1); | ||
} | ||
@@ -79,0 +79,0 @@ |
@@ -11,4 +11,3 @@ import React, { Component, Children, cloneElement, isValidElement } from 'react'; | ||
dimension: PropTypes.string, // Provided by Axis component | ||
from: PropTypes.any.isRequired, | ||
to: PropTypes.any.isRequired, | ||
value: PropTypes.any.isRequired, | ||
xAxis: PropTypes.string, | ||
@@ -30,3 +29,3 @@ yAxis: PropTypes.string, | ||
componentDidMount () { | ||
const { axisId, dimension, ...rest } = this.props; | ||
const { axisId, dimension, children, ...rest } = this.props; | ||
this.props.addPlotLine(rest); | ||
@@ -38,2 +37,8 @@ this.setState({ | ||
componentDidUpdate (prevProps) { | ||
this.props.removePlotLine(prevProps.id); | ||
const { axisId, dimension, children, ...rest } = this.props; | ||
this.props.addPlotLine(rest); | ||
} | ||
componentWillUnmount () { | ||
@@ -40,0 +45,0 @@ this.props.removePlotLine(this.props.id); |
@@ -10,4 +10,3 @@ import { Component } from 'react'; | ||
id: PropTypes.string, | ||
addPlotLine: PropTypes.func, // Provided by AxisProvider | ||
removePlotLine: PropTypes.func // Provided by AxisProvider | ||
getAxis: PropTypes.func // Provided by AxisProvider | ||
}; | ||
@@ -30,5 +29,4 @@ | ||
this.updatePlotLine = this.updatePlotLine.bind(this); | ||
this.updatePlotLineLabel = this.updatePlotLineLabel.bind(this); | ||
this.getLabelProps = this.getLabelProps.bind(this); | ||
this.getOtherProps = this.getOtherProps.bind(this); | ||
} | ||
@@ -38,3 +36,3 @@ | ||
const { children, ...rest } = this.props; | ||
this.updatePlotLine({ | ||
this.updatePlotLineLabel({ | ||
text: children, | ||
@@ -45,5 +43,13 @@ ...rest | ||
componentDidUpdate () { | ||
const { children, ...rest } = this.props; | ||
this.updatePlotLineLabel({ | ||
text: children, | ||
...rest | ||
}); | ||
} | ||
componentWillUnmount () { | ||
const { children, ...rest } = this.props; | ||
this.updatePlotLine({ | ||
this.updatePlotLineLabel({ | ||
text: null, | ||
@@ -60,19 +66,13 @@ ...rest | ||
getOtherProps (props) { | ||
return pickBy(props, (value, propName) => { | ||
return PlotLineLabel.labelProps.indexOf(propName) === -1; | ||
}); | ||
} | ||
updatePlotLineLabel (config) { | ||
const { id, getAxis } = this.props; | ||
const axis = getAxis(); | ||
updatePlotLine (config) { | ||
const { id, addPlotLine, removePlotLine } = this.props; | ||
const labelProps = this.getLabelProps(config); | ||
const otherProps = this.getOtherProps(config); | ||
removePlotLine(id); | ||
addPlotLine({ | ||
...otherProps, | ||
label: { | ||
...labelProps | ||
window.setTimeout(() => { | ||
const plotLine = axis.plotLinesAndBands.find(line => line.id === id); | ||
if (plotLine) { | ||
plotLine.options.label = this.getLabelProps(config); | ||
plotLine.render(); | ||
} | ||
}); | ||
}, 1); | ||
} | ||
@@ -79,0 +79,0 @@ |
@@ -8,3 +8,2 @@ import { Component } from 'react'; | ||
import getModifiedProps from '../../utils/getModifiedProps'; | ||
import { validSeriesTypes } from '../../utils/propTypeValidators'; | ||
@@ -15,3 +14,3 @@ class Series extends Component { | ||
id: PropTypes.string.isRequired, | ||
type: validSeriesTypes.isRequired, | ||
type: PropTypes.string.isRequired, | ||
axisId: PropTypes.string, // Provided by Axis component | ||
@@ -18,0 +17,0 @@ dimension: PropTypes.string, // Provided by Axis component |
@@ -43,2 +43,7 @@ import React, { Component } from 'react'; | ||
componentWillUnmount() { | ||
const { getChart } = this.props; | ||
Highcharts.removeEvent(getChart(), 'addSeries', this.handleSeriesAdded); | ||
} | ||
handleSeriesAdded (e) { | ||
@@ -45,0 +50,0 @@ if (e.options.id !== this.props.id) return; |
import PropTypes from 'prop-types'; | ||
export const validSeriesTypes = PropTypes.oneOf([ | ||
'area', 'arearange', 'areaspline', 'areasplinerange', | ||
'bar', 'boxplot', 'bubble', 'candlestick', 'column', | ||
'columnrange', 'errorbar', 'flags', 'funnel', | ||
'line', 'ohlc', 'pie', 'polygon', 'pyramid', 'scatter', | ||
'spline', 'treemap', 'waterfall' | ||
]); | ||
export const validChartTypes = PropTypes.oneOf([ | ||
@@ -12,0 +4,0 @@ 'chart', 'stockChart' |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
Deprecated
MaintenanceThe maintainer of the package marked it as deprecated. This could indicate that a single version should not be used, or that the package is no longer maintained and any new vulnerabilities will not be fixed.
Found 1 instance in 1 package
536305
9747
0
2