Commit 89686464 authored by Dorian Goepp's avatar Dorian Goepp
Browse files

third tentative fix for line chart field and topic name

parent b2dd2c1b
......@@ -86,7 +86,8 @@ class RosLineChart extends Component {
* Extract a field from a ros message and add it to the state, for plotting.
* If there are already maxPoints in storage, we remove the oldest data point.
* @param {string} field path to the field to be extracted from incoming messages
* @param {Object} curve has two entries, `field`, path to the field to be extracted from incoming messages
* and `topic` the ROS topic from which we extract the field.
* @param {integer} maxPoints mupper limit on the number of data entries for the plot
* @param {Object} message messages from a ROS topic
......@@ -94,13 +95,14 @@ class RosLineChart extends Component {
this.setState((state) => {
let new_data =;
const field = curve.field;
if (!(field in new_data)) {
new_data[field] = []
const data_field = curve.topic+field;
if (!(data_field in new_data)) {
new_data[data_field] = []
if (new_data[field].length >= maxPoints) {
if (new_data[data_field].length >= maxPoints) {
new_data[curve.topic+field] =[curve.topic+field].concat([{"y": property(field)(message)}])
new_data[data_field] =[data_field].concat([{"y": property(field)(message)}])
return {
data: new_data,
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment