[very urgent] How to draw many squares?
[very urgent] How to draw many squares?
I have the upper-left and lower-right coordinates of over 100 squares. What kind of series or tools should I use to draw them so that only squares are drawn and no connection lines between any two of the squares? Any sample code would be greatly appreciated.
Thanks in advance!
Thanks in advance!
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Re: [very urgent] How to draw many squares?
Hi David,
I recommend you to use Shape series for that. You'll find examples with source code at "All Features\Welcome!\Chart Styles\Standard\Shape" in the features demo, available at TeeChart's program group.
BTW: If you are interested in priority support service you may be interested in our Pro-Support program.
I recommend you to use Shape series for that. You'll find examples with source code at "All Features\Welcome!\Chart Styles\Standard\Shape" in the features demo, available at TeeChart's program group.
BTW: If you are interested in priority support service you may be interested in our Pro-Support program.
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 |
Re: [very urgent] How to draw many squares?
Thanks for the suggestion. If using shape series, do I have to add one series for each of the square? The vertical text align example uses 3 series for three shapes. If so, it will be more than 100 series in my application, will it cause any problem like slow response?
And I would appreciate it if you could provide some samle c++ code about how to use shape series like how to set coordinate, how to set shape style, etc.
Thanks.
And I would appreciate it if you could provide some samle c++ code about how to use shape series like how to set coordinate, how to set shape style, etc.
Thanks.
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Re: [very urgent] How to draw many squares?
Hi David,
The alternative to using Shape series would be custom drawing on TeeChart's canvas. You'll find VC++ examples in tutorial 15. Tutorials are available at TeeChart's program group.
Yes.Thanks for the suggestion. If using shape series, do I have to add one series for each of the square?
I'm not sure. Most likely this will depend on machine's power. Some general advice on how to optimise TeeChart's performance can be found at the Real-time Charting article here. This is a TeeChart VCL article but most of it also applies to ActiveX version. I recommend you to apply as many hints there as possible.The vertical text align example uses 3 series for three shapes. If so, it will be more than 100 series in my application, will it cause any problem like slow response?
The alternative to using Shape series would be custom drawing on TeeChart's canvas. You'll find VC++ examples in tutorial 15. Tutorials are available at TeeChart's program group.
Sure, here it is:And I would appreciate it if you could provide some samle c++ code about how to use shape series like how to set coordinate, how to set shape style, etc.
Code: Select all
m_Chart1.AddSeries(scShape);
m_Chart1.Series(0).GetAsShape().SetStyle(chasRectangle);
m_Chart1.Series(0).GetAsShape().SetX0(100);
m_Chart1.Series(0).GetAsShape().SetY0(100);
m_Chart1.Series(0).GetAsShape().SetX1(300);
m_Chart1.Series(0).GetAsShape().SetY1(200);
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 |
Re: [very urgent] How to draw many squares?
Thanks for your quick response. What are x0 y0 x1 y1 for if the shape is circle or oval?
The tutorial 15 is Tutorial 15 - MS VC++ Applications, but there is no introduction about shape series.
The tutorial 15 is Tutorial 15 - MS VC++ Applications, but there is no introduction about shape series.
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Re: [very urgent] How to draw many squares?
Hi David,
They are for the bounding rectangle.Thanks for your quick response. What are x0 y0 x1 y1 for if the shape is circle or oval?
Other tutorials and demos are in Visual Basic 6. However, using them, the examples at C:\Program Files\Steema Software\TeeChart Pro v8 ActiveX Control\Examples\Visual C++\Version 6 and with the VC++ syntax summary in tutorial 15 you should be able to create your own VC++ applications.The tutorial 15 is Tutorial 15 - MS VC++ Applications, but there is no introduction about shape series.
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 |
Re: [very urgent] How to draw many squares?
I am drawing a circle for test, but after assigning x0,y0, x1,y1, it appreas to be an oval, although the x y values are correct. So how to maintain a proper scale so that circles won't appear to be ovals (especially when the dialog with tchart is resizing)? adding some code in OnAfterDraw?
Second question, how to avoid the default solid fill inside the shape? (solved with SetTransparent)
Second question, how to avoid the default solid fill inside the shape? (solved with SetTransparent)
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Re: [very urgent] How to draw many squares?
Hi David,
This can be achieved as shown in the All Features\Welcome!\Axes\Isometric Axis in the features demo.I am drawing a circle for test, but after assigning x0,y0, x1,y1, it appreas to be an oval, although the x y values are correct. So how to maintain a proper scale so that circles won't appear to be ovals (especially when the dialog with tchart is resizing)? adding some code in OnAfterDraw?
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 |
Re: [very urgent] How to draw many squares?
I followed the example and tested the code below, but still didn't work. Any suggestions?
Thanks.
Code: Select all
void CTestDlg::OnZoomTchart1()
{
SetIsometricAxis();
}
void CTestDlg::OnUndoZoomTchart1()
{
SetIsometricAxis();
}
void CTestDlg::SetIsometricAxis()
{
m_chart1.GetAxis().SetIsometric(aLeftAxis,aBottomAxis);
}
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Re: [very urgent] How to draw many squares?
Hi David,
You also have to implement the SetIsometricAxis method as in the demo.
You also have to implement the SetIsometricAxis method as in the demo.
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 |
Re: [very urgent] How to draw many squares?
I don't know VB, so am I doing right this way?
If no, please help me with the c++ code. If yes, then I got a funny problem with the code. The chart switch between isometric and non-isometric each time I unzoom it (actually the demo behaves the same). Any advice?
Code: Select all
void CEncoderEbeamDlg::SetIsometricAxis()
{
m_chart1.GetAxis().SetIsometric(m_chart1.GetAxis().GetLeft().GetIndex(),m_chart1.GetAxis().GetBottom().GetIndex());
}
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Re: [very urgent] How to draw many squares?
Hi David,
I'm sorry if I didn't explain myself correctly but what you have to implement is the MakeIsoAxis method:
I'm sorry if I didn't explain myself correctly but what you have to implement is the MakeIsoAxis method:
Code: Select all
Private Sub MakeIsoAxis()
With TChart1.Axis
.Left.Increment = CInt(Text3.Text)
.Bottom.Increment = CInt(Text2.Text)
.SetIsometric .Left.Index, .Bottom.Index
End With
End Sub
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 |
Re: [very urgent] How to draw many squares?
I know I have to implement the MakeIsoAxis, actually my SetIsometricAxis is it, only different name. I am just not sure if I have done corectly with C++.
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Re: [very urgent] How to draw many squares?
Hi David,
It should be implemented like this:
It should be implemented like this:
Code: Select all
m_Chart1.GetAxis().GetLeft().SetIncrement(50);
m_Chart1.GetAxis().GetBottom().SetIncrement(50);
m_Chart1.GetAxis().SetIsometric(m_Chart1.GetAxis().GetLeft().GetIndex(),
m_Chart1.GetAxis().GetBottom().GetIndex());
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 |
Re: [very urgent] How to draw many squares?
So here is what I did
Then, just like what I described just now, I got a funny problem with the code. The chart switch between isometric and non-isometric each time I unzoom it(actually the demo behaves the same). If I zoom it, it just can't become isometric. Would you please have a try of the demo and you will see what I mean. I just found another post complaining the same thing http://www.teechart.net/support/viewtop ... tric#p5675
I want to realize the isometric property no matther you zoom or unzoom it. Please advice how to do it.
Thanks a lot.
Code: Select all
m_chart1.GetAxis().GetLeft().SetMinMax(-maxx,maxx);
m_chart1.GetAxis().GetBottom().SetMinMax(-maxx,maxx);
void CTestDlg::OnZoomTchart1()
{
SetIsometricAxis();
}
void CTestDlg::OnUndoZoomTchart1()
{
SetIsometricAxis();
}
void CTestDlg::SetIsometricAxis()
{
m_chart1.GetAxis().GetLeft().SetIncrement(1);
m_chart1.GetAxis().GetBottom().SetIncrement(1);
m_chart1.GetAxis().SetIsometric(m_chart1.GetAxis().GetLeft().GetIndex(),m_chart1.GetAxis().GetBottom().GetIndex());
}
I want to realize the isometric property no matther you zoom or unzoom it. Please advice how to do it.
Thanks a lot.