Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » Community » Newbie corner » (SOLVED) ScatterCtrl, 2 questions.
(SOLVED) ScatterCtrl, 2 questions. [message #40596] Tue, 20 August 2013 12:26 Go to previous message
rxantos is currently offline  rxantos
Messages: 73
Registered: October 2011
Member
Sorry for the big image. But is easier for me to explain.

index.php?t=getfile&id=4293&private=0

The code I use for the example
#include <ScatterCtrl/ScatterCtrl.h>
using namespace Upp;

#define LAYOUTFILE <TestScatter/TestScatter.lay>
#include <CtrlCore/lay.h>

class TestScatter : public WithTestScatterLayout<TopWindow> {
public:
	enum {
		NPOINTS = 1000,
	};
	typedef TestScatter CLASSNAME;
	Vector<Pointf> points;
	TestScatter();
};

TestScatter::TestScatter()
{
	int x,y,yMax = 0;
	
	
	points.SetCount(NPOINTS);
	Pointf * pv = points.Begin();
	
	for(x = 0; x < NPOINTS; x++, pv++) {
		pv->x = (double)x;
		y = rand();
		if(yMax < y) {
			yMax = y;
		}
		pv->y = (double)(y);
	}
	
	sv.AddSeries(points).Legend("Y").Opacity(0.3).NoMark().Stroke(1);
	sv.SetFastViewX().SetSequentialX().SetDrawXReticle().SetDrawYReticle().SetSequentialXAll();
	sv.ShowInfo().ShowContextMenu().SetMouseHandling().SetMaxZoom(1000).SetMinZoom(10);
	sv.ShowHGrid(false).ShowVGrid(false).SetLabels("X","Y");
	sv.SetXYMin(0,0,0).SetRange(NPOINTS, yMax);
	sv.Refresh();

	Zoomable().Sizeable();
	CtrlLayout(*this, "Window title");
}

GUI_APP_MAIN
{
	TestScatter().Run();
}


The Layout is just
LAYOUT(TestScatterLayout, 368, 248)
	ITEM(ScatterCtrl, sv, HSizePosZ(28, 40).VSizePosZ(24, 24))
END_LAYOUT


The first problem (the one in which the points are not in the correct position) does not happen when the image is exported, only when its shown.

As for the 2nd problem. How I get a zoom out limited to the size of the data?
  • Attachment: scatter.png
    (Size: 95.00KB, Downloaded 697 times)

[Updated on: Sat, 07 September 2013 12:17]

Report message to a moderator

 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message icon14.gif
Read Message
Previous Topic: Can't add asembly from bazzar
Next Topic: Painter 2.0 Path definition: mix of cubics and quadratics
Goto Forum:
  


Current Time: Tue May 06 19:46:33 CEST 2025

Total time taken to generate the page: 0.03774 seconds