File tree 4 files changed +74
-0
lines changed
4 files changed +74
-0
lines changed Original file line number Diff line number Diff line change
1
+ node_modules
2
+ .idea
3
+ yarn.lock
4
+ .next
Original file line number Diff line number Diff line change
1
+ import React from 'react' ;
2
+ import plotly from 'plotly.js/dist/plotly' ;
3
+ import createPlotComponent from 'react-plotly.js/factory' ;
4
+
5
+ const Plot = createPlotComponent ( plotly ) ;
6
+
7
+ export default ( ) => (
8
+ < Plot
9
+ data = { [
10
+ {
11
+ type : 'scatter' ,
12
+ mode : 'lines+points' ,
13
+ x : [ 1 , 2 , 3 ] ,
14
+ y : [ 2 , 6 , 3 ] ,
15
+ marker : { color : 'red' }
16
+ } ,
17
+ {
18
+ type : 'bar' ,
19
+ x : [ 1 , 2 , 3 ] ,
20
+ y : [ 2 , 5 , 3 ]
21
+ }
22
+ ] }
23
+
24
+ layout = { {
25
+ width : 320 ,
26
+ height : 240 ,
27
+ title : 'A Fancy Plot'
28
+ } }
29
+ />
30
+ )
Original file line number Diff line number Diff line change
1
+ {
2
+ "name" : " next.js-with-react-plotly.js" ,
3
+ "description" : " A next.js example with react-plotly.js" ,
4
+ "version" : " 0.0.1" ,
5
+ "author" : " Thomas Osmonson <hello@ineffable.co>" ,
6
+ "bugs" : {
7
+ "url" : " https://github.com/aulneau/next.js-with-react-plotly.js/issues" ,
8
+ "email" : " hello@ineffable.co"
9
+ },
10
+ "dependencies" : {
11
+ "fs" : " ^0.0.1-security" ,
12
+ "next" : " ^5.0.0" ,
13
+ "plotly.js" : " ^1.34.0" ,
14
+ "react" : " ^16.2.0" ,
15
+ "react-dom" : " ^16.2.0" ,
16
+ "react-plotly.js" : " ^1.4.0"
17
+ },
18
+ "repository" : " aulneau/next.js-with-react-plotly.js" ,
19
+ "scripts" : {
20
+ "build" : " next build" ,
21
+ "dev" : " next" ,
22
+ "start" : " next start"
23
+ }
24
+ }
Original file line number Diff line number Diff line change
1
+ import React , { Fragment } from 'react' ;
2
+ import Head from 'next/head'
3
+ import dynamic from 'next/dynamic'
4
+
5
+ const DynamicPlot = dynamic ( import ( '../components/plot' ) , {
6
+ ssr : false
7
+ } )
8
+
9
+ export default ( ) => (
10
+ < Fragment >
11
+ < Head >
12
+ < title > next.js react-plotly.js example</ title >
13
+ </ Head >
14
+ < DynamicPlot />
15
+ </ Fragment >
16
+ )
You can’t perform that action at this time.
0 commit comments