Print TODO messages for missing features
This commit is contained in:
parent
b6e627369b
commit
ca866183f1
@ -2,12 +2,12 @@
|
|||||||
# https://github.com/jheinen/GR.jl
|
# https://github.com/jheinen/GR.jl
|
||||||
|
|
||||||
const gr_linetype = Dict(
|
const gr_linetype = Dict(
|
||||||
:auto => 0, :solid => 1, :dash => 2, :dot => 3, :dashdot => 4,
|
:auto => 1, :solid => 1, :dash => 2, :dot => 3, :dashdot => 4,
|
||||||
:dashdotdot => -1 )
|
:dashdotdot => -1 )
|
||||||
|
|
||||||
const gr_markertype = Dict(
|
const gr_markertype = Dict(
|
||||||
:none => 1, :ellipse => -1, :rect => -7, :diamond => -13,
|
:auto => 1, :ellipse => -1, :rect => -7, :diamond => -13,
|
||||||
:utriangle => -3, :dtriangle => -5, :pentagon => -14,
|
:utriangle => -3, :dtriangle => -5, :pentagon => -14, :hexagon => 3,
|
||||||
:cross => 2, :xcross => 5, :star5 => 3 )
|
:cross => 2, :xcross => 5, :star5 => 3 )
|
||||||
|
|
||||||
function gr_display(plt::Plot{GRPackage})
|
function gr_display(plt::Plot{GRPackage})
|
||||||
@ -37,8 +37,13 @@ function gr_display(plt::Plot{GRPackage})
|
|||||||
x, y = p[:x], p[:y]
|
x, y = p[:x], p[:y]
|
||||||
xmin = min(minimum(x), xmin)
|
xmin = min(minimum(x), xmin)
|
||||||
xmax = max(maximum(x), xmax)
|
xmax = max(maximum(x), xmax)
|
||||||
ymin = min(minimum(y), ymin)
|
# catch exception for OHLC vectors
|
||||||
ymax = max(maximum(y), ymax)
|
try
|
||||||
|
ymin = min(minimum(y), ymin)
|
||||||
|
ymax = max(maximum(y), ymax)
|
||||||
|
catch MethodError
|
||||||
|
ymin, ymax = 0, 1
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
scale = d[:scale]
|
scale = d[:scale]
|
||||||
@ -101,16 +106,27 @@ function gr_display(plt::Plot{GRPackage})
|
|||||||
GR.savestate()
|
GR.savestate()
|
||||||
haskey(d, :linewidth) && GR.setlinewidth(d[:linewidth])
|
haskey(d, :linewidth) && GR.setlinewidth(d[:linewidth])
|
||||||
haskey(d, :linestyle) && GR.setlinetype(gr_linetype[d[:linestyle]])
|
haskey(d, :linestyle) && GR.setlinetype(gr_linetype[d[:linestyle]])
|
||||||
haskey(d, :markersize) && GR.setmarkersize(d[:markersize])
|
if haskey(d, :markersize)
|
||||||
haskey(d, :markershape) && GR.setmarkertype(gr_markertype[d[:markershape]])
|
typeof(d[:markersize]) <: Number && GR.setmarkersize(d[:markersize] / 4.0)
|
||||||
|
else
|
||||||
|
println("TODO: multiple marker sizes")
|
||||||
|
end
|
||||||
|
if haskey(d, :markershape)
|
||||||
|
typeof(d[:markershape]) == Symbol && GR.setmarkertype(gr_markertype[d[:markershape]])
|
||||||
|
else
|
||||||
|
println("TODO: user-defined marker shapes")
|
||||||
|
end
|
||||||
GR.settextalign(GR.TEXT_HALIGN_LEFT, GR.TEXT_VALIGN_HALF)
|
GR.settextalign(GR.TEXT_HALIGN_LEFT, GR.TEXT_VALIGN_HALF)
|
||||||
|
|
||||||
|
GR.uselinespec(" ")
|
||||||
for p in plt.seriesargs
|
for p in plt.seriesargs
|
||||||
GR.uselinespec("")
|
GR.uselinespec("")
|
||||||
if p[:linetype] == :path
|
if p[:linetype] == :path
|
||||||
GR.polyline(p[:x], p[:y])
|
GR.polyline(p[:x], p[:y])
|
||||||
elseif p[:linetype] == :scatter
|
elseif p[:linetype] == :scatter
|
||||||
GR.polymarker(p[:x], p[:y])
|
GR.polymarker(p[:x], p[:y])
|
||||||
|
else
|
||||||
|
println("TODO: add support for linetype $(p[:linetype])")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -131,6 +147,7 @@ function gr_display(plt::Plot{GRPackage})
|
|||||||
GR.setlinewidth(1)
|
GR.setlinewidth(1)
|
||||||
GR.drawrect(px - 0.06, px + w + 0.02, py + 0.03, py - 0.03 * length(plt.seriesargs))
|
GR.drawrect(px - 0.06, px + w + 0.02, py + 0.03, py - 0.03 * length(plt.seriesargs))
|
||||||
haskey(d, :linewidth) && GR.setlinewidth(d[:linewidth])
|
haskey(d, :linewidth) && GR.setlinewidth(d[:linewidth])
|
||||||
|
GR.uselinespec(" ")
|
||||||
for p in plt.seriesargs
|
for p in plt.seriesargs
|
||||||
GR.uselinespec("")
|
GR.uselinespec("")
|
||||||
if p[:linetype] == :path
|
if p[:linetype] == :path
|
||||||
@ -155,6 +172,9 @@ end
|
|||||||
|
|
||||||
function _add_series(::GRPackage, plt::Plot; kw...)
|
function _add_series(::GRPackage, plt::Plot; kw...)
|
||||||
d = Dict(kw)
|
d = Dict(kw)
|
||||||
|
if d[:markershape] == :none
|
||||||
|
d[:markershape] = :ellipse
|
||||||
|
end
|
||||||
push!(plt.seriesargs, d)
|
push!(plt.seriesargs, d)
|
||||||
plt
|
plt
|
||||||
end
|
end
|
||||||
@ -188,16 +208,14 @@ end
|
|||||||
|
|
||||||
# ----------------------------------------------------------------
|
# ----------------------------------------------------------------
|
||||||
|
|
||||||
# accessors for x/y data
|
|
||||||
|
|
||||||
function Base.getindex(plt::Plot{GRPackage}, i::Int)
|
function Base.getindex(plt::Plot{GRPackage}, i::Int)
|
||||||
series = plt.o.lines[i]
|
d = plt.seriesargs[i]
|
||||||
series.x, series.y
|
d[:x], d[:y]
|
||||||
end
|
end
|
||||||
|
|
||||||
function Base.setindex!(plt::Plot{GRPackage}, xy::Tuple, i::Integer)
|
function Base.setindex!(plt::Plot{GRPackage}, xy::Tuple, i::Integer)
|
||||||
series = plt.o.lines[i]
|
d = plt.seriesargs[i]
|
||||||
series.x, series.y = xy
|
d[:x], d[:y] = xy
|
||||||
plt
|
plt
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -205,6 +223,7 @@ end
|
|||||||
|
|
||||||
function _create_subplot(subplt::Subplot{GRPackage}, isbefore::Bool)
|
function _create_subplot(subplt::Subplot{GRPackage}, isbefore::Bool)
|
||||||
# TODO: build the underlying Subplot object. this is where you might layout the panes within a GUI window, for example
|
# TODO: build the underlying Subplot object. this is where you might layout the panes within a GUI window, for example
|
||||||
|
true
|
||||||
end
|
end
|
||||||
|
|
||||||
function _expand_limits(lims, plt::Plot{GRPackage}, isx::Bool)
|
function _expand_limits(lims, plt::Plot{GRPackage}, isx::Bool)
|
||||||
@ -218,7 +237,8 @@ end
|
|||||||
# ----------------------------------------------------------------
|
# ----------------------------------------------------------------
|
||||||
|
|
||||||
function Base.writemime(io::IO, ::MIME"image/png", plt::PlottingObject{GRPackage})
|
function Base.writemime(io::IO, ::MIME"image/png", plt::PlottingObject{GRPackage})
|
||||||
# TODO: write a png to io
|
isijulia() && return
|
||||||
|
println("TODO: write a png to io")
|
||||||
end
|
end
|
||||||
|
|
||||||
function Base.display(::PlotsDisplay, plt::Plot{GRPackage})
|
function Base.display(::PlotsDisplay, plt::Plot{GRPackage})
|
||||||
|
|||||||
@ -234,10 +234,11 @@ supportedArgs(::GRPackage) = [
|
|||||||
]
|
]
|
||||||
supportedAxes(::GRPackage) = _allAxes
|
supportedAxes(::GRPackage) = _allAxes
|
||||||
supportedTypes(::GRPackage) = [:none, :line, :path, :steppre, :steppost, :sticks,
|
supportedTypes(::GRPackage) = [:none, :line, :path, :steppre, :steppost, :sticks,
|
||||||
:scatter, :heatmap, :hexbin, :hist, :density, :bar,
|
:scatter, :heatmap, :hexbin, :hist, :density, :bar,
|
||||||
:hline, :vline, :contour, :path3d, :scatter3d, :surface, :wireframe]
|
:hline, :vline, :contour, :path3d, :scatter3d, :surface,
|
||||||
|
:wireframe, :ohlc, :pie]
|
||||||
supportedStyles(::GRPackage) = [:auto, :solid, :dash, :dot, :dashdot]
|
supportedStyles(::GRPackage) = [:auto, :solid, :dash, :dot, :dashdot]
|
||||||
supportedMarkers(::GRPackage) = [:none, :ellipse, :rect, :diamond, :utriangle, :dtriangle, :pentagon, :cross, :xcross, :star5]
|
supportedMarkers(::GRPackage) = vcat([:none, :ellipse, :rect, :diamond, :utriangle, :dtriangle, :pentagon, :hexagon, :cross, :xcross, :star5], Shape)
|
||||||
supportedScales(::GRPackage) = [:identity, :log10]
|
supportedScales(::GRPackage) = [:identity, :log10]
|
||||||
subplotSupported(::GRPackage) = true
|
subplotSupported(::GRPackage) = true
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user