From 8bfaa14edb76ae113faf5b1f541d0f7284224a5e Mon Sep 17 00:00:00 2001 From: Thomas Breloff Date: Tue, 15 Sep 2015 10:03:56 -0400 Subject: [PATCH] added backend template --- src/backends/immerse.jl | 3 --- src/backends/template.jl | 50 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 50 insertions(+), 3 deletions(-) create mode 100644 src/backends/template.jl diff --git a/src/backends/immerse.jl b/src/backends/immerse.jl index a7aec965..6be972dc 100644 --- a/src/backends/immerse.jl +++ b/src/backends/immerse.jl @@ -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) diff --git a/src/backends/template.jl b/src/backends/template.jl new file mode 100644 index 00000000..56e153ea --- /dev/null +++ b/src/backends/template.jl @@ -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