Hi,
I am using the DrawLine tool to draw lines and parallelograms on the chart. I found a bug where selecting the lines seems to change the angle or move the line by a fraction of pixel. This is causing me problems as I cannot delete parallelograms because I cannot identify the lines anymore.
I calculate and set the start and end coordinates of each line when drawing a parallelogram. When I select a side of the parallelogram and try to find/calculate the adjacent sides of the line I cannot find them because the line has moved and the co-ordinates no longer coincide.
Is there any way to work around this problem?
I am using the version 7.0.0.4 of TeeChart Ax.
Thanks.
Drawing and deleting lines
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi castlerigg,
Could you please send us an example we can run "as-is" to reproduce the problem here? You can post it at [url]news://www.steema.net/steema.public.attachments[/url] newsgroup.
Could you please send us an example we can run "as-is" to reproduce the problem here? You can post it at [url]news://www.steema.net/steema.public.attachments[/url] newsgroup.
Please notice that this is not possible as pixels are integer values.I found a bug where selecting the lines seems to change the angle or move the line by a fraction of pixel.
Best Regards,
Narcís Calvet / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |
-
- Newbie
- Posts: 5
- Joined: Mon Jan 10, 2005 5:00 am
I can't seem to post to the newsgroup as suggested. I get an error saying No sender was specified (even after I subscriber to the group).
This is the code to draw a parallelogram from a newly drawn line on the chart (i'm assuming the chart already has some series data):
Private Sub cht_OnDrawLineToolNewLine()
Dim LineTool As IDrawLineTool
Dim line As IDrawLine
Set LineTool = cht.Tools.Items(0).asDrawLine
LineTool.Selected = LineTool.Lines.Count - 1
On Error Resume Next
Set line = LineTool.Lines(LineTool.Lines.Count - 1)
On Error GoTo 0
If line Is Nothing Then
Beep
Exit Sub
End If
' calculate the length and position of other 3 sides
nLenX = 2 * (line.EndPos.X - line.StartPos.X)
nLenY = (line.EndPos.Y - line.StartPos.Y) / 2
LineTool.AddLine line.EndPos.X, _
line.EndPos.Y, _
line.EndPos.X + nLenX, _
line.EndPos.Y + nLenY
LineTool.AddLine line.EndPos.X + nLenX, _
line.EndPos.Y + nLenY, _
line.StartPos.X + nLenX, _
line.StartPos.Y + nLenY
LineTool.AddLine line.StartPos.X + nLenX, _
line.StartPos.Y + nLenY, _
line.StartPos.X, _
line.StartPos.Y
End Sub
Now select any side of the parallelogram and zoom in to the corners of the line selected. You will see that either the start position or end position would have moved, making the parallelogram no longer connected.
Please let me know if you need any more information.
I'm not sure if the X, Y positions are in pixels... they seem to take floating point values.
Thanks,
Tanya
This is the code to draw a parallelogram from a newly drawn line on the chart (i'm assuming the chart already has some series data):
Private Sub cht_OnDrawLineToolNewLine()
Dim LineTool As IDrawLineTool
Dim line As IDrawLine
Set LineTool = cht.Tools.Items(0).asDrawLine
LineTool.Selected = LineTool.Lines.Count - 1
On Error Resume Next
Set line = LineTool.Lines(LineTool.Lines.Count - 1)
On Error GoTo 0
If line Is Nothing Then
Beep
Exit Sub
End If
' calculate the length and position of other 3 sides
nLenX = 2 * (line.EndPos.X - line.StartPos.X)
nLenY = (line.EndPos.Y - line.StartPos.Y) / 2
LineTool.AddLine line.EndPos.X, _
line.EndPos.Y, _
line.EndPos.X + nLenX, _
line.EndPos.Y + nLenY
LineTool.AddLine line.EndPos.X + nLenX, _
line.EndPos.Y + nLenY, _
line.StartPos.X + nLenX, _
line.StartPos.Y + nLenY
LineTool.AddLine line.StartPos.X + nLenX, _
line.StartPos.Y + nLenY, _
line.StartPos.X, _
line.StartPos.Y
End Sub
Now select any side of the parallelogram and zoom in to the corners of the line selected. You will see that either the start position or end position would have moved, making the parallelogram no longer connected.
Please let me know if you need any more information.
I'm not sure if the X, Y positions are in pixels... they seem to take floating point values.
Thanks,
Tanya
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Tanya,
Thanks for your code snippet.
Which TeeChart version are you using? I'm using latest release available at our customer download area which is v7.0.0.4
Thanks for your code snippet.
You may not have set your user e-mail address. That's strange, you shouldn't have problems as settings are the default ones. Server is http://www.steema.net, no login information is required and NNTP port number is 119.I can't seem to post to the newsgroup as suggested. I get an error saying No sender was specified (even after I subscriber to the group).
I'm not able to reproduce it here. It seems to work fine.Now select any side of the parallelogram and zoom in to the corners of the line selected. You will see that either the start position or end position would have moved, making the parallelogram no longer connected.
Please let me know if you need any more information.
Which TeeChart version are you using? I'm using latest release available at our customer download area which is v7.0.0.4
Screen positions are in pixels and are integer values while series values take floating point values. Then you should convert from series values to screen positions and viceversa.I'm not sure if the X, Y positions are in pixels... they seem to take floating point values.
Best Regards,
Narcís Calvet / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |
-
- Newbie
- Posts: 5
- Joined: Mon Jan 10, 2005 5:00 am
Hi Narcis,
I'm also using the latest version of Teecharts v7.0.0.4. I find it very suprising that you can't reproduce it because I can very easily reproduce it here. Did the code work as far as drawing the parallelogram?
I wonder if there is any way of sending you a small project with the problem example.
Can you send me a snippet of code to add a line to the chart by converting the series values to screen positions?
Thanks for all your help,
Tanya
I'm also using the latest version of Teecharts v7.0.0.4. I find it very suprising that you can't reproduce it because I can very easily reproduce it here. Did the code work as far as drawing the parallelogram?
I wonder if there is any way of sending you a small project with the problem example.
That seems to make sense. But when i'm debugging through the code and I have the IDrawLine in my watch window, the X, Y positions display floating point values. Is that referring to the series values instead of screen positions?Screen positions are in pixels and are integer values while series values take floating point values. Then you should convert from series values to screen positions and viceversa.
Can you send me a snippet of code to add a line to the chart by converting the series values to screen positions?
Thanks for all your help,
Tanya
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Tanya,
Yes, you could post to the newsgroups as I suggested you previously but if you are experiencing problems with them please send it directly to me.I'm also using the latest version of Teecharts v7.0.0.4. I find it very suprising that you can't reproduce it because I can very easily reproduce it here. Did the code work as far as drawing the parallelogram?
Yes, it works.
I wonder if there is any way of sending you a small project with the problem example.
Yes, it can be.That seems to make sense. But when i'm debugging through the code and I have the IDrawLine in my watch window, the X, Y positions display floating point values. Is that referring to the series values instead of screen positions?
Yes, the code below does that. It's Delphi code but can easily ported to VB.Can you send me a snippet of code to add a line to the chart by converting the series values to screen positions?
Code: Select all
procedure TForm1.Chart1AfterDraw(Sender: TObject);
var
IntersectIndex: Integer;
x0, y0, x1, y1: double;
begin
IntersectIndex:=10;
x0:=Series1.DateValues.Items[IntersectIndex];
y0:=Series1.HighValues.Items[IntersectIndex];
x1:=Series2.CalcXPos(IntersectIndex);
y1:=Series2.CalcYPos(IntersectIndex);
TDrawLine.CreateXY(ChartTool1.Lines, x0, y0, x1, y1);
ChartTool1.EnableDraw:=false;
end;
Last edited by Narcís on Wed Oct 04, 2006 11:36 am, edited 1 time in total.
Best Regards,
Narcís Calvet / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |
-
- Newbie
- Posts: 5
- Joined: Mon Jan 10, 2005 5:00 am
Hi Narcis,
I forgot to mention that my Series is a Line series. So the code you sent is not that helpful. However, i've realized that i'm drawing the parallelogram correctly. Now if only I can disable the line from moving when I select it, then I am able to delete the entire parallelogram.
Thanks,
Tanya
I have sent you the test project.Yes, you could post to the newsgroups as I suggested you previously but if you are experiencing problems with them please send it to me.
I forgot to mention that my Series is a Line series. So the code you sent is not that helpful. However, i've realized that i'm drawing the parallelogram correctly. Now if only I can disable the line from moving when I select it, then I am able to delete the entire parallelogram.
Thanks,
Tanya
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Tanya,
Thank you very much for your example. I've been able to reproduce this problem here.
By now I can't think of a workaround. It seems not being easy to solve. I've added it to our deffect list to be fixed for our future releases.
Thank you very much for your example. I've been able to reproduce this problem here.
By now I can't think of a workaround. It seems not being easy to solve. I've added it to our deffect list to be fixed for our future releases.
Best Regards,
Narcís Calvet / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |