diff --git a/src/components/CanGraph.js b/src/components/CanGraph.js index db72928..c684c76 100644 --- a/src/components/CanGraph.js +++ b/src/components/CanGraph.js @@ -88,9 +88,13 @@ export default class CanGraph extends Component { } } - return JSON.stringify(this.state) !== JSON.stringify(nextState) - || this.visualChanged(this.props, nextProps) - || this.dataChanged(this.props, nextProps); + const dataChanged = this.dataChanged(this.props, nextProps); + if(dataChanged) { + this.view.run(); + } + return dataChanged + || JSON.stringify(this.state) !== JSON.stringify(nextState) + || this.visualChanged(this.props, nextProps); } componentDidUpdate(prevProps, prevState) { diff --git a/src/vega/CanPlot.js b/src/vega/CanPlot.js index 042e1d0..819a3cf 100644 --- a/src/vega/CanPlot.js +++ b/src/vega/CanPlot.js @@ -4,7 +4,8 @@ export default createClassFromSpec('CanPlot', { "$schema": "https://vega.github.io/schema/vega/v3.0.json", "width": 500, "height": 200, - "padding": 5, + "padding": "auto", + "autosize": {"type": "pad", "resize": true}, "signals": [ { "name": "tipTime", @@ -98,8 +99,6 @@ export default createClassFromSpec('CanPlot', { "interactive": true, "encode": { "enter": { - "width": {"value": 500}, - "height": {"value": 200}, "fill": {"value": "transparent"} } },