diff --git a/src/components/widget-plot.js b/src/components/widget-plot.js index cccbca1..ef1d04c 100644 --- a/src/components/widget-plot.js +++ b/src/components/widget-plot.js @@ -50,7 +50,7 @@ class WidgetPlot extends React.Component { // Query the signals that will be displayed in the legend const legend = model.mapping.reduce( (accum, model_signal, signal_index) => { if (chosenSignals.includes(signal_index)) { - accum.push({ index: signal_index, name: model_signal.name }); + accum.push({ index: signal_index, name: model_signal.name, type: model_signal.type }); } return accum; diff --git a/src/components/widget-plot/plot-legend.js b/src/components/widget-plot/plot-legend.js index fcaeae0..9c8ad71 100644 --- a/src/components/widget-plot/plot-legend.js +++ b/src/components/widget-plot/plot-legend.js @@ -17,7 +17,7 @@ class PlotLegend extends React.Component { return
{this.props.signals.map(signal =>
-   {signal.name} +   {signal.name} [{signal.type}]
)}
; diff --git a/src/components/widget-plot/plot.js b/src/components/widget-plot/plot.js index 6043726..16ef357 100644 --- a/src/components/widget-plot/plot.js +++ b/src/components/widget-plot/plot.js @@ -149,15 +149,26 @@ class Plot extends React.Component { } render() { - return - select(node).call(this.state.xAxis)} style={{ transform: `translateY(${this.props.height}px)` }} /> - select(node).call(this.state.yAxis)} style={{ transform: `translateX(${leftMargin}px)`}} /> + const yLabelPos = { + x: 12, + y: this.props.height / 2 + } + + let labelMargin = 0; + + if (this.props.yLabel !== "") { + labelMargin = 20; + } + + return + select(node).call(this.state.xAxis)} style={{ transform: `translateX(${labelMargin}px) translateY(${this.props.height}px)` }} /> + select(node).call(this.state.yAxis)} style={{ transform: `translateX(${leftMargin + labelMargin}px)`}} /> - {this.props.yLabel} + {this.props.yLabel} - +