Commit f6160706 authored by Tamas Kecskes's avatar Tamas Kecskes
Browse files

Fixes and layout fine-tuning.

parent f4c42ead
Loading
Loading
Loading
Loading
+4 −4
Changes for src/visualizers/panels/SimulationResultPlotter/SimulationResultPlotterControl.js: 4 added lines, 4 removed lines.
Original line number Diff line number Diff line
@@ -87,13 +87,13 @@ define([
        }
    };

    SimulationResultPlotterControl.prototype._checkForChange = function () {
    SimulationResultPlotterControl.prototype._isChanged = function () {
        var node = this._client.getNode(this._currentNodeId);

        if (node == null)
            return false;

        return this._currentHash == node.getAttribute('simRes');
        return this._currentHash !== node.getAttribute('simRes');
    };

    SimulationResultPlotterControl.prototype._buildPlotData = function () {
@@ -124,7 +124,7 @@ define([
                            return;
                        }

                        plot.push({x: timeSeries.time, y: timeSeries[key], name: key, mode: mode});
                        plot.push({x: timeSeries.time, y: timeSeries[key], name: key, mode: mode, marker: {size: 2}});
                    });
                    self._currentPlotData = plot;
                    self._widget.initPlot(self._currentPlotData);
@@ -200,7 +200,7 @@ define([
    };

    SimulationResultPlotterControl.prototype._onUpdate = function (gmeId) {
        if (this._checkChanged()) {
        if (this._isChanged()) {
            this._buildPlotData();
        }
    };
+19 −4
Changes for src/visualizers/widgets/SimulationResultPlotter/SimulationResultPlotterWidget.js: 19 added lines, 4 removed lines.
Original line number Diff line number Diff line
@@ -32,20 +32,35 @@ define([

        // set widget class
        this._el.addClass(WIDGET_CLASS);
        this._plotEl = $(SimulationResultPlotterHTML);
        this._plotEl.width(width);
        this._plotEl.height(height);

        // Create a dummy header
        // this._el.append('<h3>SimulationResultPlotter Events:</h3>');
        console.log(Plotly);
        this._el.append($(SimulationResultPlotterHTML));
        this._el.append(this._plotEl);
    };

    SimulationResultPlotterWidget.prototype.onWidgetContainerResize = function (width, height) {
        this._logger.debug('Widget is resizing...');
        this._plotEl.width(width);
        this._plotEl.height(height);
        if (this._plotExists) {
            Plotly.relayout('plotContainer', {
                width: width,
                height: height
            });
        }
    };

    SimulationResultPlotterWidget.prototype.initPlot = function (data) {
        this._plotExists = true;
        if (data) {
            Plotly.react('plotContainer', data, {});
            Plotly.react('plotContainer', data, {
                width: this._plotEl.width(),
                height: this._plotEl.height(),
                margin: {t: 20, b: 20, l: 20},
                hovermode: 'closest'
            });
        } else {
            Plotly.purge('plotContainer');
        }