diff --git a/spikes/graphs-fe/plotly/client/plotly-graph/plot.js b/spikes/graphs-fe/plotly/client/plotly-graph/plot.js deleted file mode 100644 index 3dc0a01c..00000000 --- a/spikes/graphs-fe/plotly/client/plotly-graph/plot.js +++ /dev/null @@ -1,48 +0,0 @@ -const React = require('react'); -const Plotly = require('plotly.js'); - -const Plot = React.createClass({ - propTypes: { - name: React.PropTypes.string.isRequired, - xdata: React.PropTypes.object, - ydata: React.PropTypes.object, - type: React.PropTypes.string, - mode: React.PropTypes.string, - }, - componentDidMount: function() { - const { - name, - xData, - yData, - type = 'scatter', - mode = 'markers' - } = this.props; - - Plotly.newPlot(name, [{ - x: xData, - y: yData, - mode, - type - }], { - margin: { - t: 0, r: 0, l: 30 - }, - xaxis: { - gridcolor: 'transparent' - } - }, { - displayModeBar: false - }); - }, - render: function() { - const { - name - } = this.props - - return ( -
- ); - } -}); - -module.exports = Plot; diff --git a/spikes/graphs-fe/plotly/client/plotly-graph/index.js b/spikes/graphs-fe/plotly/client/plotly.js similarity index 71% rename from spikes/graphs-fe/plotly/client/plotly-graph/index.js rename to spikes/graphs-fe/plotly/client/plotly.js index fcca8076..95df4fe1 100644 --- a/spikes/graphs-fe/plotly/client/plotly-graph/index.js +++ b/spikes/graphs-fe/plotly/client/plotly.js @@ -1,6 +1,6 @@ +const Plotly = require('react-plotlyjs'); const ReactRedux = require('react-redux'); const React = require('react'); -const Plot = require('./plot'); const { connect @@ -18,23 +18,27 @@ const PlotlyGraph = React.createClass({ const graphTypes = [{ type: 'scatter', mode: 'lines+markers' - }, { - type: 'scatter', - mode: 'line' }, { type: 'bar' }]; const graphs = graphTypes.map((graphType, i) => { - console.log(cpu, datatime); + const data = { + type: graphType.type, + mode: graphType.mode, + x: datatime, + y: cpu + }; + + const layout = { + barmode: graphType.mode + } + return ( -