Calculating size of a point
-
- Advanced
- Posts: 192
- Joined: Thu Feb 01, 2007 12:00 am
- Contact:
Calculating size of a point
I have a need to calculate the size of points in a Steema.TeeChart.Styles.Points series. I found that I can set the horizontal and verticle sizes and it will create an oval shaped point.
The points I am generating are evenly spaced. There is a horizontal spacing and a vertical spacing in the 2D chart that I am generating.
I want to calculate the horizontal and vertical sizes based on the following equation:
Width of point = ((width of chart)/(X max - X min)) * X increment
similarly with the vertical
Height of point = ((Height of chart)/(Y max - Y min)) * Y increment
I am setting Steema.TeeChart.Styles.Points.Pointer.HorizSize and Steema.TeeChart.Styles.Points.Pointer.VertSize
My questions are:
1. How do I get the Height and Width of the Chart in pixels?
2. Is there an event that is raised if the chart is zoomed? I will have to recalculate my point size if this occurs.
The points I am generating are evenly spaced. There is a horizontal spacing and a vertical spacing in the 2D chart that I am generating.
I want to calculate the horizontal and vertical sizes based on the following equation:
Width of point = ((width of chart)/(X max - X min)) * X increment
similarly with the vertical
Height of point = ((Height of chart)/(Y max - Y min)) * Y increment
I am setting Steema.TeeChart.Styles.Points.Pointer.HorizSize and Steema.TeeChart.Styles.Points.Pointer.VertSize
My questions are:
1. How do I get the Height and Width of the Chart in pixels?
2. Is there an event that is raised if the chart is zoomed? I will have to recalculate my point size if this occurs.
-
- Site Admin
- Posts: 1349
- Joined: Thu Jan 01, 1970 12:00 am
- Location: Riudellots de la Selva, Catalonia
- Contact:
Hello!
tChart1.Chart.ChartRect will give you the rectangle which is bounded by the chart axes (the area in which the series is painted) and tChart1.Chart.ChartBounds will give you the rectangle within which the entire chart is painted.1. How do I get the Height and Width of the Chart in pixels?
Yes, indeed, you can use the TChart.Zoomed event.2. Is there an event that is raised if the chart is zoomed? I will have to recalculate my point size if this occurs.
Thank you!
Christopher Ireland (Steema crew)
Please be aware of the newsgroup archives:
http://www.teechart.net/support/search.php
http://groups.google.com
http://codenewsfast.com/
Christopher Ireland (Steema crew)
Please be aware of the newsgroup archives:
http://www.teechart.net/support/search.php
http://groups.google.com
http://codenewsfast.com/
-
- Advanced
- Posts: 192
- Joined: Thu Feb 01, 2007 12:00 am
- Contact:
Difficulty getting correct values
Using the Zoomed event seems to work.
I need to recalculate the point sizes when the control is resized as well. Using the Resize event does not work for me, because while in the Resize event, the values in ChartRect are the old values before the resize. I need the sizes after it has resized.
Can you help me identify how to either get an event after the resize is complete, or find the new sizes while in the Resize event?
I need to recalculate the point sizes when the control is resized as well. Using the Resize event does not work for me, because while in the Resize event, the values in ChartRect are the old values before the resize. I need the sizes after it has resized.
Can you help me identify how to either get an event after the resize is complete, or find the new sizes while in the Resize event?
-
- Site Admin
- Posts: 1349
- Joined: Thu Jan 01, 1970 12:00 am
- Location: Riudellots de la Selva, Catalonia
- Contact:
Hello!
Have you tried moving your code into the TChart.BeforeDraw event?
Have you tried moving your code into the TChart.BeforeDraw event?
Thank you!
Christopher Ireland (Steema crew)
Please be aware of the newsgroup archives:
http://www.teechart.net/support/search.php
http://groups.google.com
http://codenewsfast.com/
Christopher Ireland (Steema crew)
Please be aware of the newsgroup archives:
http://www.teechart.net/support/search.php
http://groups.google.com
http://codenewsfast.com/
-
- Advanced
- Posts: 192
- Joined: Thu Feb 01, 2007 12:00 am
- Contact:
Using BeforeDrawSeries
I tried BeforeDrawSeries and that did not work for me. I overlooked the BeforeDraw event. That seems to address my needs.
Thanks.
Thanks.
-
- Advanced
- Posts: 192
- Joined: Thu Feb 01, 2007 12:00 am
- Contact:
troubles calculating accurate distance
In a simple example series of Steema.Styles.Points looks something like
0.0,1.0
2.0,1.0
4.0,1.0
6.0,1.0
8.0,1.0
10.0,1.0
When these points are shown in a chart the bottom axis goes from -0.8 to +10.8. The major tick marks are 2, 4, 6, 8, 10. When I do a quick watch on the Bottom axis, I can see the internal values being used and that is where I see the values -0.8 to +10.8.
I am trying to calculate programatically the width (and ultimately the height) of a point so that the edges of the point just touch.
I was doing the followng calculation
point width = (chart1.ChartRect.Width) * Increment / (XValues.Maximum - XValues.Minimum)
Where Increment = 2.0, which is the distance between my points along the Bottom Axis.
Using this calculation I am not getting the edges to touch. It seems to be significantly short. I am concerned that when I calculate my point width the the chart is autmatically adjusting the axis and this the value I get chart1.ChartRect.Width is not accurate for my calculations.
Do you have any suggestions?
0.0,1.0
2.0,1.0
4.0,1.0
6.0,1.0
8.0,1.0
10.0,1.0
When these points are shown in a chart the bottom axis goes from -0.8 to +10.8. The major tick marks are 2, 4, 6, 8, 10. When I do a quick watch on the Bottom axis, I can see the internal values being used and that is where I see the values -0.8 to +10.8.
I am trying to calculate programatically the width (and ultimately the height) of a point so that the edges of the point just touch.
I was doing the followng calculation
point width = (chart1.ChartRect.Width) * Increment / (XValues.Maximum - XValues.Minimum)
Where Increment = 2.0, which is the distance between my points along the Bottom Axis.
Using this calculation I am not getting the edges to touch. It seems to be significantly short. I am concerned that when I calculate my point width the the chart is autmatically adjusting the axis and this the value I get chart1.ChartRect.Width is not accurate for my calculations.
Do you have any suggestions?
-
- Advanced
- Posts: 192
- Joined: Thu Feb 01, 2007 12:00 am
- Contact:
Still waiting on a response
I never received a response to my previous question.
After further research it looks like I might be able to use the TChart Control's ability to autosize. I might have to calculate the sizing. I would like some feedback on my issues.
Thanks.
After further research it looks like I might be able to use the TChart Control's ability to autosize. I might have to calculate the sizing. I would like some feedback on my issues.
Thanks.
-
- Site Admin
- Posts: 1349
- Joined: Thu Jan 01, 1970 12:00 am
- Location: Riudellots de la Selva, Catalonia
- Contact:
Hello,
http://www.steema.net/upload/
Please let us know when you've posted something.
It would be greatly appreciated if you could upload a simple example which we can run "as-is" of the issues you have to:After further research it looks like I might be able to use the TChart Control's ability to autosize. I might have to calculate the sizing. I would like some feedback on my issues.
http://www.steema.net/upload/
Please let us know when you've posted something.
Thank you!
Christopher Ireland (Steema crew)
Please be aware of the newsgroup archives:
http://www.teechart.net/support/search.php
http://groups.google.com
http://codenewsfast.com/
Christopher Ireland (Steema crew)
Please be aware of the newsgroup archives:
http://www.teechart.net/support/search.php
http://groups.google.com
http://codenewsfast.com/
-
- Advanced
- Posts: 192
- Joined: Thu Feb 01, 2007 12:00 am
- Contact:
Sample project has been uploaded
When you run the sample project, notice that the point sizes will change. The goal is to make them large enough so the vertical and horizonal edges just touch. Sometimes they willl overlap, other times there will be gaps.
Any suggestions to my calculations are welcome.
Any suggestions to my calculations are welcome.
-
- Advanced
- Posts: 192
- Joined: Thu Feb 01, 2007 12:00 am
- Contact:
Did you receive my project?
I uploaded a VS2005.NET project a couple of days ago. Can you confirm that you received it and when I might expect a response?
Thanks
Thanks
-
- Site Admin
- Posts: 1349
- Joined: Thu Jan 01, 1970 12:00 am
- Location: Riudellots de la Selva, Catalonia
- Contact:
Hello!
As you can see here:
http://www.steema.com/support/public_hols2007.html
yesterday was a public holiday for us at Steema which may explain the slight delay. We'll get back to you as soon as we have something for you!
As you can see here:
http://www.steema.com/support/public_hols2007.html
yesterday was a public holiday for us at Steema which may explain the slight delay. We'll get back to you as soon as we have something for you!
Thank you!
Christopher Ireland (Steema crew)
Please be aware of the newsgroup archives:
http://www.teechart.net/support/search.php
http://groups.google.com
http://codenewsfast.com/
Christopher Ireland (Steema crew)
Please be aware of the newsgroup archives:
http://www.teechart.net/support/search.php
http://groups.google.com
http://codenewsfast.com/