mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-07-11 22:03:01 -06:00
ScatterCtrl_Demo: Added new plots
git-svn-id: svn://ultimatepp.org/upp/trunk@8647 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
9aff6027b9
commit
8884c441dc
10 changed files with 197 additions and 25 deletions
|
|
@ -130,7 +130,7 @@ public:
|
|||
virtual ScatterCtrl &Scatter() {return scatter;};
|
||||
|
||||
private:
|
||||
Vector<Pointf> s1,s2, s3;
|
||||
Vector<Pointf> s1, s2, s3;
|
||||
};
|
||||
|
||||
class Tab9 : public WithTab9<ScatterDemo> {
|
||||
|
|
@ -186,6 +186,7 @@ public:
|
|||
|
||||
private:
|
||||
Vector<Pointf> s1, s2, s3;
|
||||
void OnLink();
|
||||
};
|
||||
|
||||
class TabUserEquation : public WithTabUserEquation<ScatterDemo> {
|
||||
|
|
@ -200,6 +201,30 @@ private:
|
|||
UserEquation userEquation;
|
||||
};
|
||||
|
||||
class TabRangePlot : public WithTabRangePlot<ScatterDemo> {
|
||||
public:
|
||||
typedef TabRangePlot CLASSNAME;
|
||||
|
||||
void Init();
|
||||
virtual ScatterCtrl &Scatter() {return scatter;};
|
||||
|
||||
private:
|
||||
Vector<Vector <double> > s1;
|
||||
Vector<int> idsRange;
|
||||
};
|
||||
|
||||
class TabBallPlot : public WithTabBallPlot<ScatterDemo> {
|
||||
public:
|
||||
typedef TabBallPlot CLASSNAME;
|
||||
|
||||
void Init();
|
||||
virtual ScatterCtrl &Scatter() {return scatter;};
|
||||
|
||||
private:
|
||||
Vector<Vector <double> > s1;
|
||||
Vector<int> idsBall;
|
||||
};
|
||||
|
||||
class TabPie : public WithTabPie<StaticRect> {
|
||||
public:
|
||||
typedef TabPie CLASSNAME;
|
||||
|
|
|
|||
|
|
@ -11,23 +11,23 @@ LAYOUT(ScatterCtrl_Demo, 624, 352)
|
|||
END_LAYOUT
|
||||
|
||||
LAYOUT(Tab1, 428, 296)
|
||||
ITEM(ScatterCtrl, scatter, SetTitle(t_("Basic Test")).SetTitleFont(SansSerifZ(14).Bold()).SetPlotAreaRightMargin(20).SetPlotAreaTopMargin(20).SetLabelsFont(StdFontZ(11)).SetLegendAnchor(2).HSizePosZ(4, 4).VSizePosZ(4, 4))
|
||||
ITEM(ScatterCtrl, scatter, SetTitle(t_("Basic Test")).SetPlotAreaRightMargin(20).SetPlotAreaTopMargin(20).SetLabelsFont(StdFontZ(11)).SetTitleFont(SansSerifZ(14).Bold()).SetLegendAnchor(2).HSizePosZ(4, 4).VSizePosZ(4, 4))
|
||||
END_LAYOUT
|
||||
|
||||
LAYOUT(Tab2, 380, 292)
|
||||
ITEM(ScatterCtrl, scatter, SetTitle(t_("Functions")).SetTitleFont(SansSerifZ(14).Bold()).SetPlotAreaRightMargin(110).SetPlotAreaTopMargin(20).SetLabelsFont(StdFontZ(11)).SetGridWidth(2).SetLegendAnchor(2).SetLegendPosX(-107).SetLegendPosY(0).HSizePosZ(16, 12).VSizePosZ(16, 16))
|
||||
ITEM(ScatterCtrl, scatter, SetTitle(t_("Functions")).SetGridWidth(2).SetPlotAreaRightMargin(110).SetPlotAreaTopMargin(20).SetLabelsFont(StdFontZ(11)).SetTitleFont(SansSerifZ(14).Bold()).SetLegendAnchor(2).SetLegendPosX(-107).SetLegendPosY(0).HSizePosZ(16, 12).VSizePosZ(16, 16))
|
||||
END_LAYOUT
|
||||
|
||||
LAYOUT(Tab3, 384, 284)
|
||||
ITEM(ScatterCtrl, scatter, SetAxisWidth(12).SetTitle(t_("Parametric functions demo")).SetTitleFont(SansSerifZ(14).Bold()).SetTitleColor(White).SetPlotAreaTopMargin(20).SetPlotAreaColor(Color(229, 229, 229)).SetLabelsColor(White).SetAxisColor(Color(28, 212, 0)).SetColor(Color(198, 212, 255)).SetGridColor(Color(28, 127, 0)).SetLegendAnchor(2).HSizePosZ(16, 16).VSizePosZ(16, 16))
|
||||
ITEM(ScatterCtrl, scatter, SetTitle(t_("Parametric functions demo")).SetTitleColor(White).SetPlotAreaTopMargin(20).SetPlotAreaColor(Color(229, 229, 229)).SetLabelsColor(White).SetAxisColor(Color(28, 212, 0)).SetAxisWidth(12).SetGridColor(Color(28, 127, 0)).SetTitleFont(SansSerifZ(14).Bold()).SetLegendAnchor(2).SetColor(Color(198, 212, 255)).HSizePosZ(16, 16).VSizePosZ(16, 16))
|
||||
END_LAYOUT
|
||||
|
||||
LAYOUT(Tab4, 400, 316)
|
||||
ITEM(ScatterCtrl, scatter, SetTitle(t_("Temperature Average. X Axis mouse zoom + scroll")).SetTitleFont(SansSerifZ(14).Bold()).SetPlotAreaLeftMargin(40).SetPlotAreaTopMargin(20).SetPlotAreaBottomMargin(40).SetLabelX(t_("Month")).SetLabelsFont(SansSerifZ(11)).SetLegendAnchor(2).HSizePosZ(16, 16).VSizePosZ(16, 16))
|
||||
ITEM(ScatterCtrl, scatter, SetTitle(t_("Temperature Average. X Axis mouse zoom + scroll")).SetPlotAreaLeftMargin(40).SetPlotAreaTopMargin(20).SetPlotAreaBottomMargin(40).SetLabelX(t_("Month")).SetLabelsFont(SansSerifZ(11)).SetTitleFont(SansSerifZ(14).Bold()).SetLegendAnchor(2).HSizePosZ(16, 16).VSizePosZ(16, 16))
|
||||
END_LAYOUT
|
||||
|
||||
LAYOUT(Tab5, 400, 288)
|
||||
ITEM(ScatterCtrl, scatter, SetTitle(t_("Dynamic")).SetTitleFont(StdFontZ(14).Bold()).SetPlotAreaLeftMargin(40).SetPlotAreaRightMargin(10).SetPlotAreaTopMargin(20).SetPlotAreaBottomMargin(40).SetLabelX(t_("time")).SetLabelY(t_("Electric circuit performance")).SetLegendAnchor(2).SetLegendPosX(10).SetLegendPosY(10).HSizePosZ(16, 12).VSizePosZ(12, 36))
|
||||
ITEM(ScatterCtrl, scatter, SetTitle(t_("Dynamic")).SetPlotAreaLeftMargin(40).SetPlotAreaRightMargin(10).SetPlotAreaTopMargin(20).SetPlotAreaBottomMargin(40).SetLabelX(t_("time")).SetLabelY(t_("Electric circuit performance")).SetTitleFont(StdFontZ(14).Bold()).SetLegendAnchor(2).SetLegendPosX(10).SetLegendPosY(10).HSizePosZ(16, 12).VSizePosZ(12, 36))
|
||||
ITEM(Button, bStart, SetLabel(t_("Start")).LeftPosZ(16, 42).BottomPosZ(5, 23))
|
||||
ITEM(Button, bStop, SetLabel(t_("Stop")).LeftPosZ(64, 42).BottomPosZ(5, 23))
|
||||
ITEM(Button, bReset, SetLabel(t_("Reset")).LeftPosZ(112, 42).BottomPosZ(5, 23))
|
||||
|
|
@ -38,11 +38,11 @@ LAYOUT(Tab5, 400, 288)
|
|||
END_LAYOUT
|
||||
|
||||
LAYOUT(Tab6, 400, 280)
|
||||
ITEM(ScatterCtrl, scatter, SetTitle(t_("Logarithmic Scale")).SetTitleFont(StdFontZ(14).Bold()).SetPlotAreaTopMargin(20).SetLegendAnchor(2).HSizePosZ(12, 12).VSizePosZ(16, 16))
|
||||
ITEM(ScatterCtrl, scatter, SetTitle(t_("Logarithmic Scale")).SetPlotAreaTopMargin(20).SetTitleFont(StdFontZ(14).Bold()).SetLegendAnchor(2).HSizePosZ(12, 12).VSizePosZ(16, 16))
|
||||
END_LAYOUT
|
||||
|
||||
LAYOUT(Tab7, 388, 300)
|
||||
ITEM(ScatterCtrl, scatter, SetTitle(t_("Operations")).SetTitleFont(MonospaceZ(16).Bold()).SetPlotAreaLeftMargin(45).SetPlotAreaTopMargin(20).SetLabelX(t_("[x]")).SetLabelY(t_("[y]")).SetLegendAnchor(2).HSizePosZ(12, 12).VSizePosZ(12, 36))
|
||||
ITEM(ScatterCtrl, scatter, SetTitle(t_("Operations")).SetPlotAreaLeftMargin(45).SetPlotAreaTopMargin(20).SetLabelX(t_("[x]")).SetLabelY(t_("[y]")).SetTitleFont(MonospaceZ(16).Bold()).SetLegendAnchor(2).HSizePosZ(12, 12).VSizePosZ(12, 36))
|
||||
ITEM(Button, bAddSeries, SetLabel(t_("AddSeries")).LeftPosZ(12, 60).BottomPosZ(4, 20))
|
||||
ITEM(Button, bRemoveLastSeries, SetLabel(t_("RemoveLastSeries")).LeftPosZ(76, 104).BottomPosZ(4, 20))
|
||||
ITEM(Button, bRemoveFirstSeries, SetLabel(t_("RemoveFirstSeries")).LeftPosZ(184, 100).BottomPosZ(4, 20))
|
||||
|
|
@ -50,22 +50,22 @@ LAYOUT(Tab7, 388, 300)
|
|||
END_LAYOUT
|
||||
|
||||
LAYOUT(Tab8, 400, 316)
|
||||
ITEM(ScatterCtrl, scatter, SetTitle(t_("Temperature & Pressure Averages. X-Y Axis mouse zoom + scroll")).SetTitleFont(SansSerifZ(15).Bold()).SetPlotAreaLeftMargin(40).SetPlotAreaRightMargin(70).SetPlotAreaTopMargin(20).SetPlotAreaBottomMargin(50).SetLabelX(t_("Month")).SetLabelY(t_("Legend Y")).SetLabelY2(t_("Legend Y2")).SetLabelsFont(SansSerifZ(11)).SetLegendAnchor(2).HSizePosZ(16, 16).VSizePosZ(16, 16))
|
||||
ITEM(ScatterCtrl, scatter, SetTitle(t_("Temperature & Pressure Averages. X-Y Axis mouse zoom + scroll")).SetPlotAreaLeftMargin(40).SetPlotAreaRightMargin(70).SetPlotAreaTopMargin(20).SetPlotAreaBottomMargin(50).SetLabelX(t_("Month")).SetLabelY(t_("Legend Y")).SetLabelY2(t_("Legend Y2")).SetLabelsFont(SansSerifZ(11)).SetTitleFont(SansSerifZ(15).Bold()).SetLegendAnchor(2).HSizePosZ(16, 16).VSizePosZ(16, 16))
|
||||
END_LAYOUT
|
||||
|
||||
LAYOUT(Tab9, 380, 348)
|
||||
ITEM(ScatterCtrl, scatter, SetTitle(t_("Big dataset")).SetTitleFont(SansSerifZ(14).Bold()).SetPlotAreaTopMargin(20).SetLabelsFont(StdFontZ(11)).SetLegendAnchor(2).HSizePosZ(16, 12).VSizePosZ(16, 76))
|
||||
ITEM(ScatterCtrl, scatter, SetTitle(t_("Big dataset")).SetPlotAreaTopMargin(20).SetLabelsFont(StdFontZ(11)).SetTitleFont(SansSerifZ(14).Bold()).SetLegendAnchor(2).HSizePosZ(16, 12).VSizePosZ(16, 76))
|
||||
ITEM(Option, sequentialX, SetLabel(t_("SetSequentialX")).LeftPosZ(112, 92).BottomPosZ(8, 16))
|
||||
ITEM(Option, fastView, SetLabel(t_("SetFastView")).LeftPosZ(16, 84).BottomPosZ(8, 16))
|
||||
ITEM(Label, dv___3, SetLabel(t_("It includes two series with 100000 points.\nTo work with Painter it requires SetFastView and SetSequentialX to be true. \nIf not the program could get stuck.")).HSizePosZ(16, 4).BottomPosZ(28, 44))
|
||||
END_LAYOUT
|
||||
|
||||
LAYOUT(Tab10, 380, 292)
|
||||
ITEM(ScatterCtrl, scatter, SetTitle(t_("User graph")).SetTitleFont(SansSerifZ(14).Bold()).SetPlotAreaTopMargin(20).SetLabelsFont(StdFontZ(11)).SetLegendAnchor(2).HSizePosZ(16, 12).VSizePosZ(16, 16))
|
||||
ITEM(ScatterCtrl, scatter, SetTitle(t_("User graph")).SetPlotAreaTopMargin(20).SetLabelsFont(StdFontZ(11)).SetTitleFont(SansSerifZ(14).Bold()).SetLegendAnchor(2).HSizePosZ(16, 12).VSizePosZ(16, 16))
|
||||
END_LAYOUT
|
||||
|
||||
LAYOUT(TabUserEquation, 672, 276)
|
||||
ITEM(ScatterCtrl, scatter, SetTitle(t_("User equation")).SetTitleFont(SansSerifZ(14).Bold()).SetPlotAreaRightMargin(20).SetPlotAreaTopMargin(20).SetLabelsFont(StdFontZ(11)).SetLegendAnchor(2).HSizePosZ(4, 4).VSizePosZ(4, 28))
|
||||
ITEM(ScatterCtrl, scatter, SetTitle(t_("User equation")).SetPlotAreaRightMargin(20).SetPlotAreaTopMargin(20).SetLabelsFont(StdFontZ(11)).SetTitleFont(SansSerifZ(14).Bold()).SetLegendAnchor(2).HSizePosZ(4, 4).VSizePosZ(4, 28))
|
||||
ITEM(Label, dv___1, SetLabel(t_("to")).RightPosZ(140, 16).BottomPosZ(3, 21))
|
||||
ITEM(Label, dv___2, SetLabel(t_("from y =")).RightPosZ(204, 44).BottomPosZ(3, 21))
|
||||
ITEM(Label, dv___3, SetLabel(t_("User equation y = f(x) =")).LeftPosZ(8, 116).BottomPosZ(3, 21))
|
||||
|
|
@ -80,7 +80,7 @@ LAYOUT(TabUserEquation, 672, 276)
|
|||
END_LAYOUT
|
||||
|
||||
LAYOUT(Tab11, 504, 468)
|
||||
ITEM(ScatterCtrl, scatter, SetAxisWidth(12).SetTitle(t_("Trend Line demo")).SetTitleFont(SansSerifZ(14).Bold()).SetPlotAreaLeftMargin(35).SetPlotAreaTopMargin(20).SetPlotAreaColor(Color(229, 229, 229)).SetLegendAnchor(4).HSizePosZ(8, 8).VSizePosZ(8, 108))
|
||||
ITEM(ScatterCtrl, scatter, SetTitle(t_("Trend Line demo")).SetPlotAreaLeftMargin(35).SetPlotAreaTopMargin(20).SetPlotAreaColor(Color(229, 229, 229)).SetAxisWidth(12).SetTitleFont(SansSerifZ(14).Bold()).SetLegendAnchor(4).HSizePosZ(8, 8).VSizePosZ(8, 108))
|
||||
ITEM(ArrayCtrl, grid, HSizePosZ(112, 8).BottomPosZ(4, 100))
|
||||
ITEM(Label, dv___2, SetLabel(t_("Data series:")).LeftPosZ(8, 64).BottomPosZ(55, 21))
|
||||
ITEM(Label, dv___3, SetLabel(t_("Trend Lines Details:")).LeftPosZ(8, 100).BottomPosZ(83, 21))
|
||||
|
|
@ -88,13 +88,22 @@ LAYOUT(Tab11, 504, 468)
|
|||
END_LAYOUT
|
||||
|
||||
LAYOUT(Tab12, 456, 464)
|
||||
ITEM(ScatterCtrl, scatter1, SetTitle(t_("All plots are linked together")).SetTitleFont(SansSerifZ(14).Bold()).SetPlotAreaTopMargin(20).SetLabelsFont(StdFontZ(11)).SetLegendAnchor(1).HSizePosZ(4, 4).TopPosZ(4, 152))
|
||||
ITEM(ScatterCtrl, scatter2, SetTitleFont(SansSerifZ(14).Bold()).SetPlotAreaTopMargin(0).SetLabelsFont(StdFontZ(11)).SetLegendAnchor(1).HSizePosZ(4, 4).TopPosZ(152, 152))
|
||||
ITEM(ScatterCtrl, scatter3, SetTitleFont(SansSerifZ(14).Bold()).SetPlotAreaTopMargin(0).SetLabelsFont(StdFontZ(11)).SetLegendAnchor(1).HSizePosZ(4, 4).VSizePosZ(300, 4))
|
||||
ITEM(ScatterCtrl, scatter1, SetPlotAreaTopMargin(20).SetLabelsFont(StdFontZ(11)).SetTitleFont(SansSerifZ(14).Bold()).SetLegendAnchor(1).HSizePosZ(4, 4).TopPosZ(4, 152))
|
||||
ITEM(ScatterCtrl, scatter2, SetPlotAreaTopMargin(0).SetLabelsFont(StdFontZ(11)).SetTitleFont(SansSerifZ(14).Bold()).SetLegendAnchor(1).HSizePosZ(4, 4).TopPosZ(152, 152))
|
||||
ITEM(ScatterCtrl, scatter3, SetPlotAreaTopMargin(0).SetLabelsFont(StdFontZ(11)).SetTitleFont(SansSerifZ(14).Bold()).SetLegendAnchor(1).HSizePosZ(4, 4).VSizePosZ(300, 4))
|
||||
ITEM(Option, link, SetLabel(t_("Link")).RightPosZ(4, 56).TopPosZ(4, 16))
|
||||
END_LAYOUT
|
||||
|
||||
LAYOUT(Tab13, 420, 236)
|
||||
ITEM(ScatterCtrl, scatter, SetTitle(t_("Polar Plot")).SetTitleFont(SansSerifZ(14).Bold()).SetPlotAreaTopMargin(20).SetLabelsFont(StdFontZ(11)).HSizePosZ(4, 4).VSizePosZ(4, 4))
|
||||
ITEM(ScatterCtrl, scatter, SetTitle(t_("Polar Plot")).SetPlotAreaTopMargin(20).SetLabelsFont(StdFontZ(11)).SetTitleFont(SansSerifZ(14).Bold()).HSizePosZ(4, 4).VSizePosZ(4, 4))
|
||||
END_LAYOUT
|
||||
|
||||
LAYOUT(TabRangePlot, 420, 236)
|
||||
ITEM(ScatterCtrl, scatter, SetTitle(t_("Range Plot")).SetPlotAreaLeftMargin(40).SetPlotAreaTopMargin(20).SetLabelsFont(StdFontZ(11)).SetTitleFont(SansSerifZ(14).Bold()).HSizePosZ(4, 4).VSizePosZ(4, 4))
|
||||
END_LAYOUT
|
||||
|
||||
LAYOUT(TabBallPlot, 420, 236)
|
||||
ITEM(ScatterCtrl, scatter, SetTitle(t_("Ball Plot")).SetPlotAreaLeftMargin(40).SetPlotAreaTopMargin(20).SetLabelsFont(StdFontZ(11)).SetTitleFont(SansSerifZ(14).Bold()).HSizePosZ(4, 4).VSizePosZ(4, 4))
|
||||
END_LAYOUT
|
||||
|
||||
LAYOUT(TabPie, 536, 440)
|
||||
|
|
|
|||
|
|
@ -23,8 +23,10 @@ file
|
|||
tab10.cpp,
|
||||
tab11.cpp,
|
||||
tab12.cpp,
|
||||
tab14.cpp,
|
||||
tabPie.cpp,
|
||||
tab14_UserEquation.cpp,
|
||||
tab15_RangePlot.cpp,
|
||||
tab16_BallPlot.cpp,
|
||||
tab20_Pie.cpp,
|
||||
symbol.iml;
|
||||
|
||||
mainconfig
|
||||
|
|
|
|||
|
|
@ -79,7 +79,7 @@ ScatterCtrl_Demo::ScatterCtrl_Demo()
|
|||
SetMode();
|
||||
|
||||
examplesList.WhenSel = THISBACK(OnSel);
|
||||
examplesList.Select(0, false);
|
||||
examplesList.SetCursor(13);
|
||||
OnSel();
|
||||
|
||||
Sizeable().Zoomable().Icon(MyImages::i1());
|
||||
|
|
|
|||
|
|
@ -10,15 +10,15 @@ void Tab1::Init()
|
|||
SizePos();
|
||||
|
||||
s1 << Pointf(10, 26) << Pointf(20, 37) << Pointf(30, 31) << Pointf(40, 33) << Pointf(50, 28);
|
||||
scatter.AddSeries(s1).Legend("Series 1").Opacity(0.3).Fill();
|
||||
scatter.AddSeries(s1).Legend("Series 1").Opacity(0.3).Fill().MarkBorderColor();
|
||||
|
||||
s2y[0] = 22; s2y[1] = 33; s2y[2] = 27; s2y[3] = 29; s2y[4] = 24;
|
||||
scatter.AddSeries(s2y, 5, 10, 10).Legend("Series 2").Id(SERIE2).PlotStyle<LineSeriesPlot>()
|
||||
.Dash("").MarkColor(Red()).Fill().Opacity(0.5);
|
||||
.Dash("").MarkColor(Red()).Fill().Opacity(0.5).MarkBorderColor();
|
||||
|
||||
s3y[0] = 18; s3y[1] = 29; s3y[2] = 23; s3y[3] = 25; s3y[4] = 20;
|
||||
s3x[0] = 10; s3x[1] = 20; s3x[2] = 30; s3x[3] = 40; s3x[4] = 50;
|
||||
scatter.AddSeries(s3x, s3y, 5).Legend("Series 3");
|
||||
scatter.AddSeries(s3x, s3y, 5).Legend("Series 3").MarkBorderColor();
|
||||
|
||||
s4y << 14 << 25 << 19 << 21 << 16;
|
||||
s4x << 10 << 20 << 30 << 40 << 50;
|
||||
|
|
|
|||
|
|
@ -21,8 +21,23 @@ void Tab12::Init()
|
|||
scatter2.AddSeries(s2).Legend("Series 2").NoMark().Stroke(2, LtBlue());
|
||||
scatter3.AddSeries(s3).Legend("Series 3").NoMark().Stroke(2, LtGreen());
|
||||
scatter1.ShowInfo();
|
||||
scatter2.ShowInfo().LinkedWith(scatter1);
|
||||
scatter3.ShowInfo().LinkedWith(scatter2);
|
||||
scatter2.ShowInfo();
|
||||
scatter3.ShowInfo();
|
||||
link = true;
|
||||
OnLink();
|
||||
link.WhenAction = THISBACK(OnLink);
|
||||
}
|
||||
|
||||
void Tab12::OnLink() {
|
||||
if (link) {
|
||||
scatter1.SetTitle("Plots are linked together");
|
||||
scatter2.LinkedWith(scatter1);
|
||||
scatter3.LinkedWith(scatter1);
|
||||
} else {
|
||||
scatter1.SetTitle("Plots are not linked now");
|
||||
scatter2.Unlinked();
|
||||
scatter3.Unlinked();
|
||||
}
|
||||
}
|
||||
|
||||
ScatterDemo *Construct12()
|
||||
|
|
|
|||
44
examples/ScatterCtrl_Demo/tab14_UserEquation.cpp
Normal file
44
examples/ScatterCtrl_Demo/tab14_UserEquation.cpp
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
#include "ScatterCtrl_Demo.h"
|
||||
|
||||
|
||||
void TabUserEquation::Init()
|
||||
{
|
||||
CtrlLayout(*this);
|
||||
SizePos();
|
||||
|
||||
equation <<= "25 + 10*sin(0.5*x + 5)";
|
||||
fromX <<= 0;
|
||||
toX <<= 100;
|
||||
fromY <<= 0;
|
||||
toY <<= 50;
|
||||
|
||||
update.WhenAction = THISBACK(OnUpdate);
|
||||
scatter.SetMouseHandling(true, true);
|
||||
OnUpdate();
|
||||
}
|
||||
|
||||
void TabUserEquation::OnUpdate()
|
||||
{
|
||||
if (fromX >= toX || fromY >= toY) {
|
||||
Exclamation("Wrong limits");
|
||||
return;
|
||||
}
|
||||
|
||||
userEquation.Init("User equation", equation);
|
||||
|
||||
scatter.RemoveAllSeries();
|
||||
scatter.AddSeries(userEquation).Legend(userEquation.GetFullName()).NoMark().Stroke(2);
|
||||
scatter.SetXYMin(fromX, fromY);
|
||||
scatter.SetRange(toX - fromX, toY - fromY);
|
||||
scatter.FitToData(true);
|
||||
}
|
||||
|
||||
ScatterDemo *ConstructUserEquation()
|
||||
{
|
||||
static TabUserEquation tab;
|
||||
return &tab;
|
||||
}
|
||||
|
||||
INITBLOCK {
|
||||
RegisterExample("User equation", ConstructUserEquation, __FILE__);
|
||||
}
|
||||
33
examples/ScatterCtrl_Demo/tab15_RangePlot.cpp
Normal file
33
examples/ScatterCtrl_Demo/tab15_RangePlot.cpp
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
#include "ScatterCtrl_Demo.h"
|
||||
|
||||
|
||||
void TabRangePlot::Init()
|
||||
{
|
||||
CtrlLayout(*this);
|
||||
SizePos();
|
||||
|
||||
scatter.SetMouseHandling(true, true).ShowContextMenu();
|
||||
|
||||
for (double size = 0; size <= 10; size += 2.) {
|
||||
Vector<double> &data = s1.Add();
|
||||
double val = size * 10.;
|
||||
data << size << val << (val - 10) << (val - 4) << (val + 4) << (val + 10);
|
||||
}
|
||||
idsRange << 2 << 3 << 4 << 5;
|
||||
static Vector<int> idVoid;
|
||||
scatter.AddSeries(s1, 1, 0, idsRange, idVoid, idVoid).Legend("Time").Units("sec")
|
||||
.MarkStyle<RangePlot>(RangePlot::MIN_AVG_MAX).NoPlot();
|
||||
|
||||
scatter.SetLabelY("Size");
|
||||
scatter.FitToData(true, 0.2);
|
||||
}
|
||||
|
||||
ScatterDemo *Construct15()
|
||||
{
|
||||
static TabRangePlot tab;
|
||||
return &tab;
|
||||
}
|
||||
|
||||
INITBLOCK {
|
||||
RegisterExample("RangePlot", Construct15, __FILE__);
|
||||
}
|
||||
32
examples/ScatterCtrl_Demo/tab16_BallPlot.cpp
Normal file
32
examples/ScatterCtrl_Demo/tab16_BallPlot.cpp
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
#include "ScatterCtrl_Demo.h"
|
||||
|
||||
|
||||
void TabBallPlot::Init()
|
||||
{
|
||||
CtrlLayout(*this);
|
||||
SizePos();
|
||||
|
||||
scatter.SetMouseHandling(true, true).ShowContextMenu();
|
||||
|
||||
for (double size = 0; size <= 10; size += 2.) {
|
||||
Vector<double> &data = s1.Add();
|
||||
data << size << 10 + 50*sin(size/M_PI) << size*4 + 4;
|
||||
}
|
||||
idsBall << 2;
|
||||
static Vector<int> idVoid;
|
||||
scatter.AddSeries(s1, 1, 0, idVoid, idVoid, idsBall).Legend("Importance").MarkStyle<BallPlot>()
|
||||
.NoPlot().MarkColor(Green()).MarkBorderColor(LtRed()).MarkBorderWidth(3);
|
||||
|
||||
scatter.SetLabelY("Size");
|
||||
scatter.FitToData(true, 0.2);
|
||||
}
|
||||
|
||||
ScatterDemo *Construct16()
|
||||
{
|
||||
static TabBallPlot tab;
|
||||
return &tab;
|
||||
}
|
||||
|
||||
INITBLOCK {
|
||||
RegisterExample("BallPlot", Construct16, __FILE__);
|
||||
}
|
||||
12
examples/ScatterCtrl_Demo/tab20_Pie.cpp
Normal file
12
examples/ScatterCtrl_Demo/tab20_Pie.cpp
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
#include "ScatterCtrl_Demo.h"
|
||||
|
||||
|
||||
void TabPie::Init()
|
||||
{
|
||||
CtrlLayout(*this);
|
||||
|
||||
chart.ShowPercent();
|
||||
chart.AddCategory("Sunny", 8, ::Color(90, 150, 255));
|
||||
chart.AddCategory("Cloudy", 4, ::Color(90, 255, 150));
|
||||
chart.AddCategory("Rainy", 2, ::Color(250, 150, 90));
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue