Quinn-Curtis Forums
Quinn-Curtis Forums
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Tools for Microsoft .Net
 Real-Time Graphics Tools for .Net (VB and C#)
 Need help on coordinate transformation
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

soundar

51 Posts

Posted - 17 Nov 2008 :  19:28:23  Show Profile  Reply with Quote
I want to draw a circle on a x-y graph using RTGenshape. the circle should always be centered at a specific (x,y) location in the graph, say (-10,20) even as the xaxis min,max and yaxis min-max change. (We can assume that (-10,20) is always within the current plot area). In addition, the circle should always be of a fixed diameter specified in device coordinates say, always 3 mm (or always 10 pixels), regardless of the plot scaling.

How can I achieve this?

quinncurtis

1586 Posts

Posted - 18 Nov 2008 :  13:50:28  Show Profile  Reply with Quote
It's easiest to use the ChartSymbol class, which already has a CIRCLE type defined. The SymbolSize is specified in pixels, the location in the current plot scale.

ChartAttribute attrib4 = new ChartAttribute(Color.Red, 1, DashStyle.Solid);
attrib4.SymbolSize = 64;
ChartSymbol circle = new ChartSymbol(pTransform1, ChartObj.CIRCLE, attrib4);
circle.SetLocation(-10, 20);
chartVu.AddChartObject(circle);
Go to Top of Page

soundar

51 Posts

Posted - 21 Nov 2008 :  17:34:43  Show Profile  Reply with Quote
This may not solve my problem. If I understand it correctly, the chart symbol SetLocation refers to the top,left corner of the enclosing rectangle. If I want the circle to be CENTERED at -10,20, and I want the circle to be say 12 pixels radius, then I want the top left corner at

x = -10 - (12 * plotUnits/pixel)
y = 20 - (12 * plotUnits/pixel)

How do I get transform 1 plot unit to equivalent pixel units?

Thanks

Go to Top of Page

quinncurtis

1586 Posts

Posted - 22 Nov 2008 :  10:38:59  Show Profile  Reply with Quote
You are creating problem where they don't exist. The ChartSymbol symbols are centered on the specified location. Run the code fragment we posted and you will see this.


Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
Quinn-Curtis Forums © 2000-2018 Quinn-Curtis, Inc. Go To Top Of Page
Powered By: Snitz Forums 2000 Version 3.4.07