From 26c5beff95de5d9fd18447cbafce680e62bf0dac Mon Sep 17 00:00:00 2001 From: Laurianne Charrier <laurianne.charrier@hoomano.com> Date: Wed, 3 Apr 2019 17:31:38 +0200 Subject: [PATCH] linechart readme added --- src/LineChart/RosLineChart.js | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/src/LineChart/RosLineChart.js b/src/LineChart/RosLineChart.js index 98fa0d1..79983bc 100644 --- a/src/LineChart/RosLineChart.js +++ b/src/LineChart/RosLineChart.js @@ -28,7 +28,7 @@ class RosLineChart extends Component { this.listener = new RosLib.Topic(Object.assign({ros : this.props.ros}, this.state.topic)); this.listener.subscribe(function(message) { - + this.setState((state) => { let fields; if (!('fields' in this.state.topic) && ('field' in this.state.topic)) { @@ -36,7 +36,7 @@ class RosLineChart extends Component { } else { fields = this.state.topic.fields; } - + let new_data = this.state.data; fields.forEach((field) => { if (!(field in new_data)) { @@ -61,8 +61,22 @@ class RosLineChart extends Component { } render () { + const config = this.props.node.getConfig() + + if (config.displayMode === "readme") { + return <div> + <h2>This <b>linechart</b> represents a <b>measure</b> evolving over time.</h2> + </div>; + } + + if (config.displayMode === "settings") { + return <div> + <p>config panel</p> + </div>; + } + return <SizedLineChart data={this.state.data} xLabel={this.state.xLabel} yLabel={this.state.yLabel} {...this.props}/> } } -export {RosLineChart} \ No newline at end of file +export {RosLineChart} -- GitLab