ScatterCtrl_Demo: Some fixes and improvements

git-svn-id: svn://ultimatepp.org/upp/trunk@11578 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
koldo 2017-12-18 12:54:26 +00:00
parent 82f5d5efd7
commit 38dd3daafb
7 changed files with 36 additions and 7 deletions

View file

@ -29,6 +29,7 @@ public:
virtual ScatterCtrl &Scatter() {return scatter;};
private:
Vector<Pointf> sDemoRed1, sDemoRed2,sDemoGreen;
Vector<Pointf> s1;
double s2y[5];
double s3x[5], s3y[5];
@ -221,8 +222,12 @@ public:
virtual ScatterCtrl &Scatter() {return scatter;};
private:
Vector<Vector <double> > s1;
Vector<Vector <double> > s1, s2;
Vector<int> idsRange;
Vector<Pointf> sdata, smin, smax;
VectorPointf dmin, dmax;
DataReverse rev;
DataAppend app;
};
class TabBubblePlot : public WithTabBubblePlot<ScatterDemo> {

View file

@ -111,7 +111,7 @@ LAYOUT(TabUserPaint, 428, 296)
END_LAYOUT
LAYOUT(TabPie, 536, 440)
ITEM(PieCtrl, chart, SetLegendBackColor(Color(229, 229, 229)).SetLegendLeft(20).SetTitle(t_("Average Weather")).SetFrame(ThinInsetFrame()).HSizePosZ(8, 12).VSizePosZ(40, 12))
ITEM(PieCtrl, chart, SetLegendLeft(20).SetLegendBackColor(Color(229, 229, 229)).SetTitle(t_("Average Weather")).SetFrame(ThinInsetFrame()).HSizePosZ(8, 12).VSizePosZ(40, 12))
ITEM(Label, dv___1, SetLabel(t_(" EXPERIMENTAL")).SetFrame(ThinInsetFrame()).LeftPosZ(8, 84).TopPosZ(8, 24))
END_LAYOUT

View file

@ -51,6 +51,14 @@ 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));

View file

@ -1,6 +1,5 @@
#include "ScatterCtrl_Demo.h"
void TabRangePlot::Init()
{
CtrlLayout(*this);
@ -19,7 +18,23 @@ void TabRangePlot::Init()
scatter.AddSeries(s1, 0, Null, idVoid, idsRange, idVoid).Legend("Size").Units("m")
.MarkStyle<RangePlot>(RangePlot::MIN_AVG_MAX);
sdata << Pointf(0, 10) << Pointf(1, 14) << Pointf(2, 20) << Pointf(3, 30) << Pointf(4, 23) << Pointf(5, 25)
<< Pointf(6, 3) << Pointf(7, 21) << Pointf(8, 37) << Pointf(9, 32) << Pointf(10, 28);
for (int i = 0; i < sdata.GetCount(); ++i) {
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();
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();
scatter.SetLabelY("Size").SetLabelX("time [seg]");
scatter.ShowButtons();
scatter.ZoomToFit(true, true, 0.2);
}

View file

@ -9,7 +9,7 @@ void Tab1_Basic::Init()
CtrlLayout(*this);
SizePos();
s1 << Pointf(10, 26) << Pointf(20, 37) << Pointf(30, 31) << Pointf(40, 33) << Pointf(50, 28);
s1 << Pointf(12, 26) << Pointf(20, 37) << Pointf(30, 31) << Pointf(40, 33) << Pointf(50, 28);
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;
@ -17,7 +17,7 @@ void Tab1_Basic::Init()
.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;
s3x[0] = 8; s3x[1] = 20; s3x[2] = 30; s3x[3] = 40; s3x[4] = 50;
scatter.AddSeries(s3x, s3y, 5).Legend("Series 3").MarkBorderColor();
s4y << 14 << 25 << 19 << 21 << 16;
@ -30,7 +30,7 @@ void Tab1_Basic::Init()
s5.Add(40, 16);
s5.Add(50, 12);
int barWidth = 4;
scatter.AddSeries(s5).Legend("Series 5").PlotStyle<BarSeriesPlot>(barWidth).Dash("").NoMark().Fill();
scatter.AddSeries(s5).Legend("Series 5").PlotStyle<BarSeriesPlot>().BarWidth(barWidth).Dash("").NoMark().Fill();
scatter.SetRange(60, 50).SetMajorUnits(10, 10);
scatter.ShowInfo().ShowContextMenu().ShowPropertiesDlg().ShowProcessDlg().SetPopText("h", "v", "v2").SetMouseHandling(true, true);

View file

@ -9,6 +9,7 @@ void Tab5_Dynamic::Init()
scatter.SetRange(10, 100);
scatter.AddSeries(s1).Legend("U-t").Units("V", "s").NoMark();
scatter.AddSeries(s2).Legend("I-t").Units("A", "s").NoMark();
scatter.SetFastViewX(true).SetSequentialXAll(true);
bStart <<=(THISBACK(Start));
bStop <<=(THISBACK(Stop));
bReset <<=(THISBACK(Reset));

View file

@ -11,7 +11,7 @@ void Tab8_Secondary::Init()
s3 <<Pointf(1,-12)<<Pointf(2,-17)<<Pointf(3,-13)<<Pointf(4,15)<<Pointf(5,18)<<Pointf(6,25)<<Pointf(7,27)<<Pointf(8,20)<<Pointf(9,5)<<Pointf(10,-10)<<Pointf(11,24)<<Pointf(12,17);
double barWidth = 0.4;
scatter.AddSeries(s3).Legend("Speed").Units("km/h").PlotStyle<BarSeriesPlot>(barWidth).NoMark().Stroke(2, Gray()).Dash(LINE_SOLID).Fill(LtGray());
scatter.AddSeries(s3).Legend("Speed").Units("km/h").PlotStyle<BarSeriesPlot>().BarWidth(barWidth).NoMark().Stroke(2, Gray()).Dash(LINE_SOLID).Fill(LtGray());
s1<<Pointf(1,-6)<<Pointf(2,-4)<<Pointf(3,2)<<Pointf(4,8)<<Pointf(5,8)<<Pointf(6,15)<<Pointf(7,20)<<Pointf(8,30)<<Pointf(9,14)<<Pointf(10,10)<<Pointf(11,3)<<Pointf(12,-11);
scatter.AddSeries(s1).Legend("Temperature").Units("ºC").Stroke(3, Null).Dash(LINE_DASHED).MarkStyle<SquareMarkPlot>();