added backend template

This commit is contained in:
Thomas Breloff 2015-09-15 10:03:56 -04:00
parent d4e87d3fe8
commit 8bfaa14edb
2 changed files with 50 additions and 3 deletions

View File

@ -53,9 +53,6 @@ end
getGadflyContext(::ImmersePackage, plt::Plot) = plt.o[2]
getGadflyContext(::ImmersePackage, subplt::Subplot) = buildGadflySubplotContext(subplt)
# getImmerseObject(plt::Plot) = plt.o[2]
# getImmerseObject(subplt::Subplot) = buildGadflySubplotContext(subplt)
function savepng(::ImmersePackage, plt::PlottingObject, fn::String;
w = 6 * Immerse.inch,
h = 4 * Immerse.inch)

50
src/backends/template.jl Normal file
View File

@ -0,0 +1,50 @@
# TODO: find/replace all [PkgName] with CamelCase, all [pkgname] with lowercase
# [WEBSITE]
immutable [PkgName]Package <: PlottingPackage end
[pkgname]!() = plotter!(:[pkgname])
# ---------------------------------------------------------------------------
function plot(pkg::[PkgName]Package; kw...)
d = Dict(kw)
# TODO: create the window/canvas/context that is the plot within the backend (call it `o`)
# TODO: initialize the plot... title, xlabel, bgcolor, etc
Plot(o, pkg, 0, d, Dict[])
end
function plot!(::[PkgName]Package, plt::Plot; kw...)
d = Dict(kw)
# TODO: add one series to the underlying package
push!(plt.seriesargs, d)
plt
end
function Base.display(::[PkgName]Package, plt::Plot)
# TODO: display/show the plot
end
# -------------------------------
function savepng(::[PkgName]Package, plt::PlottingObject, fn::String; kw...)
# TODO: save a PNG of the underlying plot/subplot object
end
# -------------------------------
function buildSubplotObject!(::[PkgName]Package, subplt::Subplot)
# TODO: build the underlying Subplot object. this is where you might layout the panes within a GUI window, for example
end
function Base.display(::[PkgName]Package, subplt::Subplot)
# TODO: display/show the Subplot object
end