U++ framework
Do not panic. Ask here before giving up.

Home » Developing U++ » UppHub » GraphDraw/GraphCtrl
Re: GraphDraw/GraphCtrl [message #54091 is a reply to message #54080] Sun, 31 May 2020 12:23 Go to previous messageGo to next message
Pradip is currently offline  Pradip
Messages: 109
Registered: February 2019
Location: India
Experienced Member
Hello Didier,

Just take your time with the zoom and scroll features. All scrolling seems to be just fine, there might be a small glitch with zooming. This is what I found:

With DisableYScroll(true) and DisableYZoom(true), the graph can never be scrolled in Y direction, but it is possible to zoom in Y direction by ctrl + mouse wheel. This might help you in finding the glitch.

Meanwhile if you can add the InvertAxis() it will really be very helpful.

As I'm exploring it, I'm amazed more and more with the thoughtful features of the GraphCtrl!!! Superb work indeed!


Regards,
Pradip
Re: GraphDraw/GraphCtrl [message #54112 is a reply to message #54091] Mon, 01 June 2020 16:15 Go to previous messageGo to next message
Didier is currently offline  Didier
Messages: 740
Registered: November 2008
Location: France
Contributor
Hello Pradip,
InvertAxis() is comming, I have something working. Needs some cleaning
Re: GraphDraw/GraphCtrl [message #54196 is a reply to message #54112] Sat, 06 June 2020 22:31 Go to previous messageGo to next message
Didier is currently offline  Didier
Messages: 740
Registered: November 2008
Location: France
Contributor
tHello Pradip,

I finally finished InvertAxis was working since last week but I had a bug laying around. took me some time to find it
I updated GanttCtrl_test so you can see how to use it.

Re: GraphDraw/GraphCtrl [message #54198 is a reply to message #54196] Sun, 07 June 2020 14:07 Go to previous messageGo to next message
Pradip is currently offline  Pradip
Messages: 109
Registered: February 2019
Location: India
Experienced Member
Hello Didier!

Yay! You are just awesome!
gantt.GetY1GridAxisDraw().setAxisInverted(); this does the job! Yaay!
Plus the bug with zoom/scroll is also fixed now! Thank you so much! See a screenshot of my app, you really made it possible!

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

Next I need to have dynamic grid, changing the granularity and type of display with zoom in and out, and need to find a way to scroll the gantt along with tree/array. I'll show you some sample of the dynamic grids that I'm talking about. Also I need to have a vertical line showing today, and the gray vertical bands should appear for declared holidays also. I'll study class GanttGridAxisDraw bit more. I'll write you about it soon.

Thanks a lot Very Happy


Regards,
Pradip

[Updated on: Mon, 08 June 2020 06:55]

Report message to a moderator

icon14.gif  Re: GraphDraw/GraphCtrl [message #54204 is a reply to message #54198] Sun, 07 June 2020 18:49 Go to previous messageGo to next message
Didier is currently offline  Didier
Messages: 740
Registered: November 2008
Location: France
Contributor
Hello Pradip,

Looks great, happy to see it is usefull for you Razz

To make a dynamic grid you have to :
..* modify GanttGridStepCalcCbk()
....This is the method that determines where to put grid lines
..* Modify PaintXxxx() methods to give each grid step the look you want
......* PaintHGrid() : paints the grid on the graph
......* PaintAxisTop() : paints the upper axis part (where the date is displayed)

[Updated on: Sun, 07 June 2020 18:50]

Report message to a moderator

Re: GraphDraw/GraphCtrl [message #54213 is a reply to message #54204] Thu, 11 June 2020 10:44 Go to previous messageGo to next message
Pradip is currently offline  Pradip
Messages: 109
Registered: February 2019
Location: India
Experienced Member
Hello Didier,

Please suggest an easy way to set the grid step to a specific value, bypassing NormalizedStep. For Y axis I need to have the grid steps interval as 1, that's why.


Regards,
Pradip

[Updated on: Thu, 11 June 2020 12:35]

Report message to a moderator

Re: GraphDraw/GraphCtrl [message #54215 is a reply to message #54213] Thu, 11 June 2020 12:34 Go to previous messageGo to next message
Pradip is currently offline  Pradip
Messages: 109
Registered: February 2019
Location: India
Experienced Member
Hello Didier,

And how to change the X and Y grid colors? For previous message and this one I tried these, don't seem to work
	gantt.SetYGridColor(Yellow());
	gantt.SetXGridColor(Yellow());
	gantt.setYNbGridSteps(array.GetCount());


Regards,
Pradip
Re: GraphDraw/GraphCtrl [message #54217 is a reply to message #54215] Thu, 11 June 2020 15:53 Go to previous messageGo to next message
Pradip is currently offline  Pradip
Messages: 109
Registered: February 2019
Location: India
Experienced Member
Hello Didier,

Hope you don't mind me asking random questions Razz

Please check this code in GraphDraw.cpp
	void DrawSmartText(Draw& draw, int x, int y, int cx, const char *text, const Font scaledFont, Color ink, int scale) {
		if(*text == '\1') {
			RichText txt = ParseQTF(text + 1, 0);
			txt.ApplyZoom(GetRichTextStdScreenZoom());
			txt.Paint(Zoom(scale, 1), draw, x, y, cx);
			return;
		}
		DrawTLText(draw, x, y, cx, ToUnicode(text, CHARSET_DEFAULT), scaledFont, ink, 0);
	}


QTF is activated if the first byte is '\1', is this different behavior from standard QTF, where '\1' escapes all following characters?


Regards,
Pradip
Re: GraphDraw/GraphCtrl [message #54219 is a reply to message #54217] Fri, 12 June 2020 10:31 Go to previous messageGo to next message
deep is currently offline  deep
Messages: 281
Registered: July 2011
Location: Bangalore
Experienced Member
void DrawSmartText(Draw& draw, ...)

This is defined in LabelBase h/cpp
Where ever it is derived from LabelBase you can use QTF.

e.g. Labels, Button, Tooltip, OK/Cancel prompts etc.


Warm Regards

Deepak

[Updated on: Fri, 12 June 2020 10:32]

Report message to a moderator

Re: GraphDraw/GraphCtrl [message #54225 is a reply to message #54219] Sat, 13 June 2020 09:13 Go to previous messageGo to next message
Pradip is currently offline  Pradip
Messages: 109
Registered: February 2019
Location: India
Experienced Member
Dear Deepak,

Thanks! That will definitely help my understanding.


Regards,
Pradip
Re: GraphDraw/GraphCtrl [message #54239 is a reply to message #54225] Sat, 13 June 2020 23:49 Go to previous messageGo to next message
Didier is currently offline  Didier
Messages: 740
Registered: November 2008
Location: France
Contributor
Hello Pradip,

Quote:
void DrawSmartText(Draw& draw, ...)


In fact I have a modified copy of the original method : 'scale' parameter is added
'\1' is a QTF trick of original method : if first caracter == '\1' then texte is QTF otherwise it not the case

Quote:
gantt.SetYGridColor(Yellow());
gantt.SetXGridColor(Yellow());

These methods do not work anymore since I added Chameleon support : work is not finished
And to be honest, the simple solution would be to suppress these methods.
But on the other hand, these methods allow access through the layout-designer
which was my first objective... so suppressing them doesn't satisfy me.
I have to find an elegant way to mix both (I have some ideas but didn't start coding yet)

Quote:
gantt.setYNbGridSteps(array.GetCount());

This one shoudn't be present: it uses GridStepManager::SetNbSteps() which is for internal use

Quote:
Please suggest an easy way to set the grid step to a specific value, bypassing NormalizedStep. For Y axis I need to have the grid steps interval as 1, that's why

I will post you solution in next message

[Updated on: Sat, 13 June 2020 23:51]

Report message to a moderator

Re: GraphDraw/GraphCtrl [message #54240 is a reply to message #54239] Sun, 14 June 2020 00:09 Go to previous messageGo to next message
Didier is currently offline  Didier
Messages: 740
Registered: November 2008
Location: France
Contributor
Here the code you need,

A dedicated function to calculate the steps (with a fixed grid step off 1)

static void GanttCtrl::step1_GridStepCalcCbk(GridStepManager& gridStepManager, CoordinateConverter& coordConv) {
	const unsigned int nbMaxSteps = GridStepManager::NB_MAX_STEPS; //gridStepManager.GetNbMaxSteps();
	GridStepData* gridStepData = gridStepManager.GetGridStepData();
	TypeGraphCoord gridStepValue = 1;
	TypeGraphCoord gridStartValue = GridStepManager::GetGridStartValue( gridStepValue, coordConv.getGraphMin() );

	unsigned int nbSteps = (unsigned int)tabs((coordConv.getGraphMax() - gridStartValue) / gridStepValue);
	
	if (nbSteps > nbMaxSteps) {
		nbSteps = nbMaxSteps;
	}
	gridStepManager.SetNbSteps(nbSteps);

	// fill step values ==> used by gridStepIterator
	for (unsigned int c=0; c<nbSteps+1; ++c) {
		gridStepData[c].stepGraphValue = gridStartValue + gridStepValue*c;
		gridStepData[c].drawTickText = 0;// ==> draw tick text not needed (from you're screen shot)
	}
}



In GanttCtrl constructor, add:
	GetY1GridAxisDraw().GetGridStepManager().setCustomGridSteps(STDBACK(step1_GridStepCalcCbk));


And the trick is done Smile

[Updated on: Sun, 14 June 2020 00:14]

Report message to a moderator

Re: GraphDraw/GraphCtrl [message #54242 is a reply to message #54240] Sun, 14 June 2020 00:44 Go to previous messageGo to next message
Didier is currently offline  Didier
Messages: 740
Registered: November 2008
Location: France
Contributor
To set the colors using Chameleon, use the following code:

In you're application header (in GanttCtrl_Test class) declare the following variable:
	Upp::GraphDraw_ns::GanttCtrl::Style ganttStyle;


In application init (GanttCtrl_Test constructor) add the following code:
(Not sure it is axisColor you wanted to change, probably gridColor)
	ganttStyle = graph.StyleDefault();
//	ganttStyle.x1AxisStyle.axisWidth     = 2;
	ganttStyle.x1AxisStyle.axisColor     = Yellow();
//	ganttStyle.x1AxisStyle.axisTextFont  = StdFont();
//	ganttStyle.x1AxisStyle.axisTextColor = SRed();
//	ganttStyle.x1AxisStyle.axisTickColor = SRed();
//	ganttStyle.x1AxisStyle.gridColor     = Yellow();
//	ganttStyle.x1AxisStyle.primaryTickFactory    << []() ->TickMark* { TickMark* t = new LineTickMark();  t->SetTickLength(3); return t; };
//	ganttStyle.x1AxisStyle.secondaryTickFactory  << []() ->TickMark* { TickMark* t = new LineTickMark();  t->SetTickLength(1); return t; };
//	ganttStyle.x1AxisStyle.lmntBackgnd = Null;
//
//	ganttStyle.y1AxisStyle.axisWidth     = 2;
	ganttStyle.y1AxisStyle.axisColor     = Yellow();
//	ganttStyle.y1AxisStyle.axisTextFont  = StdFont();
//	ganttStyle.y1AxisStyle.axisTextColor = SRed();
//	ganttStyle.y1AxisStyle.axisTickColor = SRed();
//	ganttStyle.y1AxisStyle.gridColor     = Yellow();
//	ganttStyle.y1AxisStyle.primaryTickFactory    << []() ->TickMark* { TickMark* t = new LineTickMark();  t->SetTickLength(3); return t; };
//	ganttStyle.y1AxisStyle.secondaryTickFactory  << []() ->TickMark* { TickMark* t = new LineTickMark();  t->SetTickLength(1); return t; };
//	ganttStyle.y1AxisStyle.lmntBackgnd = Null;

	graph.SetStyle( ganttStyle );

[Updated on: Sun, 14 June 2020 00:45]

Report message to a moderator

Re: GraphDraw/GraphCtrl [message #54287 is a reply to message #54242] Sun, 21 June 2020 12:48 Go to previous messageGo to next message
Pradip is currently offline  Pradip
Messages: 109
Registered: February 2019
Location: India
Experienced Member
Hello Didier,

GraphCtrl's sheer brilliance amazes me indeed! I could do all these without much difficulty:
  • Learned to use Chameleon, bit tricky though, need to dig through a lot of typedefs
  • Dynamic grid; virtually anything can be done with the grids with your framework! uploaded few screenshots
  • Sync scroll with another ctrl, by using SetGraphMin and SetGraphMax; noted that Link syncs with another CoordinateConverter

2 questions:
  1. How to alter the default margin of 3 px? The following line doesn't work:
    // gantt.SetTopMargin(1).SetLeftMargin(1).SetBottomMargin(1).Se tRightMargin(1);
    some text seems to spill into the margin, see in one of the uploaded images
  2. What can be done with CustomDataSource::PaintOne? How does style work?

I must say again, thanks a lot for GraphCtrl! It makes life so easy!
  • Attachment: Images.rar
    (Size: 281.89KB, Downloaded 317 times)


Regards,
Pradip

[Updated on: Sun, 21 June 2020 12:57]

Report message to a moderator

Re: GraphDraw/GraphCtrl [message #54288 is a reply to message #54239] Sun, 21 June 2020 12:53 Go to previous messageGo to next message
Pradip is currently offline  Pradip
Messages: 109
Registered: February 2019
Location: India
Experienced Member
Didier wrote on Sun, 14 June 2020 03:19

I have to find an elegant way to mix both (I have some ideas but didn't start coding yet)

I'm sure you will find a way!


Regards,
Pradip
Re: GraphDraw/GraphCtrl [message #54289 is a reply to message #54288] Sun, 21 June 2020 16:22 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 3458
Registered: August 2008
Senior Veteran
Quote:
uploaded few screenshots
They look great.


Best regards
IƱaki
Re: GraphDraw/GraphCtrl [message #54290 is a reply to message #54289] Sun, 21 June 2020 16:59 Go to previous messageGo to next message
Pradip is currently offline  Pradip
Messages: 109
Registered: February 2019
Location: India
Experienced Member
koldo wrote on Sun, 21 June 2020 19:52
They look great.

Thanks Koldo. Didier's work pays off.


Regards,
Pradip
Re: GraphDraw/GraphCtrl [message #54296 is a reply to message #54290] Mon, 22 June 2020 00:28 Go to previous messageGo to next message
Didier is currently offline  Didier
Messages: 740
Registered: November 2008
Location: France
Contributor
Hello Pradip,

I see you're are making good progress on you're app : looking good Thumbs Up
I suppose you used two CustomDataSource classes in you're Gantt:
- one for the jobs
- one for the links ?


I have made some cleaning up and plugged back-in all the SetXxxx methods (colors, fonts, ...) so the layout designer is parameters are working again
I mixed Chameleon and Layout params the following way:
- At crƩation Chameleon is used in standard way and stays unmodified until a SetXxxx() method is called
- After modifying a parameter with SetXxxx() the a local copy of the style is made and the copy is modified
==> so you get Chameleon settings + local settings together Smile
There still is a bug : a small heap leak is there (the delete of local copy makes the app crash and I didn't find why for the moment)

I also did some more cleaning and did some methods renaming:
- All the GetXxxx GraphElement() are now named GetElementXxxxx()
- All the SetXTttt() are now named SetX1Ttttt() (so that the you have X1, X2, Y1, Y2, ... (and not X, X1 which was not homogenous)
X (not X1 or X2) now applies only to methods that apply to all X1, X2, ....
Its clearer this way

One good side effect of all this (I was hopping this would come around sooner or latter) : Completion works fine now on GraphCtrl Smile Smile Smile

Re: GraphDraw/GraphCtrl [message #54297 is a reply to message #54296] Mon, 22 June 2020 00:41 Go to previous messageGo to next message
Didier is currently offline  Didier
Messages: 740
Registered: November 2008
Location: France
Contributor
Quote:
How to alter the default margin of 3 px? The following line doesn't work:
// gantt.SetTopMargin(1).SetLeftMargin(1).SetBottomMargin(1).Se tRightMargin(1);
some text seems to spill into the margin, see in one of the uploaded images

This works (at least when modifying it thriugh the layout designer) : maybe a Refresh() is missing somewhere
Normaly the updateSizes() method recalculates all the internal sizes taking into account the margins but it is for internal use and is called by Refresh()
Question : When you resize you're app, all is recalculated so the new margin values should be taken into account : does this work for you ?

Quote:
What can be done with CustomDataSource::PaintOne? How does style work?

This work in progress, it is mearly at start point : I intend to use it to enable things like selection (draw the point with a different style : highlight for example)

[Updated on: Mon, 22 June 2020 00:44]

Report message to a moderator

Re: GraphDraw/GraphCtrl [message #54298 is a reply to message #54296] Mon, 22 June 2020 09:52 Go to previous messageGo to next message
Pradip is currently offline  Pradip
Messages: 109
Registered: February 2019
Location: India
Experienced Member
Hello Didier,

Downloaded the last one and got trouble, really don't know how to fix this. GanttCtrl constructor is leading to this, please help.

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


Regards,
Pradip

[Updated on: Tue, 23 June 2020 06:48]

Report message to a moderator

Re: GraphDraw/GraphCtrl [message #54299 is a reply to message #54298] Mon, 22 June 2020 10:35 Go to previous messageGo to next message
Pradip is currently offline  Pradip
Messages: 109
Registered: February 2019
Location: India
Experienced Member
Hello Didier,

I reverted to the version sent by you on 07-Jun, that's still working fine. I'll try to figure out what went wrong with the latest one.


Regards,
Pradip
Re: GraphDraw/GraphCtrl [message #54300 is a reply to message #54298] Mon, 22 June 2020 12:54 Go to previous messageGo to next message
Pradip is currently offline  Pradip
Messages: 109
Registered: February 2019
Location: India
Experienced Member
Hello Didier,

Sorry I panicked a bit. I missed to add the GD_ macros in GanttCtrl declaration, after adding them that error is gone. Also I needed to change the first line in the macro to make it run:

CH_STYLE(GanttCtrl, Style, StyleDefault) {
	gdStyle        = GanttCtrl::CH_EmptyGraphDraw::StyleGDDefault();


Plus I made other method name changes as described by you in your message.

However, the result is this:
index.php?t=getfile&id=6126&private=0

Both axes are inverted; custom grids are not drawn as before, and a floating element has appeared.
I'll continue with the previous version and wait for you have a look at these and advise.


Regards,
Pradip

[Updated on: Tue, 23 June 2020 07:26]

Report message to a moderator

Re: GraphDraw/GraphCtrl [message #54301 is a reply to message #54298] Mon, 22 June 2020 13:22 Go to previous messageGo to next message
Didier is currently offline  Didier
Messages: 740
Registered: November 2008
Location: France
Contributor
Hello Pradip,
This is either upp version that needs update or a memory corruption du to my latest modifications...
If it doesn't disapear with an upp update, don't bother, it's probably the same problem I'm tracking with my delete bug.

Sorry for this I published it to soon
Re: GraphDraw/GraphCtrl [message #54302 is a reply to message #54296] Mon, 22 June 2020 14:01 Go to previous messageGo to next message
Pradip is currently offline  Pradip
Messages: 109
Registered: February 2019
Location: India
Experienced Member
Hello Didier,

Didier wrote on Mon, 22 June 2020 03:58

I suppose you used two CustomDataSource classes in you're Gantt:

Exactly, I have used two CustomDataSource classes, so that the links (now made arrows) are drawn first, then the activity bars.

Didier wrote on Mon, 22 June 2020 03:58

One good side effect of all this (I was hopping this would come around sooner or latter) : Completion works fine now on GraphCtrl Smile Smile Smile

Definitely it does, and be rest assured that I'll find enough usage of GraphCtrl in future so I guess it will be validated thoroughly Laughing


Regards,
Pradip
Re: GraphDraw/GraphCtrl [message #54304 is a reply to message #54297] Mon, 22 June 2020 14:28 Go to previous messageGo to next message
Pradip is currently offline  Pradip
Messages: 109
Registered: February 2019
Location: India
Experienced Member
Hello Didier,

Didier wrote on Mon, 22 June 2020 04:11

This works (at least when modifying it thriugh the layout designer) : maybe a Refresh() is missing somewhere
Normaly the updateSizes() method recalculates all the internal sizes taking into account the margins but it is for internal use and is called by Refresh()
Question : When you resize you're app, all is recalculated so the new margin values should be taken into account : does this work for you ?

No this is not working, see the image, even after resizing, the margins are 3px. This line is in the constructor of that TopWindow.
	gantt.SetTopMargin(1).SetLeftMargin(1).SetBottomMargin(1).SetRightMargin(1);

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

Didier wrote on Mon, 22 June 2020 04:11

This work in progress, it is mearly at start point : I intend to use it to enable things like selection (draw the point with a different style : highlight for example)

Good god! Are you reading my mind? lol! I want exactly that to happen when the selection in tree/array changes! so thoughtful Very Happy


Regards,
Pradip
Re: GraphDraw/GraphCtrl [message #54305 is a reply to message #54301] Mon, 22 June 2020 14:35 Go to previous messageGo to next message
Pradip is currently offline  Pradip
Messages: 109
Registered: February 2019
Location: India
Experienced Member
Hello Didier,

Didier wrote on Mon, 22 June 2020 16:52
Hello Pradip,
This is either upp version that needs update or a memory corruption du to my latest modifications...
If it doesn't disapear with an upp update, don't bother, it's probably the same problem I'm tracking with my delete bug.

Sorry for this I published it to soon


It's just fine, I'm going ahead with the previous package you gave, that is working fine. I still can't run 14429 thanks to McAfee, we'll see if we can make it work in future. Right now it's good, just need to find out how to adjust the margins.


Regards,
Pradip
Re: GraphDraw/GraphCtrl [message #54307 is a reply to message #54300] Mon, 22 June 2020 15:56 Go to previous messageGo to next message
Didier is currently offline  Didier
Messages: 740
Registered: November 2008
Location: France
Contributor
The floating element is the Legend, I also updated a bit the default chameleon style (the floating style was missing)
So the float element was there before, it just wasn visible.
Just add:
graph.HideLegend();


For the rest, I have no idea. I will check tonight
Re: GraphDraw/GraphCtrl [message #54315 is a reply to message #54305] Mon, 22 June 2020 20:52 Go to previous messageGo to next message
Didier is currently offline  Didier
Messages: 740
Registered: November 2008
Location: France
Contributor
Pradip,

Quote:
just need to find out how to adjust the margins

I found what is wrong : at L21 of GraphDraw/StdGraphElements.h
	class BlankAreaElement : public GraphElement
	{
	public:
		typedef BlankAreaElement CLASSNAME;
		typedef GraphElement _B;

		BlankAreaElement() {}
		
		virtual ~BlankAreaElement() {}
		virtual void PaintElement(Draw& dw, int scale) { /* do noting */}
		virtual void SetElementWidth(int v) { _width = Upp::max(v, 3); }       // --- REMOVE THIS lINE ---

	private:
		BlankAreaElement( BlankAreaElement& p)  {}
	};


I have no idea why this was here and it is useless ( just checked, it's been around for years 6.5 years LOL ), I am removing it from the code base

For the rest, if you send me the code of you're GanttCtrl (and only that) it would be easier

[Updated on: Mon, 22 June 2020 22:43]

Report message to a moderator

Re: GraphDraw/GraphCtrl [message #54320 is a reply to message #54307] Tue, 23 June 2020 07:29 Go to previous messageGo to next message
Pradip is currently offline  Pradip
Messages: 109
Registered: February 2019
Location: India
Experienced Member
Didier wrote on Mon, 22 June 2020 19:26

For the rest, I have no idea. I will check tonight

Fine, I'll continue with the previous one until you are done.


Regards,
Pradip

[Updated on: Tue, 23 June 2020 09:24]

Report message to a moderator

Re: GraphDraw/GraphCtrl [message #54322 is a reply to message #54315] Tue, 23 June 2020 09:22 Go to previous messageGo to next message
Pradip is currently offline  Pradip
Messages: 109
Registered: February 2019
Location: India
Experienced Member
Didier wrote on Tue, 23 June 2020 00:22

I have no idea why this was here and it is useless ( just checked, it's been around for years 6.5 years LOL ), I am removing it from the code base

Ah that works, too wasy LOL! And somewhere in your code I've even seen a date in 2012! Codes never age isn't it, they are evergreen Very Happy

Quote:

For the rest, if you send me the code of you're GanttCtrl (and only that) it would be easier

Uploading my code. I have CustomData and CustomDataSource in the same file. You will see there are some dependencies.
bool IsHoliday(Date) 

this determines if that date is holiday or not (2nd or 4th Sat and Sun and declared holidays). you may plan to replace this with a callback maybe.
Other dependencies I'll explain if you need.

One suggestion:
CustomData::Intersects and CustomData::Contains deal with bounding box of the data point. In some situations the bounding box depends on screen coordinates, please consider this.


Regards,
Pradip

[Updated on: Tue, 23 June 2020 09:25]

Report message to a moderator

Re: GraphDraw/GraphCtrl [message #54326 is a reply to message #54322] Tue, 23 June 2020 14:27 Go to previous messageGo to next message
Pradip is currently offline  Pradip
Messages: 109
Registered: February 2019
Location: India
Experienced Member
Pradip wrote on Tue, 23 June 2020 12:52
One suggestion:
CustomData::Intersects and CustomData::Contains deal with bounding box of the data point. In some situations the bounding box depends on screen coordinates, please consider this.

Didier,
This is really needed, please consider Intersects() and Contains() to have knowledge of CoordinateConverter objects


Regards,
Pradip
Re: GraphDraw/GraphCtrl [message #54334 is a reply to message #54326] Thu, 25 June 2020 00:10 Go to previous messageGo to next message
Didier is currently offline  Didier
Messages: 740
Registered: November 2008
Location: France
Contributor
Hello Pradip,

I did a quick check on you're code, and after only renaming what needed to be renamed and commented the code for which I didn't have the data types, all compiled and works fine:
grid and axis are draw as you wan't and only Y axis is inverted.
I uploaded the modyfied code
So maybe it's the app code that modifys the configuration ?

Quote:
One suggestion:
CustomData::Intersects and CustomData::Contains deal with bounding box of the data point. In some situations the bounding box depends on screen coordinates, please consider this.

In fact this was done on purpose: to avoid manipulating Graph and Screen coordinates.
At first I used screen coordinates in API but it revealed to be un-adapted and error prone du to all the clipping and/or offsets applied

EDIT : file removed (newer dowload available)

[Updated on: Sat, 11 July 2020 23:33]

Report message to a moderator

Re: GraphDraw/GraphCtrl [message #54336 is a reply to message #54334] Thu, 25 June 2020 10:37 Go to previous messageGo to next message
Pradip is currently offline  Pradip
Messages: 109
Registered: February 2019
Location: India
Experienced Member
Didier wrote on Thu, 25 June 2020 03:40

I did a quick check on you're code, and after only renaming what needed to be renamed and commented the code for which I didn't have the data types, all compiled and works fine:
grid and axis are draw as you wan't and only Y axis is inverted.
I uploaded the modyfied code
So maybe it's the app code that modifys the configuration ?

Didier:
Sorry I screwed up in panic mode! Now it's all working fine with the new code base. I think I know what went wrong, I didn't clean either GraphDraw or my app package, so maybe old object file was linking with new and... Embarassed


Regards,
Pradip
Re: GraphDraw/GraphCtrl [message #54346 is a reply to message #54336] Mon, 29 June 2020 11:34 Go to previous messageGo to next message
Pradip is currently offline  Pradip
Messages: 109
Registered: February 2019
Location: India
Experienced Member
Hello Didier,

Another suggestion:
Right now the zoom seems to happens with respect to the center of graph, of course subject to MinRangeLimit and MaxRangeLimit. It would be just great if instead of center of graph it would have been the mouse position!


Regards,
Pradip
Re: GraphDraw/GraphCtrl [message #54347 is a reply to message #54346] Mon, 29 June 2020 12:25 Go to previous messageGo to next message
Didier is currently offline  Didier
Messages: 740
Registered: November 2008
Location: France
Contributor
Hello Pradip,

Yes I agree with you, center the zooming on mouse cursor would be much better, I will see what I can do

Re: GraphDraw/GraphCtrl [message #54394 is a reply to message #54347] Sat, 11 July 2020 23:31 Go to previous messageGo to next message
Didier is currently offline  Didier
Messages: 740
Registered: November 2008
Location: France
Contributor
Hello Pradip,

I just uploaded the latest version of the code.
The feature you requested is now the default behaviour Smile (although original behaviour can stil be set by using SetZoomOnCursor(false) )

It took me some time because I had to finish plugging back in Properties Editors and be compatible with Chameleon) and I did some more cleaning up.

Noticable changes:
* Properties dialog accessible in plot area now displays one Properties dialog containing all the dialogs in tabs (it can be fully customized)
* Properties values can now be changed and are comptible with Chameleon Smile
* some renaming has been done
* some cleaning has been done
GraphDraw_CRTP has been deleted and an uneeded inheritance level has been removed
Take a look at GD_XYLTMM_GraphCtrl : it now contains a good example to build a fully custom GraphCtrl

You should get 2 small compilation issues:
* all GraphElements StyleXxxx renamed to StyleGEXxxx example: StyleXAxisDefault() ==> StyleGEXAxisDefault()
* all X_ or Y_ in Types renamed to X1_ and Y1_ example X_TypeCoordConverter ==> X1_TypeCoordConverter
Look at the GanttCtrl package : I made the corrections needed


These renamings aim to suppress ambiguities to make code more readable.

I think most of the renaming/cleaning should be finished now, all this started when I pushed Chameleon in and I wanted to have a better code base

Note: Properties dialogs are quite ugly and not finished : next step is to try to do better Wink

BTW : you're GridAxis works fine, looks great and it will be a great addition. If you enhance it please post it back so we can all benefit



[Updated on: Sat, 11 July 2020 23:36]

Report message to a moderator

Re: GraphDraw/GraphCtrl [message #54395 is a reply to message #54394] Sun, 12 July 2020 08:06 Go to previous messageGo to next message
Pradip is currently offline  Pradip
Messages: 109
Registered: February 2019
Location: India
Experienced Member
That's just great Didier, I'm downloading the package, I'll check it.

Of course, I'll upload my version of the GridAxis, you may need to do some alteration to include it in the base.


Regards,
Pradip
Re: GraphDraw/GraphCtrl [message #54396 is a reply to message #54395] Sun, 12 July 2020 10:26 Go to previous messageGo to next message
Pradip is currently offline  Pradip
Messages: 109
Registered: February 2019
Location: India
Experienced Member
Hello Didier,

I'm getting 1 warning and a few errors in Upp 13664 and MSVS17 compiler. What am I missing?

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


Regards,
Pradip
Re: GraphDraw/GraphCtrl [message #54397 is a reply to message #54396] Sun, 12 July 2020 11:57 Go to previous messageGo to next message
Didier is currently offline  Didier
Messages: 740
Registered: November 2008
Location: France
Contributor
Oh crap !!! : The 'Hash_t' type only exists in recent versions of Upp ... you're version is to old
Just replace it with the type returned by memhash()
Re: GraphDraw/GraphCtrl [message #54398 is a reply to message #54397] Sun, 12 July 2020 12:11 Go to previous messageGo to previous message
Didier is currently offline  Didier
Messages: 740
Registered: November 2008
Location: France
Contributor
After checking, memhash() was introduced with hash_t ... so you don't have it (you need at least svn 14534)

Here is the current default code (svn 14673) which should work for you (until you can update to latest version Smile )

hash_t memhash(const void *ptr, size_t count)
{
	unsigned hash = 1234567890U;

	const byte *s = (byte *)ptr;
	const byte *e = s + count;
	while(s < e)
		hash = ((hash << 5) - hash) ^ *s++;

	return hash;
}

[Updated on: Sun, 12 July 2020 12:12]

Report message to a moderator

Previous Topic: Anboto/Surface updated
Next Topic: STEM4U Updates
Goto Forum:
  


Current Time: Wed Apr 29 11:33:54 GMT+2 2026

Total time taken to generate the page: 0.01599 seconds