From ecb7a3db359f8deef0b5d02ca31842240dcbb495 Mon Sep 17 00:00:00 2001 From: koldo Date: Fri, 2 Nov 2018 23:12:34 +0000 Subject: [PATCH] ScatterCtrl_Demo: Plot responsiveness and 2D surfaces added. git-svn-id: svn://ultimatepp.org/upp/trunk@12445 f0d560ea-af0d-0410-9eb7-867de7ffcac7 --- examples/ScatterCtrl_Demo/ScatterCtrl_Demo.h | 28 +++- .../ScatterCtrl_Demo/ScatterCtrl_Demo.lay | 16 ++- .../ScatterCtrl_Demo/ScatterCtrl_Demo.upp | 3 +- examples/ScatterCtrl_Demo/main.cpp | 4 +- examples/ScatterCtrl_Demo/tab10_User.cpp | 32 +++-- examples/ScatterCtrl_Demo/tab11_Trend.cpp | 3 +- .../ScatterCtrl_Demo/tab16_StackedPlot.cpp | 4 +- .../ScatterCtrl_Demo/tab17_BubblePlot.cpp | 13 +- examples/ScatterCtrl_Demo/tab18_UserPaint.cpp | 2 +- examples/ScatterCtrl_Demo/tab19_Surf.cpp | 136 ++++++++++++++++++ .../tab3_ParametricFunctions.cpp | 5 +- .../ScatterCtrl_Demo/tab6_Logarithmic.cpp | 2 +- examples/ScatterCtrl_Demo/tab8_Secondary.cpp | 2 +- 13 files changed, 217 insertions(+), 33 deletions(-) create mode 100644 examples/ScatterCtrl_Demo/tab19_Surf.cpp diff --git a/examples/ScatterCtrl_Demo/ScatterCtrl_Demo.h b/examples/ScatterCtrl_Demo/ScatterCtrl_Demo.h index 2f8473d42..c6d331d1c 100644 --- a/examples/ScatterCtrl_Demo/ScatterCtrl_Demo.h +++ b/examples/ScatterCtrl_Demo/ScatterCtrl_Demo.h @@ -254,6 +254,7 @@ public: private: Vector > s1; Vector idsBubble; + Vector labels; }; class Tab_UserPaint : public WithTabUserPaint { @@ -275,7 +276,7 @@ public: String text = "Fixed text"; Font font = Arial(30); Size sz = GetTextSize(text, font); - FillRectangleOpa(w, plotW - sz.cx - 10, 10, plotW - 10, 10 + sz.cy, 1, 0.3, Null, LtGreen()); + FillRectangleOpa(w, plotW - sz.cx - 10, 10, plotW - 10, 10 + sz.cy, 0.3, Null, LtGreen()); DrawText(w, plotW - sz.cx - 10, 10, 0, text, font, Black()); if (scatter.GetXMin() < 1 && scatter.GetXMax() > 1) { @@ -292,7 +293,7 @@ public: double sizex = scatter.GetSizeX(0.2); FillRectangleOpa(w, posx - sizex/2., posy - sizex/2., posx + sizex/2., posy + sizex/2., - 1, 0.8, Null, LtGreen()); + 0.8, Null, LtGreen()); Vector s; s << Pointf(posx - sizex/2., posy - sizex/2.) << Pointf(posx + sizex/2., posy - sizex/2.) @@ -312,6 +313,29 @@ private: Vector s1; }; +class Tab19_Surf : public WithTabSurf { +public: + typedef Tab19_Surf CLASSNAME; + + virtual void Init(); + virtual ScatterCtrl &Scatter() {return scatter;}; + + void OnChange(); + void Init_DatasetSimple(); + void Init_Dataset(); + void Init_DataExplicit(); + +private: + ExplicitData funData; + TableDataPoints data; + TableDataAreas dataFun; + Vector zData, xAxis, yAxis; + Vector zDataFun, xAxisFun, yAxisFun; + + Vector isolines, numbersPos; + Vector labels; +}; + class TabPie : public WithTabPie { public: typedef TabPie CLASSNAME; diff --git a/examples/ScatterCtrl_Demo/ScatterCtrl_Demo.lay b/examples/ScatterCtrl_Demo/ScatterCtrl_Demo.lay index f5cf0455e..acc93cf30 100644 --- a/examples/ScatterCtrl_Demo/ScatterCtrl_Demo.lay +++ b/examples/ScatterCtrl_Demo/ScatterCtrl_Demo.lay @@ -15,7 +15,7 @@ LAYOUT(Tab1Basic, 428, 296) END_LAYOUT LAYOUT(Tab2Functions, 380, 292) - ITEM(ScatterCtrl, scatter, SetTitle(t_("Functions")).SetPlotAreaRightMargin(110).SetPlotAreaTopMargin(20).SetLabelsFont(StdFontZ(11)).SetGridWidth(2).SetTitleFont(SansSerifZ(14).Bold()).SetLegendAnchor(2).SetLegendPosX(-107).SetLegendPosY(0).HSizePosZ(16, 12).VSizePosZ(16, 16)) + ITEM(ScatterCtrl, scatter, SetTitle(t_("Functions")).SetPlotAreaRightMargin(130).SetPlotAreaTopMargin(20).SetLabelsFont(StdFontZ(11)).SetGridWidth(2).SetTitleFont(SansSerifZ(14).Bold()).SetLegendAnchor(2).SetLegendPosX(-120).SetLegendPosY(0).HSizePosZ(16, 12).VSizePosZ(16, 16)) END_LAYOUT LAYOUT(Tab3ParametricFunctions, 384, 284) @@ -98,6 +98,20 @@ LAYOUT(TabRangePlot, 420, 236) ITEM(ScatterCtrl, scatter, SetTitle(t_("Range Plot")).SetPlotAreaLeftMargin(40).SetPlotAreaTopMargin(20).SetPlotAreaBottomMargin(40).SetLabelsFont(StdFontZ(11)).SetTitleFont(SansSerifZ(14).Bold()).HSizePosZ(4, 4).VSizePosZ(4, 4)) END_LAYOUT +LAYOUT(TabSurf, 468, 236) + ITEM(ScatterCtrl, scatter, SetTitle(t_("2D Surface")).SetPlotAreaLeftMargin(40).SetPlotAreaRightMargin(20).SetPlotAreaTopMargin(20).SetPlotAreaBottomMargin(40).SetLabelsFont(StdFontZ(11)).SetTitleFont(SansSerifZ(14).Bold()).HSizePosZ(132, 4).VSizePosZ(4, 4)) + ITEM(LabelBox, dv___1, SetLabel(t_("Data source")).LeftPosZ(4, 124).TopPosZ(0, 64)) + ITEM(Switch, dataType, SetLabel(t_("Data set simple\nData set\nExplicit equation")).LeftPosZ(12, 108).TopPosZ(16, 48)) + ITEM(EditIntSpin, numColor, Min(0).NotNull(true).LeftPosZ(72, 56).TopPosZ(112, 19)) + ITEM(Label, labelInterpolation, SetLabel(t_("Data set interpolation")).LeftPosZ(4, 120).TopPosZ(68, 19)) + ITEM(Label, dv___5, SetLabel(t_("Num. color:")).LeftPosZ(4, 68).TopPosZ(112, 19)) + ITEM(DropList, interpolation, LeftPosZ(4, 124).TopPosZ(88, 19)) + ITEM(Label, dv___7, SetLabel(t_("Rainbow style")).LeftPosZ(4, 100).TopPosZ(156, 19)) + ITEM(DropList, rainbow, LeftPosZ(4, 124).TopPosZ(176, 19)) + ITEM(Option, zoom, SetLabel(t_("Zoom to fit")).LeftPosZ(4, 104).TopPosZ(200, 16)) + ITEM(Option, opContinuous, SetLabel(t_("Continuous")).LeftPosZ(4, 88).TopPosZ(136, 16)) +END_LAYOUT + LAYOUT(TabStackedPlot, 420, 244) ITEM(ScatterCtrl, scatter, SetTitle(t_("Stacked Plot")).SetPlotAreaLeftMargin(40).SetPlotAreaTopMargin(20).SetPlotAreaBottomMargin(40).SetLabelsFont(StdFontZ(11)).SetTitleFont(SansSerifZ(14).Bold()).HSizePosZ(4, 4).VSizePosZ(4, 20)) ITEM(Switch, type, SetLabel(t_("Stacked\nStacked100")).LeftPosZ(4, 160).BottomPosZ(2, 16)) diff --git a/examples/ScatterCtrl_Demo/ScatterCtrl_Demo.upp b/examples/ScatterCtrl_Demo/ScatterCtrl_Demo.upp index 6eccb169a..e55169f75 100644 --- a/examples/ScatterCtrl_Demo/ScatterCtrl_Demo.upp +++ b/examples/ScatterCtrl_Demo/ScatterCtrl_Demo.upp @@ -28,9 +28,10 @@ file tab16_StackedPlot.cpp, tab17_BubblePlot.cpp, tab18_UserPaint.cpp, + tab19_Surf.cpp, tab20_Pie.cpp, symbol.iml; mainconfig - "" = "GUI"; + "" = "GUI MT"; diff --git a/examples/ScatterCtrl_Demo/main.cpp b/examples/ScatterCtrl_Demo/main.cpp index 0142bfe84..b9844dc14 100644 --- a/examples/ScatterCtrl_Demo/main.cpp +++ b/examples/ScatterCtrl_Demo/main.cpp @@ -80,7 +80,7 @@ ScatterCtrl_Demo::ScatterCtrl_Demo() SetMode(); examplesList.WhenSel = THISBACK(OnSel); - examplesList.SetCursor(14); + examplesList.SetCursor(17); OnSel(); Sizeable().Zoomable().Icon(MyImages::i1()); @@ -101,7 +101,7 @@ void ScatterCtrl_Demo::Preview() r.Landscape(); Size pageSize = r.GetPageSize(); - const Drawing &w = Examples()[examplesList.GetCursor()].ctrl()->Scatter().GetDrawing(Size(800, 600)); + const Drawing &w = Examples()[examplesList.GetCursor()].ctrl()->Scatter().GetDrawing(); r.DrawDrawing(0, 0, pageSize.cx, pageSize.cy, w); Perform(r); diff --git a/examples/ScatterCtrl_Demo/tab10_User.cpp b/examples/ScatterCtrl_Demo/tab10_User.cpp index 0db0d4b24..981995359 100644 --- a/examples/ScatterCtrl_Demo/tab10_User.cpp +++ b/examples/ScatterCtrl_Demo/tab10_User.cpp @@ -7,9 +7,9 @@ class MyPlot : public SeriesPlot { private: template - void DoPaint(T& w, Vector &p, const int &scale, const double opacity, + void DoPaint(T& w, const double &scale, Vector &p, const double opacity, double thick, const Color &color, String pattern, const Color &background, - const Color &fillColor, int y0) const { + const Color &fillColor, double y0) const { Vector t; t.SetCount(3); for (int i = 0; i < p.GetCount(); ++i) { @@ -25,31 +25,34 @@ private: } public: - void Paint(Draw& w, Vector &p, const int &scale, const double opacity, + void Paint(Draw& w, Vector &p, const double &scale, const double opacity, double thick, const Color &color, String pattern, const Color &background, - const Color &fillColor, double fx, double fy, int y0) const { - DoPaint(w, p, scale, opacity, fround(thick), color, pattern, background, fillColor, y0); + const Color &fillColor, double fx, double fy, double y0, double width, + bool isClosed) const { + DoPaint(w, scale, p, opacity, fround(thick), color, pattern, background, fillColor, y0); } - void Paint(Painter& w, Vector &p, const int &scale, const double opacity, + void Paint(Painter& w, Vector &p, const double &scale, const double opacity, double thick, const Color &color, String pattern, const Color &background, - const Color &fillColor, double fx, double fy, int y0) const { - DoPaint(w, p, scale, opacity, fround(thick), color, pattern, background, fillColor, y0); + const Color &fillColor, double fx, double fy, double y0, double width, + bool isClosed) const { + DoPaint(w, scale, p, opacity, fround(thick), color, pattern, background, fillColor, y0); } }; class MyMark : public MarkPlot { private: template - void DoPaint(T& w, const int& scale, const Point& cp, const double& size, const Color& markColor) const { - w.DrawImage(cp.x-8, cp.y-8, Symbol::bug()); + void DoPaint(T& w, const double& scale, const Point& cp, const double& size, const Color& markColor) const { + Size bugSize = Symbol::bug().GetSize()*scale; + w.DrawImage(cp.x - bugSize.cx/2, cp.y - bugSize.cy/2, bugSize.cx, bugSize.cy, Symbol::bug()); } public: - void Paint(Draw &p, const int& scale, const Point& cp, const double& size, const Color& markColor, + void Paint(Draw &p, const double& scale, const Point& cp, const double& size, const Color& markColor, const double&, const Color&) const { DoPaint(p, scale, cp, size, markColor); } - void Paint(Painter &p, const int& scale, const Point& cp, const double& size, const Color& markColor, + void Paint(Painter &p, const double& scale, const Point& cp, const double& size, const Color& markColor, const double&, const Color&) const { DoPaint(p, scale, cp, size, markColor); } @@ -62,10 +65,11 @@ void Tab10_User::Init() sy[0] = 18; sy[1] = 29; sy[2] = 23; sy[3] = 25; sy[4] = 20; sx[0] = 10; sx[1] = 20; sx[2] = 30; sx[3] = 40; sx[4] = 50; - scatter.AddSeries(sx, sy, 5).Legend("Series").PlotStyle().MarkStyle().Stroke(3, LtGreen()).Fill(LtGray()); + scatter.AddSeries(sx, sy, 5).Legend("Series").PlotStyle().MarkStyle() + .Stroke(3, LtGreen()).Fill(LtGray()); scatter.SetRange(60, 50).SetMajorUnits(10, 10); - scatter.ShowInfo().ShowContextMenu().ShowPropertiesDlg().ShowProcessDlg(); + scatter.ShowInfo().ShowContextMenu().ShowPropertiesDlg().ShowProcessDlg().Responsive(); } ScatterDemo *Construct10() diff --git a/examples/ScatterCtrl_Demo/tab11_Trend.cpp b/examples/ScatterCtrl_Demo/tab11_Trend.cpp index 7d32c0b52..703c45b52 100644 --- a/examples/ScatterCtrl_Demo/tab11_Trend.cpp +++ b/examples/ScatterCtrl_Demo/tab11_Trend.cpp @@ -9,7 +9,8 @@ void Tab11_Trend::Init() seriesList = "Series 1"; seriesList.WhenAction = THISBACK(OnSeries); - scatter.SetMouseHandling(true, true).ShowContextMenu().ShowPropertiesDlg().ShowProcessDlg(); + scatter.SetMouseHandling(true, true).ShowContextMenu().ShowPropertiesDlg() + .ShowProcessDlg().Responsive(); grid.AddColumn("Type", 10); grid.AddColumn("Equation", 40); diff --git a/examples/ScatterCtrl_Demo/tab16_StackedPlot.cpp b/examples/ScatterCtrl_Demo/tab16_StackedPlot.cpp index 9b1a0cff3..095c220b2 100644 --- a/examples/ScatterCtrl_Demo/tab16_StackedPlot.cpp +++ b/examples/ScatterCtrl_Demo/tab16_StackedPlot.cpp @@ -21,8 +21,8 @@ void TabStackedPlot::Init() scatter.AddSeries(stacked.Get(1)).Legend("s2").Fill(); scatter.AddSeries(stacked.Get(0)).Legend("s1").Fill(); - scatter.SetLabelY("Data").SetLabelX("time [seg]"); - scatter.ShowButtons(); + scatter.SetLabelY("Data").SetLabelX("time [seg]") + .ShowButtons().Responsive(); type = 0; type.WhenAction = THISBACK(OnPlot); diff --git a/examples/ScatterCtrl_Demo/tab17_BubblePlot.cpp b/examples/ScatterCtrl_Demo/tab17_BubblePlot.cpp index e6be5c406..7f5c467f7 100644 --- a/examples/ScatterCtrl_Demo/tab17_BubblePlot.cpp +++ b/examples/ScatterCtrl_Demo/tab17_BubblePlot.cpp @@ -10,14 +10,19 @@ void TabBubblePlot::Init() for (double size = 0; size <= 10; size += 2.) { Vector &data = s1.Add(); - data << size << (10 + 10*Random(30)*size) << Random(80); + double x = size; + double y = (10 + 10*Random(30)*size); + double diameter = Random(80); + data << x << y << diameter; + labels << Format("%.0f cm", diameter); } idsBubble << 2; static Vector idVoid; scatter.AddSeries(s1, 0, 1, idVoid, idVoid, idsBubble).Legend("Importance").MarkStyle() - .NoPlot().MarkColor(Green()).MarkBorderColor(LtRed()).MarkBorderWidth(3); - - scatter.SetLabelY("Size"); + .MarkColor(Green()).MarkBorderColor(LtRed()).MarkBorderWidth(3) + .AddLabelSeries(labels, 0, 0, StdFont().Height(15).Bold(), ALIGN_CENTER); + + scatter.SetLabelY("Size").Responsive(); scatter.ZoomToFit(true, true, 0.2); } diff --git a/examples/ScatterCtrl_Demo/tab18_UserPaint.cpp b/examples/ScatterCtrl_Demo/tab18_UserPaint.cpp index 1999b6b4c..3905631ea 100644 --- a/examples/ScatterCtrl_Demo/tab18_UserPaint.cpp +++ b/examples/ScatterCtrl_Demo/tab18_UserPaint.cpp @@ -12,7 +12,7 @@ void Tab_UserPaint::Init() scatter.ShowInfo().ShowContextMenu().ShowPropertiesDlg().ShowProcessDlg(). SetMouseHandling(true, true); - scatter.SetLegendPos(Point(20, 20)).SetLegendAnchor(ScatterDraw::LEGEND_ANCHOR_RIGHT_BOTTOM); + scatter.SetLegendPos(Point(20, 20)).SetLegendAnchor(ScatterDraw::RIGHT_BOTTOM); scatter.ZoomToFit(true, true); scatter.WhenPainter = THISBACK(OnPainter); scatter.WhenDraw = THISBACK(OnDraw); diff --git a/examples/ScatterCtrl_Demo/tab19_Surf.cpp b/examples/ScatterCtrl_Demo/tab19_Surf.cpp new file mode 100644 index 000000000..b26a02f98 --- /dev/null +++ b/examples/ScatterCtrl_Demo/tab19_Surf.cpp @@ -0,0 +1,136 @@ +#include "ScatterCtrl_Demo.h" + + +void Tab19_Surf::Init() +{ + CtrlLayout(*this); + SizePos(); + + numColor <<= 4; + numColor <<= THISBACK(OnChange); + opContinuous <<= true; + opContinuous <<= THISBACK(OnChange); + dataType = 0;//2; + dataType << THISBACK(OnChange); + rainbow.Add(BLUE_YELLOW_RED, "BLUE_YELLOW_RED").Add(RED_YELLOW_BLUE, "RED_YELLOW_BLUE") + .Add(GREEN_YELLOW_RED, "GREEN_YELLOW_RED").Add(RED_YELLOW_GREEN, "RED_YELLOW_GREEN") + .Add(WHITE_BLACK, "WHITE_BLACK").Add(BLACK_WHITE, "BLACK_WHITE"); + rainbow = scatter.SurfRainbow(); + rainbow << THISBACK(OnChange); + interpolation.Add(TableData::NO, "NO").Add(TableData::BILINEAR, "BILINEAR"); + interpolation = TableData::BILINEAR; + interpolation << THISBACK(OnChange); + zoom = true; + zoom << THISBACK(OnChange); + + scatter.ShowInfo().ShowContextMenu().ShowPropertiesDlg().ShowProcessDlg() + .SetMouseHandling(true, true).Responsive(true) + .SetRainbowPaletteSize(Size(20, 200)) + .SetRainbowPaletteAnchor(ScatterDraw::LEGEND_POS::LEFT_TOP) + .SetRainbowPalettePos(Point(20, 20)) + .SetRainbowPaletteFont(StdFont().Height(10)) + .SurfUnits("kg").SurfUnitsPos(ScatterDraw::UNITS_LEFT) + .SurfLegendPos(ScatterDraw::LEGEND_RIGHT); + + for (double x = 0; x <= 5; x += 1) + xAxis << x; + yAxis << 0 << 4 << 5 << 6 << 7 << 8 << 9 << 10 << 11 << 12 << 13 << 14 << 15; + zData << 0 << 0 << 0 << 0 << 0 << 0 + << 0 << 402 << 2501 << 2099 << 48231 << 89315 + << 0 << 1835 << 9889 << 36124 << 78603 << 101067 + << 0 << 4627 << 24211 << 61689 << 117905 << 151600 + << 0 << 7170 << 37887 << 96988 << 185785 << 239028 + << 0 << 7144 << 39134 << 106627 << 213241 << 277208 + << 0 << 6290 << 33302 << 95397 << 196494 << 256218 + << 0 << 6931 << 32175 << 84656 << 165247 << 211670 + << 0 << 6117 << 27070 << 68657 << 130224 << 165038 + << 0 << 3849 << 17985 << 47400 << 91425 << 116321 + << 0 << 2390 << 12142 << 33214 << 65323 << 83722 + << 0 << 1741 << 9541 << 26098 << 51917 << 67241 + << 0 << 1337 << 7783 << 21287 << 42703 << 55722; + + data.Init(zData, xAxis, yAxis, TableData::BILINEAR); + + Vector vals; + for (double val = 50000; val <= 250000; val += 50000) + vals << val; + isolines = data.GetIsolines(vals, Rectf(0, 16, 5, 0), 0.1, 0.1); + + Vector numbersWhere; + numbersWhere << Pointf(4.7, 8) << Pointf(1, 14); + numbersPos = Intersection(numbersWhere, isolines); + for (int i = 0; i < vals.GetCount(); ++i) + labels << Format("%.0f kg", vals[i]); + + for (double x = -10; x <= 10; x += 1) + xAxisFun << x; + for (double y = -10; y <= 10; y += 1) + yAxisFun << y; + + zDataFun.SetCount((xAxisFun.GetCount()-1)*(yAxisFun.GetCount()-1)); + for (int iy = 0; iy < yAxisFun.GetCount()-1; iy++) { + double y = (yAxisFun[iy] + yAxisFun[iy+1])/2.; + for (int ix = 0; ix < xAxisFun.GetCount()-1; ix++) { + double x = (xAxisFun[ix] + xAxisFun[ix+1])/2.; + zDataFun[ix + iy*(xAxisFun.GetCount() - 1)] = sin(sqrt(x*x + y*y + 64))/sqrt(x*x + y*y + 64); + } + } + dataFun.Init(zDataFun, xAxisFun, yAxisFun, TableData::BILINEAR); + + funData.Init([=](double x, double y) {return sin(sqrt(x*x + y*y + 64))/sqrt(x*x + y*y + 64);}, -10, 10, -10, 10); + + OnChange(); +} + +void Tab19_Surf::OnChange() { + labelInterpolation.Enable(dataType != 2); + interpolation.Enable(dataType != 2); + + scatter.SurfNumColor(~numColor, ~opContinuous).SurfRainbow((RAINBOW)int(rainbow.GetKey(rainbow.GetIndex()))); + if (dataType == 0) + Init_DatasetSimple(); + else if (dataType == 1) + Init_Dataset(); + else + Init_DataExplicit(); + if (zoom) + scatter.ZoomToFit(true, true); + + scatter.Refresh(); +} + +void Tab19_Surf::Init_DatasetSimple() { + scatter.RemoveAllSeries(); + scatter.AddSeries(isolines).Legend("Isoline").Stroke(0.5, White).ShowSeriesLegend(false).NoMark(); + scatter.AddSeries(numbersPos).Stroke(0).AddLabelSeries(labels, 0, 0, StdFont().Bold(), ALIGN_CENTER, White()) + .ShowSeriesLegend(false).NoMark(); + data.Inter((TableData::Interpolate)int(interpolation.GetKey(interpolation.GetIndex()))); + scatter.AddSurf(data) + .SetRainbowPaletteTextColor(White) + .SetSurfMinZ(0).SetSurfMaxZ(300000); +} + +void Tab19_Surf::Init_Dataset() { + scatter.RemoveAllSeries(); + dataFun.Inter((TableData::Interpolate)int(interpolation.GetKey(interpolation.GetIndex()))); + scatter.AddSurf(dataFun); + scatter.SetRainbowPaletteTextColor(Black); + scatter.ZoomToFitZ(); +} + +void Tab19_Surf::Init_DataExplicit() { + scatter.RemoveAllSeries(); + scatter.AddSurf(funData); + scatter.SetRainbowPaletteTextColor(Black); + scatter.ZoomToFitZ(); +} + +ScatterDemo *Construct19() +{ + static Tab19_Surf tab; + return &tab; +} + +INITBLOCK { + RegisterExample("2D Surface", Construct19, __FILE__); +} \ No newline at end of file diff --git a/examples/ScatterCtrl_Demo/tab3_ParametricFunctions.cpp b/examples/ScatterCtrl_Demo/tab3_ParametricFunctions.cpp index 0a678a7d8..a5646ac0a 100644 --- a/examples/ScatterCtrl_Demo/tab3_ParametricFunctions.cpp +++ b/examples/ScatterCtrl_Demo/tab3_ParametricFunctions.cpp @@ -7,7 +7,6 @@ void para1(Pointf& xy, double t) {xy = Pointf(cos(2*M_PI*t), sin(2*M_PI*t));} void para2(Pointf& xy, double t) {xy = Pointf(0.5*cos(6*M_PI*t)+3*t-1, 1.5+0.5*sin(6*M_PI*t));} void para3(Pointf& xy, double t) {xy = Pointf(3+(0.5+t)*cos(6*M_PI*t), (0.5+t)*sin(6*M_PI*t));} void para4(Pointf& xy, double t) {xy = Pointf(0, -0.25+0.5*t);} -void para5(Pointf& xy, double t) {xy = Pointf(-0.25+0.5*t, 0);} void para1p(Pointf& xy, double t, double a, double b) {xy = Pointf(a*cos(2*M_PI*t),b*sin(2*M_PI*t));} void para3p(Pointf& xy, double t, double a) {xy = Pointf(a+(0.5+t)*cos(6*M_PI*t),(0.5+t)*sin(6*M_PI*t));} @@ -21,13 +20,13 @@ void Tab3_ParametricFunctions::Init() scatter.SetMajorUnits(0.5, 0.5); scatter.SetXYMin(-2, -2); - scatter.AddSeries(&opara1, 20).Legend("Circle 1");//.NoMark(); + scatter.AddSeries(&opara1, 20).Legend("Circle 1"); scatter.AddSeries(¶1, 100).Legend("Circle 2").NoMark(); scatter.AddSeries(¶2, 100).Legend("Coil").NoMark(); scatter.AddSeries(¶3, 150).Legend("Spiral 1").NoMark(); scatter.AddSeries(STDBACK1(para3p, 2.5), 150, 0, 1).Legend("Spiral 2").NoMark(); scatter.AddSeries(¶4, 2).Legend("VLine").NoMark(); - scatter.AddSeries(¶5, 2).Legend("HLine").NoMark(); + scatter.AddSeries([=](Pointf &xy, double t) {xy = Pointf(-0.25+0.5*t, 0);}, 2).Legend("HLine").NoMark(); scatter.AddSeries(STDBACK2(para1p, 4.0, 0.25), 50, 0, 1).Legend("Ellipse 1").NoMark(); scatter.AddSeries(STDBACK2(para1p, 2.0, 0.5), 50, 0, 1).Legend("Ellipse 2").NoMark(); } diff --git a/examples/ScatterCtrl_Demo/tab6_Logarithmic.cpp b/examples/ScatterCtrl_Demo/tab6_Logarithmic.cpp index 33d662a4a..371f5de31 100644 --- a/examples/ScatterCtrl_Demo/tab6_Logarithmic.cpp +++ b/examples/ScatterCtrl_Demo/tab6_Logarithmic.cpp @@ -17,7 +17,7 @@ void Tab6_Logarithmic::Init() void Tab6_Logarithmic::FormatX(String& s, int i, double d) { - s = FormatDoubleExp(pow(10., d), 1); + s = FormatDouble(pow(10., d), 0); } ScatterDemo *Construct6() diff --git a/examples/ScatterCtrl_Demo/tab8_Secondary.cpp b/examples/ScatterCtrl_Demo/tab8_Secondary.cpp index 69221ec98..b46673a2d 100644 --- a/examples/ScatterCtrl_Demo/tab8_Secondary.cpp +++ b/examples/ScatterCtrl_Demo/tab8_Secondary.cpp @@ -17,7 +17,7 @@ void Tab8_Secondary::Init() scatter.AddSeries(s1).Legend("Temperature").Units("ÂșC").Stroke(3, Null).Dash(LINE_DASHED).MarkStyle(); s2 <