Skip to content

Commit ea65348

Browse files
sglyonmalmaud
authored andcommitted
@reexport PlotlyJS, Purge src/plots.js
1 parent 0c49ca2 commit ea65348

File tree

3 files changed

+14
-267
lines changed

3 files changed

+14
-267
lines changed

REQUIRE

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ Requests 0.3.5
33
JSON
44
PlotlyJS 0.1.0
55
Compat 0.7.12
6+
Reexport

src/Plotly.jl

Lines changed: 13 additions & 115 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1-
__precompile__(true)
1+
# __precompile__(true)
22

33
module Plotly
44
using Requests
55
using JSON
6+
using Reexport: @reexport
7+
8+
@reexport using PlotlyJS
69

7-
include("plot.jl")
810
include("utils.jl")
911

1012
#export default_options, default_opts, get_config, get_plot_endpoint, get_credentials,get_content_endpoint,get_template
@@ -15,11 +17,11 @@ type CurrentPlot
1517
url::ASCIIString
1618
end
1719

18-
api_version = "v2"
20+
const api_version = "v2"
1921

20-
default_options = Dict("filename"=>"Plot from Julia API",
21-
"world_readable"=> true,
22-
"layout"=>Dict(""=>""))
22+
const default_options = Dict("filename"=>"Plot from Julia API",
23+
"world_readable"=> true,
24+
"layout"=>Dict())
2325

2426
## Taken from https://github.com/johnmyleswhite/Vega.jl/blob/master/src/Vega.jl#L51
2527
# Open a URL in a browser
@@ -29,33 +31,24 @@ function openurl(url::ASCIIString)
2931
@linux_only run(`xdg-open $url`)
3032
end
3133

32-
default_opts = Dict(
33-
"origin" => "plot",
34-
"platform" => "Julia",
35-
"version" => "0.2")
34+
const default_opts = Dict("origin" => "plot",
35+
"platform" => "Julia",
36+
"version" => "0.2")
3637

37-
function get_plot_endpoint()
38-
config = get_config()
39-
plot_endpoint = "clientresp"
40-
return "$(config.plotly_domain)/$plot_endpoint"
41-
end
38+
get_plot_endpoint() = "$(get_config().plotly_domain)/clientresp"
4239

4340
function get_content_endpoint(file_id::ASCIIString, owner::ASCIIString)
4441
config = get_config()
4542
api_endpoint = "$(config.plotly_api_domain)/$api_version/files"
4643
detail = "$owner:$file_id"
47-
custom_action = "content"
48-
content_endpoint = "$api_endpoint/$detail/$custom_action"
49-
return content_endpoint
44+
"$api_endpoint/$detail/content"
5045
end
5146

5247
function plot(data::Array,options=Dict())
5348
creds = get_credentials()
5449
endpoint = get_plot_endpoint()
5550
opt = merge(default_options,options)
5651

57-
#post("http://httpbin.org/post"; headers = Dict("Date" => "Tue, 15 Nov 1994 08:12:31 GMT"), cookies = Dict("sessionkey" => "abc"))
58-
5952
r = post(endpoint,
6053
data = merge(default_opts,
6154
Dict(
@@ -164,99 +157,4 @@ function __parseresponse(r)
164157
end
165158
end
166159

167-
function get_template(format_type::ASCIIString)
168-
if format_type == "layout"
169-
return Dict(
170-
"title"=>"Click to enter Plot title",
171-
"xaxis"=>Dict(
172-
"range"=>[-1,6],
173-
"type"=>"-",
174-
"mirror"=>true,
175-
"linecolor"=>"#000",
176-
"linewidth"=>1,
177-
"tick0"=>0,
178-
"dtick"=>2,
179-
"ticks"=>"outside",
180-
"ticklen"=>5,
181-
"tickwidth"=>1,
182-
"tickcolor"=>"#000",
183-
"nticks"=>0,
184-
"showticklabels"=>true,
185-
"tickangle"=>"auto",
186-
"exponentformat"=>"e",
187-
"showexponent"=>"all",
188-
"showgrid"=>true,
189-
"gridcolor"=>"#ddd",
190-
"gridwidth"=>1,
191-
"autorange"=>true,
192-
"autotick"=>true,
193-
"zeroline"=>true,
194-
"zerolinecolor"=>"#000",
195-
"zerolinewidth"=>1,
196-
"title"=>"Click to enter X axis title",
197-
"unit"=>"",
198-
"titlefont"=>Dict("family"=>"","size"=>0,"color"=>""),
199-
"tickfont"=>Dict("family"=>"","size"=>0,"color"=>"")),
200-
"yaxis"=>Dict(
201-
"range"=>[-1,4],
202-
"type"=>"-",
203-
"mirror"=>true,
204-
"linecolor"=>"#000",
205-
"linewidth"=>1,
206-
"tick0"=>0,
207-
"dtick"=>1,
208-
"ticks"=>"outside",
209-
"ticklen"=>5,
210-
"tickwidth"=>1,
211-
"tickcolor"=>"#000",
212-
"nticks"=>0,
213-
"showticklabels"=>true,
214-
"tickangle"=>"auto",
215-
"exponentformat"=>"e",
216-
"showexponent"=>"all",
217-
"showgrid"=>true,
218-
"gridcolor"=>"#ddd",
219-
"gridwidth"=>1,
220-
"autorange"=>true,
221-
"autotick"=>true,
222-
"zeroline"=>true,
223-
"zerolinecolor"=>"#000",
224-
"zerolinewidth"=>1,
225-
"title"=>"Click to enter Y axis title",
226-
"unit"=>"",
227-
"titlefont"=>Dict("family"=>"","size"=>0,"color"=>""),
228-
"tickfont"=>Dict("family"=>"","size"=>0,"color"=>"")),
229-
"legend"=>Dict(
230-
"bgcolor"=>"#fff",
231-
"bordercolor"=>"#000",
232-
"borderwidth"=>1,
233-
"font"=>Dict("family"=>"","size"=>0,"color"=>""),
234-
"traceorder"=>"normal"),
235-
"width"=>700,
236-
"height"=>450,
237-
"autosize"=>"initial",
238-
"margin"=>Dict("l"=>80,"r"=>80,"t"=>80,"b"=>80,"pad"=>2),
239-
"paper_bgcolor"=>"#fff",
240-
"plot_bgcolor"=>"#fff",
241-
"barmode"=>"stack",
242-
"bargap"=>0.2,
243-
"bargroupgap"=>0.0,
244-
"boxmode"=>"overlay",
245-
"boxgap"=>0.3,
246-
"boxgroupgap"=>0.3,
247-
"font"=>Dict("family"=>"Arial, sans-serif;","size"=>12,"color"=>"#000"),
248-
"titlefont"=>Dict("family"=>"","size"=>0,"color"=>""),
249-
"dragmode"=>"zoom",
250-
"hovermode"=>"x")
251-
end
252-
end
253-
254-
function help()
255-
println("Please enter the name of the funtion you'd like help with")
256-
println("Options include:")
257-
println("\t Plotly.help(\"plot\") OR Plotly.help(:plot)")
258-
println("\t Plotly.help(\"layout\") OR Plotly.help(:layout)")
259-
println("\t Plotly.help(\"style\") OR Plotly.help(:style)")
260-
end
261-
262160
end

src/plot.jl

Lines changed: 0 additions & 152 deletions
This file was deleted.

0 commit comments

Comments
 (0)