@@ -20,25 +20,25 @@ object Almond {
20
20
21
21
val requireInit =
22
22
if (offline)
23
- s """ define('plotly', function(require, exports, module) {
24
- | ${Plotly .plotlyMinJs}
25
- |});
23
+ s """ define('plotly', function(require, exports, module) {
24
+ | ${Plotly .plotlyMinJs}
25
+ |});
26
26
""" .stripMargin
27
27
else
28
28
s """ require.config({
29
- | paths: {
30
- | d3: 'https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.17/d3.min',
31
- | plotly: 'https://cdn.plot.ly/plotly- ${Plotly .plotlyVersion}.min',
32
- | jquery: 'https://code.jquery.com/jquery-3.3.1.min'
33
- | },
34
- |
35
- | shim: {
36
- | plotly: {
37
- | deps: ['d3', 'jquery'],
38
- | exports: 'plotly'
39
- | }
40
- | }
41
- |});
29
+ | paths: {
30
+ | d3: 'https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.17/d3.min',
31
+ | plotly: 'https://cdn.plot.ly/plotly- ${Plotly .plotlyVersion}.min',
32
+ | jquery: 'https://code.jquery.com/jquery-3.3.1.min'
33
+ | },
34
+ |
35
+ | shim: {
36
+ | plotly: {
37
+ | deps: ['d3', 'jquery'],
38
+ | exports: 'plotly'
39
+ | }
40
+ | }
41
+ |});
42
42
""" .stripMargin
43
43
44
44
val html = s """
@@ -57,12 +57,12 @@ object Almond {
57
57
}
58
58
59
59
def plotJs (
60
- data : Seq [Trace ],
61
- layout : Layout ,
62
- config : Config ,
63
- div : String = " "
60
+ data : Seq [Trace ],
61
+ layout : Layout ,
62
+ config : Config ,
63
+ div : String = " "
64
64
)(implicit
65
- publish : OutputHandler
65
+ publish : OutputHandler
66
66
): String = {
67
67
68
68
val (div0, divPart) =
@@ -73,12 +73,12 @@ object Almond {
73
73
(div, " " )
74
74
75
75
val baseJs = Plotly .jsSnippet(div0, data, layout, config)
76
- val json = Plotly .jsonSnippet(data, layout, config)
76
+ val json = Plotly .jsonSnippet(data, layout, config)
77
77
78
78
val js =
79
- s """ require(['plotly'], function(Plotly) {
80
- | $baseJs
81
- |});
79
+ s """ require(['plotly'], function(Plotly) {
80
+ | $baseJs
81
+ |});
82
82
""" .stripMargin
83
83
84
84
val data0 = DisplayData (
@@ -100,12 +100,12 @@ object Almond {
100
100
almond.display.UpdatableDisplay .generateDiv(" plot-" )
101
101
102
102
def plot (
103
- data : Seq [Trace ],
104
- layout : Layout = Layout (),
105
- config : Config = Config (),
106
- div : String = " "
103
+ data : Seq [Trace ],
104
+ layout : Layout = Layout (),
105
+ config : Config = Config (),
106
+ div : String = " "
107
107
)(implicit
108
- publish : OutputHandler
108
+ publish : OutputHandler
109
109
): String = {
110
110
111
111
if (! Internal .initialized)
@@ -123,39 +123,39 @@ object Almond {
123
123
124
124
@ deprecated(" Create a Layout and / or a Config, and call one of the other plot methods instead" , " 0.8.0" )
125
125
def plot (
126
- title : String = null ,
127
- legend : Legend = null ,
128
- width : JInt = null ,
129
- height : JInt = null ,
130
- showlegend : JBoolean = null ,
131
- xaxis : Axis = null ,
132
- yaxis : Axis = null ,
133
- xaxis1 : Axis = null ,
134
- xaxis2 : Axis = null ,
135
- xaxis3 : Axis = null ,
136
- xaxis4 : Axis = null ,
137
- yaxis1 : Axis = null ,
138
- yaxis2 : Axis = null ,
139
- yaxis3 : Axis = null ,
140
- yaxis4 : Axis = null ,
141
- barmode : BarMode = null ,
142
- autosize : JBoolean = null ,
143
- margin : Margin = null ,
144
- annotations : Seq [Annotation ] = null ,
145
- plot_bgcolor : Color = null ,
146
- paper_bgcolor : Color = null ,
147
- font : Font = null ,
148
- bargap : JDouble = null ,
149
- bargroupgap : JDouble = null ,
150
- hovermode : HoverMode = null ,
151
- boxmode : BoxMode = null ,
152
- editable : JBoolean = null ,
153
- responsive : JBoolean = null ,
154
- showEditInChartStudio : JBoolean = null ,
155
- plotlyServerURL : String = null ,
156
- div : String = " "
126
+ title : String = null ,
127
+ legend : Legend = null ,
128
+ width : JInt = null ,
129
+ height : JInt = null ,
130
+ showlegend : JBoolean = null ,
131
+ xaxis : Axis = null ,
132
+ yaxis : Axis = null ,
133
+ xaxis1 : Axis = null ,
134
+ xaxis2 : Axis = null ,
135
+ xaxis3 : Axis = null ,
136
+ xaxis4 : Axis = null ,
137
+ yaxis1 : Axis = null ,
138
+ yaxis2 : Axis = null ,
139
+ yaxis3 : Axis = null ,
140
+ yaxis4 : Axis = null ,
141
+ barmode : BarMode = null ,
142
+ autosize : JBoolean = null ,
143
+ margin : Margin = null ,
144
+ annotations : Seq [Annotation ] = null ,
145
+ plot_bgcolor : Color = null ,
146
+ paper_bgcolor : Color = null ,
147
+ font : Font = null ,
148
+ bargap : JDouble = null ,
149
+ bargroupgap : JDouble = null ,
150
+ hovermode : HoverMode = null ,
151
+ boxmode : BoxMode = null ,
152
+ editable : JBoolean = null ,
153
+ responsive : JBoolean = null ,
154
+ showEditInChartStudio : JBoolean = null ,
155
+ plotlyServerURL : String = null ,
156
+ div : String = " "
157
157
)(implicit
158
- publish : OutputHandler
158
+ publish : OutputHandler
159
159
): String =
160
160
plot(
161
161
Layout (
@@ -195,77 +195,77 @@ object Almond {
195
195
)
196
196
197
197
def plot (
198
- layout : Layout ,
199
- config : Config ,
200
- div : String
198
+ layout : Layout ,
199
+ config : Config ,
200
+ div : String
201
201
)(implicit
202
- publish : OutputHandler
202
+ publish : OutputHandler
203
203
): String =
204
204
Almond .plot(Seq (data), layout, config, div = div)
205
205
206
206
def plot ()(implicit
207
- publish : OutputHandler
207
+ publish : OutputHandler
208
208
): String =
209
209
plot(Layout (), Config (), " " )
210
210
211
211
def plot (
212
- layout : Layout
212
+ layout : Layout
213
213
)(implicit
214
- publish : OutputHandler
214
+ publish : OutputHandler
215
215
): String =
216
216
plot(layout, Config (), " " )
217
217
218
218
def plot (
219
- config : Config
219
+ config : Config
220
220
)(implicit
221
- publish : OutputHandler
221
+ publish : OutputHandler
222
222
): String =
223
223
plot(Layout (), config, " " )
224
224
225
225
def plot (
226
- layout : Layout ,
227
- config : Config
226
+ layout : Layout ,
227
+ config : Config
228
228
)(implicit
229
- publish : OutputHandler
229
+ publish : OutputHandler
230
230
): String =
231
231
plot(layout, config, " " )
232
232
}
233
233
234
234
implicit class DataSeqOps (val data : Seq [Trace ]) extends AnyVal {
235
235
def plot (
236
- title : String = null ,
237
- legend : Legend = null ,
238
- width : JInt = null ,
239
- height : JInt = null ,
240
- showlegend : JBoolean = null ,
241
- xaxis : Axis = null ,
242
- yaxis : Axis = null ,
243
- xaxis1 : Axis = null ,
244
- xaxis2 : Axis = null ,
245
- xaxis3 : Axis = null ,
246
- xaxis4 : Axis = null ,
247
- yaxis1 : Axis = null ,
248
- yaxis2 : Axis = null ,
249
- yaxis3 : Axis = null ,
250
- yaxis4 : Axis = null ,
251
- barmode : BarMode = null ,
252
- autosize : JBoolean = null ,
253
- margin : Margin = null ,
254
- annotations : Seq [Annotation ] = null ,
255
- plot_bgcolor : Color = null ,
256
- paper_bgcolor : Color = null ,
257
- font : Font = null ,
258
- bargap : JDouble = null ,
259
- bargroupgap : JDouble = null ,
260
- hovermode : HoverMode = null ,
261
- boxmode : BoxMode = null ,
262
- editable : JBoolean = null ,
263
- responsive : JBoolean = null ,
264
- showEditInChartStudio : JBoolean = null ,
265
- plotlyServerURL : String = null ,
266
- div : String = " "
236
+ title : String = null ,
237
+ legend : Legend = null ,
238
+ width : JInt = null ,
239
+ height : JInt = null ,
240
+ showlegend : JBoolean = null ,
241
+ xaxis : Axis = null ,
242
+ yaxis : Axis = null ,
243
+ xaxis1 : Axis = null ,
244
+ xaxis2 : Axis = null ,
245
+ xaxis3 : Axis = null ,
246
+ xaxis4 : Axis = null ,
247
+ yaxis1 : Axis = null ,
248
+ yaxis2 : Axis = null ,
249
+ yaxis3 : Axis = null ,
250
+ yaxis4 : Axis = null ,
251
+ barmode : BarMode = null ,
252
+ autosize : JBoolean = null ,
253
+ margin : Margin = null ,
254
+ annotations : Seq [Annotation ] = null ,
255
+ plot_bgcolor : Color = null ,
256
+ paper_bgcolor : Color = null ,
257
+ font : Font = null ,
258
+ bargap : JDouble = null ,
259
+ bargroupgap : JDouble = null ,
260
+ hovermode : HoverMode = null ,
261
+ boxmode : BoxMode = null ,
262
+ editable : JBoolean = null ,
263
+ responsive : JBoolean = null ,
264
+ showEditInChartStudio : JBoolean = null ,
265
+ plotlyServerURL : String = null ,
266
+ div : String = " "
267
267
)(implicit
268
- publish : OutputHandler
268
+ publish : OutputHandler
269
269
): String =
270
270
plot(
271
271
Layout (
@@ -305,11 +305,11 @@ object Almond {
305
305
)
306
306
307
307
def plot (
308
- layout : Layout ,
309
- config : Config ,
310
- div : String
308
+ layout : Layout ,
309
+ config : Config ,
310
+ div : String
311
311
)(implicit
312
- publish : OutputHandler
312
+ publish : OutputHandler
313
313
): String =
314
314
Almond .plot(data, layout, config, div = div)
315
315
}
0 commit comments