@@ -6,7 +6,7 @@ import 'react-select/dist/react-select.css';
66import brace from 'brace' ; // eslint-disable-line no-unused-vars
77import AceEditor from 'react-ace' ;
88import Select from 'react-select' ;
9- import PlotlyEditor , { DefaultEditor , Panel } from '../src' ;
9+ import PlotlyEditor , { DefaultEditor , Panel , GraphTransformsPanel } from '../src' ;
1010import Inspector from 'react-inspector' ;
1111import 'brace/mode/json' ;
1212import 'brace/theme/textmate' ;
@@ -15,13 +15,21 @@ import 'brace/theme/textmate';
1515import ACCESS_TOKENS from '../accessTokens' ;
1616
1717const dataSources = {
18- ints : [ 1 , 2 , 3 , 4 , 5 ] , // eslint-disable-line no-magic-numbers
19- 'jagged ints' : [ 2 , 1 , 3 , 5 , 4 ] , // eslint-disable-line no-magic-numbers
18+ ints : [ 1 , 2 , 3 , 4 , 5 , 6 ] , // eslint-disable-line no-magic-numbers
19+ 'jagged ints' : [ 2 , 1 , 3 , 5 , 4 , 6 ] , // eslint-disable-line no-magic-numbers
20+ 'toggle ints' : [ 1 , - 1 , 1 , - 1 , 1 , - 1 ] , // eslint-disable-line no-magic-numbers
2021 'big ints' : [ 1000 , 10100 , 10000 , 20000 , 100000 ] , // eslint-disable-line no-magic-numbers
21- dates : [ '2010-01-01' , '2010-07-01' , '2011-01-01' , '2011-07-01' , '2012-01-01' ] ,
22- months : [ 'January' , 'February' , 'March' , 'April' , 'May' ] ,
23- colors : [ 'red' , 'orange' , 'yellow' , 'green' , 'blue' ] ,
24- justblue : [ 'blue' ] ,
22+ dates : [
23+ '2010-01-01' ,
24+ '2010-07-01' ,
25+ '2011-01-01' ,
26+ '2011-07-01' ,
27+ '2012-01-01' ,
28+ '2012-06-01' ,
29+ ] ,
30+ months : [ 'January' , 'February' , 'March' , 'April' , 'May' , 'June' ] ,
31+ colors : [ 'red' , 'orange' , 'yellow' , 'green' , 'blue' , 'indigo' ] ,
32+ 'blue and red' : [ 'blue' , 'red' ] ,
2533} ;
2634const dataSourceOptions = Object . keys ( dataSources ) . map ( name => ( {
2735 value : name ,
@@ -56,13 +64,14 @@ class App extends Component {
5664 }
5765
5866 loadMock ( mockIndex ) {
59- fetch (
60- 'https://api.github.com/repos/plotly/plotly.js/contents/test/image/mocks/' +
61- this . state . mocks [ mockIndex ] ,
62- {
63- headers : new Headers ( { Accept : 'application/vnd.github.v3.raw' } ) ,
64- }
65- )
67+ const mockName = this . state . mocks [ mockIndex ] ;
68+ const prefix =
69+ mockName [ 0 ] === '/'
70+ ? ''
71+ : 'https://api.github.com/repos/plotly/plotly.js/contents/test/image/mocks/' ;
72+ fetch ( prefix + mockName , {
73+ headers : new Headers ( { Accept : 'application/vnd.github.v3.raw' } ) ,
74+ } )
6675 . then ( response => response . json ( ) )
6776 . then ( figure => {
6877 const { data, layout, frames} = figure ;
@@ -109,6 +118,7 @@ class App extends Component {
109118 advancedTraceTypeSelector
110119 >
111120 < DefaultEditor >
121+ < GraphTransformsPanel group = "Dev" name = "Transforms" />
112122 < Panel group = "Dev" name = "JSON" >
113123 < div className = "mocks" >
114124 < Select
@@ -126,14 +136,13 @@ class App extends Component {
126136 placeholder = { 'Search for a mock' }
127137 />
128138 </ div >
129- < br />
130139 < button
140+ className = "devbtn"
131141 onClick = { this . loadJSON }
132142 style = { { background : this . state . json_error ? 'pink' : 'white' } }
133143 >
134144 Save
135145 </ button >
136- < br />
137146 < AceEditor
138147 mode = "json"
139148 theme = "textmate"
@@ -152,10 +161,12 @@ class App extends Component {
152161 exec : this . loadJSON ,
153162 } ,
154163 ] }
164+ editorProps = { { $blockScrolling : true } }
155165 />
156166 </ Panel >
157167 < Panel group = "Dev" name = "Inspector" >
158168 < button
169+ className = "devbtn"
159170 onClick = { ( ) => {
160171 const gd = document . getElementById ( 'gd' ) || { } ;
161172 this . setState ( {
@@ -168,7 +179,6 @@ class App extends Component {
168179 >
169180 Refresh
170181 </ button >
171- < br />
172182 < div style = { { height : '80vh' } } >
173183 < Inspector
174184 data = { { _full : this . state . full } }
0 commit comments