mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-05-15 14:16:07 -06:00
ScatterCtrl_Demo: Included etacked plots
git-svn-id: svn://ultimatepp.org/upp/trunk@11643 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
f75168f184
commit
ac325648f1
9 changed files with 94 additions and 26 deletions
|
|
@ -226,8 +226,22 @@ private:
|
|||
Vector<int> idsRange;
|
||||
Vector<Pointf> sdata, smin, smax;
|
||||
VectorPointf dmin, dmax;
|
||||
DataReverse rev;
|
||||
DataAppend app;
|
||||
DataRange range;
|
||||
};
|
||||
|
||||
class TabStackedPlot : public WithTabStackedPlot<ScatterDemo> {
|
||||
public:
|
||||
typedef TabStackedPlot CLASSNAME;
|
||||
|
||||
void Init();
|
||||
virtual ScatterCtrl &Scatter() {return scatter;};
|
||||
|
||||
void OnPlot();
|
||||
|
||||
private:
|
||||
Vector<Pointf> s1, s2, s3;
|
||||
VectorPointf ds1, ds2, ds3;
|
||||
DataStackedY stacked;
|
||||
};
|
||||
|
||||
class TabBubblePlot : public WithTabBubblePlot<ScatterDemo> {
|
||||
|
|
|
|||
|
|
@ -94,14 +94,15 @@ LAYOUT(Tab12Linked, 456, 464)
|
|||
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")).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).SetPlotAreaBottomMargin(40).SetLabelsFont(StdFontZ(11)).SetTitleFont(SansSerifZ(14).Bold()).HSizePosZ(4, 4).VSizePosZ(4, 4))
|
||||
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))
|
||||
END_LAYOUT
|
||||
|
||||
LAYOUT(TabBubblePlot, 420, 236)
|
||||
ITEM(ScatterCtrl, scatter, SetTitle(t_("Bubble Plot")).SetPlotAreaLeftMargin(40).SetPlotAreaTopMargin(20).SetLabelsFont(StdFontZ(11)).SetTitleFont(SansSerifZ(14).Bold()).HSizePosZ(4, 4).VSizePosZ(4, 4))
|
||||
END_LAYOUT
|
||||
|
|
|
|||
|
|
@ -25,8 +25,9 @@ file
|
|||
tab12_Linked.cpp,
|
||||
tab14_UserEquation.cpp,
|
||||
tab15_RangePlot.cpp,
|
||||
tab16_BubblePlot.cpp,
|
||||
tab17_UserPaint.cpp,
|
||||
tab16_StackedPlot.cpp,
|
||||
tab17_BubblePlot.cpp,
|
||||
tab18_UserPaint.cpp,
|
||||
tab20_Pie.cpp,
|
||||
symbol.iml;
|
||||
|
||||
|
|
|
|||
|
|
@ -51,14 +51,7 @@ ScatterCtrl_Demo::ScatterCtrl_Demo()
|
|||
Add((*(Examples()[i].ctrl())).HSizePosZ(180, 4).VSizePosZ(4, 8));
|
||||
examplesRects.Add(Examples()[i].ctrl());
|
||||
}
|
||||
/* for (int i = 0; i < Examples().GetCount(); ++i) {
|
||||
if (Examples()[i].name == "User equation") {
|
||||
TabUserEquation &tab = dynamic_cast<TabUserEquation&>(*Examples()[i].ctrl());
|
||||
EditString &equation = tab.equation;
|
||||
equation.SetText("HELLO WORLD");
|
||||
}
|
||||
}*/
|
||||
|
||||
|
||||
examplesList.Add("Pie chart");
|
||||
tabPie.Init();
|
||||
Add(tabPie.HSizePosZ(180, 4).VSizePosZ(4, 8));
|
||||
|
|
@ -87,7 +80,7 @@ ScatterCtrl_Demo::ScatterCtrl_Demo()
|
|||
SetMode();
|
||||
|
||||
examplesList.WhenSel = THISBACK(OnSel);
|
||||
examplesList.SetCursor(13);
|
||||
examplesList.SetCursor(14);
|
||||
OnSel();
|
||||
|
||||
Sizeable().Zoomable().Icon(MyImages::i1());
|
||||
|
|
|
|||
|
|
@ -24,11 +24,10 @@ void TabRangePlot::Init()
|
|||
smax << Pointf(sdata[i].x, sdata[i].y + 5 + Random(10));
|
||||
smin << Pointf(sdata[i].x, sdata[i].y - 5 - Random(10));
|
||||
}
|
||||
dmin.Init(smin);
|
||||
rev.Init(dmin);
|
||||
dmax.Init(smax);
|
||||
app.Init(dmax, rev);
|
||||
scatter.AddSeries(app).Legend("Range").Closed(true).Stroke(0).Fill(LtCyan()).Opacity(0.5).NoMark();
|
||||
dmin.Init(smin);
|
||||
range.Init(dmax, dmin);
|
||||
scatter.AddSeries(range).Legend("Range").Closed(true).Stroke(0).Fill(LtCyan()).Opacity(0.5).NoMark();
|
||||
scatter.AddSeries(smax).Legend("Max").Stroke(1, Blue()).NoMark();
|
||||
scatter.AddSeries(smin).Legend("Min").Stroke(1, Blue()).NoMark();
|
||||
scatter.AddSeries(sdata).Legend("Data").Stroke(4, Blue()).NoMark();
|
||||
|
|
|
|||
58
examples/ScatterCtrl_Demo/tab16_StackedPlot.cpp
Normal file
58
examples/ScatterCtrl_Demo/tab16_StackedPlot.cpp
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
#include "ScatterCtrl_Demo.h"
|
||||
|
||||
void TabStackedPlot::Init()
|
||||
{
|
||||
CtrlLayout(*this);
|
||||
SizePos();
|
||||
|
||||
scatter.SetMouseHandling(true, true).ShowContextMenu().ShowPropertiesDlg().ShowProcessDlg();
|
||||
|
||||
for (int x = 0; x <= 10; ++x) {
|
||||
s1 << Pointf(x, Random(50));
|
||||
s2 << Pointf(x, Random(50));
|
||||
s3 << Pointf(x, Random(50));
|
||||
}
|
||||
ds1.Init(s1);
|
||||
ds2.Init(s2);
|
||||
ds3.Init(s3);
|
||||
stacked.Add(ds1).Add(ds2).Add(ds3);
|
||||
|
||||
scatter.AddSeries(stacked.Get(2)).Legend("s1").Fill();
|
||||
scatter.AddSeries(stacked.Get(1)).Legend("s2").Fill();
|
||||
scatter.AddSeries(stacked.Get(0)).Legend("s3").Fill();
|
||||
|
||||
scatter.SetLabelY("Data").SetLabelX("time [seg]");
|
||||
scatter.ShowButtons();
|
||||
|
||||
type = 0;
|
||||
type.WhenAction = THISBACK(OnPlot);
|
||||
|
||||
OnPlot();
|
||||
}
|
||||
|
||||
void TabStackedPlot::OnPlot()
|
||||
{
|
||||
stacked.Set100(type == 1);
|
||||
scatter.ZoomToFit(true, type != 1, 0.2);
|
||||
if (type == 1) {
|
||||
scatter.SetXYMin(-2, -10);
|
||||
scatter.SetRange(14, 120);
|
||||
scatter.SetMajorUnits(2, 10);
|
||||
scatter.SetMinUnits(-2, -10);
|
||||
} else {
|
||||
scatter.SetXYMin(-2, Null);
|
||||
scatter.SetRange(14, Null);
|
||||
scatter.SetMajorUnits(2, Null);
|
||||
scatter.SetMinUnits(-2, Null);
|
||||
}
|
||||
}
|
||||
|
||||
ScatterDemo *Construct16()
|
||||
{
|
||||
static TabStackedPlot tab;
|
||||
return &tab;
|
||||
}
|
||||
|
||||
INITBLOCK {
|
||||
RegisterExample("StackedPlot", Construct16, __FILE__);
|
||||
}
|
||||
|
|
@ -21,12 +21,12 @@ void TabBubblePlot::Init()
|
|||
scatter.ZoomToFit(true, true, 0.2);
|
||||
}
|
||||
|
||||
ScatterDemo *Construct16()
|
||||
ScatterDemo *Construct17()
|
||||
{
|
||||
static TabBubblePlot tab;
|
||||
return &tab;
|
||||
}
|
||||
|
||||
INITBLOCK {
|
||||
RegisterExample("BubblePlot", Construct16, __FILE__);
|
||||
RegisterExample("BubblePlot", Construct17, __FILE__);
|
||||
}
|
||||
|
|
@ -18,12 +18,12 @@ void Tab_UserPaint::Init()
|
|||
scatter.WhenDraw = THISBACK(OnDraw);
|
||||
}
|
||||
|
||||
ScatterDemo *Construct17()
|
||||
ScatterDemo *Construct18()
|
||||
{
|
||||
static Tab_UserPaint tab;
|
||||
return &tab;
|
||||
}
|
||||
|
||||
INITBLOCK {
|
||||
RegisterExample("User paint", Construct17, __FILE__);
|
||||
RegisterExample("User paint", Construct18, __FILE__);
|
||||
}
|
||||
|
|
@ -8,5 +8,7 @@ void TabPie::Init()
|
|||
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));
|
||||
chart.AddCategory("Rainy", 2, ::Color(250, 150, 90));
|
||||
|
||||
chart.SetColor(Null);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue