diff --git a/uppsrc/ScatterDraw/Equation.h b/uppsrc/ScatterDraw/Equation.h index 49642d511..df74a99fb 100644 --- a/uppsrc/ScatterDraw/Equation.h +++ b/uppsrc/ScatterDraw/Equation.h @@ -16,13 +16,13 @@ public: TooManyFunctionEvaluation = -4 }; FitError Fit(DataSource &series, double &r2); - FitError Fit(DataSource &series) {double dummy; return Fit(series, dummy);} + FitError Fit(DataSource &series) {double dummy; return Fit(series, dummy);} virtual double f(double x1) = 0; virtual double f(double x1, double x2) {NEVER(); return Null;} virtual double f(Vector x) {NEVER(); return Null;} virtual String GetName() = 0; - virtual String GetFullName() {return GetName();} + virtual String GetFullName() {return GetName();} virtual String GetEquation() = 0; void SetNumDigits(int n) {numDigits = n;} @@ -32,6 +32,8 @@ public: friend struct Equation_functor; + const Array &GetCoeff() {return coeff;} + protected: Array coeff; int degree; @@ -45,6 +47,7 @@ protected: } void SetCoeff(double c0, double c1, double c2) {coeff.Clear(); coeff << c0 << c1 << c2;} void SetCoeff(double c0, double c1) {coeff.Clear(); coeff << c0 << c1;} + void SetCoeff(double c0) {coeff.Clear(); coeff << c0;} void SetCoeffVal(int id, double c) {coeff[id] = c;} }; diff --git a/uppsrc/ScatterDraw/ScatterDraw.cpp b/uppsrc/ScatterDraw/ScatterDraw.cpp index 3e4e0e527..53b096f64 100644 --- a/uppsrc/ScatterDraw/ScatterDraw.cpp +++ b/uppsrc/ScatterDraw/ScatterDraw.cpp @@ -923,7 +923,7 @@ Drawing ScatterDraw::GetDrawing(bool ctrl) { DrawingDraw ddw(3*GetSize()); - SetDrawing(ddw, GetSize(), 3); + SetDrawing(ddw, GetSize(), 3, ctrl, true); if (ctrl) PlotTexts(ddw, GetSize(), 3); @@ -938,7 +938,7 @@ Image ScatterDraw::GetImage(const Size &size, int scale, bool ctrl) ImageBuffer ib(scale*size); BufferPainter bp(ib, mode); - SetDrawing(bp, size, scale); + SetDrawing(bp, size, scale, ctrl); if (ctrl) PlotTexts(bp, size, scale); diff --git a/uppsrc/ScatterDraw/ScatterDraw.h b/uppsrc/ScatterDraw/ScatterDraw.h index 499293ee7..01e1f40c7 100644 --- a/uppsrc/ScatterDraw/ScatterDraw.h +++ b/uppsrc/ScatterDraw/ScatterDraw.h @@ -458,7 +458,7 @@ protected: String VariableFormatY2(double d) const {return VariableFormat(yRange2, d);} template - void SetDrawing(T& w, const Size &size, int scale, bool ctrl = false); + void SetDrawing(T& w, const Size &size, int scale, bool ctrl = false, bool setD = false); template void Plot(T& w, const Size &size, int scale); template @@ -476,7 +476,7 @@ private: }; template -void ScatterDraw::SetDrawing(T& w, const Size& size, int scale, bool ctrl) +void ScatterDraw::SetDrawing(T& w, const Size& size, int scale, bool ctrl, bool setD) { if (size.cx == 0 || size.cy == 0) return; @@ -496,9 +496,10 @@ void ScatterDraw::SetDrawing(T& w, const Size& size, int scale, bool ctrl) Plot(w, size, scale); - ClipEnd(w); - if (ctrl) + ClipEnd(w); + + if (!setD) w.Offset(Point(-scale*hPlotLeft, -(scale*vPlotTop + titleHeight))); }