diff --git a/package.json b/package.json index e71b043..308d8c3 100644 --- a/package.json +++ b/package.json @@ -10,6 +10,7 @@ "d3-scale": "^1.0.6", "d3-selection": "^1.1.0", "d3-shape": "^1.2.0", + "d3-time-format": "^2.0.5", "es6-promise": "^4.0.5", "flux": "^3.1.2", "gaugeJS": "^1.3.2", diff --git a/src/components/widget-plot.js b/src/components/widget-plot.js index 0c3d641..fb89a07 100644 --- a/src/components/widget-plot.js +++ b/src/components/widget-plot.js @@ -22,32 +22,32 @@ import React from 'react'; import Plot from './widget-plot/plot'; -//import PlotLegend from './widget-plot/plot-legend'; +import PlotLegend from './widget-plot/plot-legend'; class WidgetPlot extends React.Component { render() { const simulator = this.props.widget.simulator; const simulation = this.props.simulation; - //let legendSignals = []; + let legendSignals = []; let simulatorData = []; // Proceed if a simulation with models and a simulator are available if (simulator && simulation && simulation.models.length > 0) { - //const model = simulation.models.find( model => model.simulator.node === simulator.node && model.simulator.simulator === simulator.simulator ); - //const chosenSignals = this.props.widget.signals; + const model = simulation.models.find( model => model.simulator.node === simulator.node && model.simulator.simulator === simulator.simulator ); + const chosenSignals = this.props.widget.signals; simulatorData = this.props.data[simulator.node][simulator.simulator].values.filter((values, index) => ( this.props.widget.signals.findIndex(value => value === index) !== -1 )); // Query the signals that will be displayed in the legend - /*legendSignals = model.mapping.reduce( (accum, model_signal, signal_index) => { + legendSignals = model.mapping.reduce( (accum, model_signal, signal_index) => { if (chosenSignals.includes(signal_index)) { accum.push({ index: signal_index, name: model_signal.name }); } return accum; - }, []);*/ + }, []); } return ( @@ -57,11 +57,13 @@ class WidgetPlot extends React.Component {