JuliaGizmos / Escher.jl

Composable Web UIs in Julia
https://juliagizmos.github.io/Escher.jl
Other
335 stars 63 forks source link

Units clashing with Gadfly #151

Closed neilpanchal closed 8 years ago

neilpanchal commented 8 years ago

I am trying to plot the following in Escher under the main(window) block.

plot(
        df, 
        x=df[1], 
        y=df[2], 
        Geom.bar, 
        Guide.xlabel(nothing), 
        Guide.ylabel(nothing), 
        Guide.title(split(string(names(df)[1]), "RESULT_")[2]),
        Theme(bar_spacing=8px)
)

It works ok but when I defined bar_spacing=8px or bar_spacing=10mm or any measure in general, I get the following error:

MethodError: `convert` has no method matching convert(::Type{Measures.Measure}, ::Escher.Length{:px})
This may have arisen from a call to the constructor Measures.Measure(...),
since type constructors fall back to convert methods.
Closest candidates are:
  call{T}(::Type{T}, ::Any)
  convert{T}(::Type{T}, ::T)
 in anonymous at C:\Users\npanchal\.julia\v0.4\Escher\src\cli\serve.jl:170
 in anonymous at C:\Users\npanchal\.julia\v0.4\Mux\src\Mux.jl:15
 in anonymous at C:\Users\npanchal\.julia\v0.4\Mux\src\Mux.jl:8
 in splitquery at C:\Users\npanchal\.julia\v0.4\Mux\src\basics.jl:28
 in anonymous at C:\Users\npanchal\.julia\v0.4\Mux\src\Mux.jl:8
 in wcatch at C:\Users\npanchal\.julia\v0.4\Mux\src\websockets_integration.jl:12
 in anonymous at C:\Users\npanchal\.julia\v0.4\Mux\src\Mux.jl:8
 in todict at C:\Users\npanchal\.julia\v0.4\Mux\src\basics.jl:21
 in anonymous at C:\Users\npanchal\.julia\v0.4\Mux\src\Mux.jl:12 (repeats 2 times)
 in anonymous at C:\Users\npanchal\.julia\v0.4\Mux\src\Mux.jl:8
 in anonymous at C:\Users\npanchal\.julia\v0.4\Mux\src\server.jl:38
 in handle at C:\Users\npanchal\.julia\v0.4\WebSockets\src\WebSockets.jl:382
 in on_message_complete at C:\Users\npanchal\.julia\v0.4\HttpServer\src\HttpServer.jl:393
 in on_message_complete at C:\Users\npanchal\.julia\v0.4\HttpServer\src\RequestParser.jl:104
 in http_parser_execute at C:\Users\npanchal\.julia\v0.4\HttpParser\src\HttpParser.jl:92
 in process_client at C:\Users\npanchal\.julia\v0.4\HttpServer\src\HttpServer.jl:365
 in anonymous at task.jl:447
neilpanchal commented 8 years ago

After searching on the internet, i found a solution as follows.

plot(
        df, 
        x=df[1], 
        y=df[2], 
        Geom.bar, 
        Guide.xlabel(nothing), 
        Guide.ylabel(nothing), 
        Guide.title(split(string(names(df)[1]), "RESULT_")[2]),
        Theme(bar_spacing=8Gadfly.mm)
)
rohitvarkey commented 8 years ago

Dup of https://github.com/shashi/Escher.jl/issues/41