TeeChart for ActiveX, COM and ASP
-
wuhu_software
- Newbie

- Posts: 7
- Joined: Mon Oct 19, 2009 12:00 am
Post
by wuhu_software » Sat Oct 09, 2010 10:12 pm
I am trying to create a circular gauge that has an origin of 0 at the top of the gauge and has 360 degrees. I am trying to simulate compass dial with 0 at the top in the North position.
Under the series Format/Options, if I set the Rotation value to 0, and the Total Angle to 360, I have something close to what I want but the origin of 0 is at the bottom of the gauge rather than at the top:
If I try to enter a rotation value of 180 to put 0 at the top of the gauge, all is well except the axis labels walk outside of the gauge:
Is there some way to "flip" the origin of the scale so that I can enter an origin of 0 and create what I need?
Thank you in advance.
-
Yeray
- Site Admin

- Posts: 9645
- Joined: Tue Dec 05, 2006 12:00 am
- Location: Girona, Catalonia
-
Contact:
Post
by Yeray » Mon Oct 11, 2010 9:54 am
Hi wuhu_software,
I could reproduce it and added it to the defect list to be fixed in future releases (TV52015197).
-
wuhu_software
- Newbie

- Posts: 7
- Joined: Mon Oct 19, 2009 12:00 am
Post
by wuhu_software » Sat Dec 11, 2010 11:35 pm
I was looking to see if this issue had been addressed in v8 of the ActiveX controls but I do not see an update to v8 since 3-2010.
Have updates to v8 ceased since the release of 2010?
If not, is there a release schedule listed somewhere?
Thank you.
-
Yeray
- Site Admin

- Posts: 9645
- Joined: Tue Dec 05, 2006 12:00 am
- Location: Girona, Catalonia
-
Contact:
Post
by Yeray » Mon Dec 13, 2010 8:32 am
Hi wuhu_software,
I'm afraid the bug (TV52015197) hasn't been fixed yet. Note that it is a VCL bug so it should be notated in
VCL release notes.
When it will be fixed in VCL, it should work the same way in the next AX as it is a wrapper of the VCL version.
Since TeeChart AX v2010 is the actual version we don't have plans of continue publishing TeeChart v8 maintenance releases, unless special cases like a new critical bug find.
-
wuhu_software
- Newbie

- Posts: 7
- Joined: Mon Oct 19, 2009 12:00 am
Post
by wuhu_software » Mon Dec 13, 2010 12:37 pm
That is disappointing since this is a critical feature for me. The decision to buy Teechart over the competition was the support for circular gauges.
So I would be required to upgrade from v8, about $200-$300 to get a fix for this?
-
Yeray
- Site Admin

- Posts: 9645
- Joined: Tue Dec 05, 2006 12:00 am
- Location: Girona, Catalonia
-
Contact:
Post
by Yeray » Tue Dec 14, 2010 5:18 pm
Hi wuhu_software,
Some options you have:
- Set:
- Set:
- Hide the labels and calculate their positions yourself and draw the texts manually at OnAfterDraw event. Something to start with:
Code: Select all
Dim Pi
Private Sub Form_Load()
TChart1.AddSeries scCircularGauge
With TChart1.Series(0).asCircularGauge
.TotalAngle = 360
.RotationAngle = 180
.Maximum = 360
.RotateLabels = False
.Axis.Increment = 22.5
.Axis.Labels.Visible = False
End With
Pi = 4 * Atn(1)
End Sub
Private Sub TChart1_OnAfterDraw()
Dim val, alfa, XPos, YPos As Integer
val = 0
With TChart1.Series(0).asCircularGauge
While val < .Maximum
alfa = val - 90
XPos = .CircleXCenter + .XRadius * Cos(alfa / 180 * Pi)
YPos = .CircleYCenter + .YRadius * Sin(alfa / 180 * Pi)
TChart1.Canvas.Font.Color = .Axis.Labels.Font.Color
TChart1.Canvas.Font.Name = .Axis.Labels.Font.Name
TChart1.Canvas.Font.Bold = .Axis.Labels.Font.Bold
TChart1.Canvas.Font.Size = .Axis.Labels.Font.Size
TChart1.Canvas.TextOut XPos, YPos, Str$(Round(val))
val = val + .Axis.Increment
Wend
End With
End Sub
-
wuhu_software
- Newbie

- Posts: 7
- Joined: Mon Oct 19, 2009 12:00 am
Post
by wuhu_software » Tue Dec 14, 2010 6:00 pm
Thank you for the information.
I will attempt to translate from VB to C++.
If you happen to have the fix in C++ that would be great.
-
Sandra
- Site Admin

- Posts: 3132
- Joined: Fri Nov 07, 2008 12:00 am
Post
by Sandra » Fri Dec 17, 2010 1:01 pm
Hello wuhu_software,
I have translated code made in VB to C++:
Code: Select all
double Pi;
private: System::Void Form1_Load(System::Object^ sender, System::EventArgs^ e)
{
axTChart1->AddSeries(TeeChart::ESeriesClass::scCircularGauge);
axTChart1->Series(0)->asCircularGauge->TotalAngle=360;
axTeeCommander1->ChartLink =axTChart1->ChartLink;
axTChart1->Series(0)->asCircularGauge->RotationAngle=180;
axTChart1->Series(0)->asCircularGauge->Maximum=360;
axTChart1->Series(0)->asCircularGauge->RotateLabels=false;
axTChart1->Series(0)->asCircularGauge->Axis->Increment=22.5;
axTChart1->Series(0)->asCircularGauge->Axis->Labels->Visible=false;
Pi= 0.40*(Math::Atan(1));
}
private: System::Void axTChart1_OnAfterDraw(System::Object^ sender, System::EventArgs^ e)
{
int val,XPos,YPos,alfa;
val = 0;
while(val< axTChart1->Series(0)->asCircularGauge->Maximum)
{
alfa = val-90;
XPos=axTChart1->Series(0)->asCircularGauge->CircleXCenter+(axTChart1->Series(0)->asCircularGauge->XRadius)*(Math::Cos(alfa / (180 * Pi)));
YPos= axTChart1->Series(0)->asCircularGauge->CircleYCenter+(axTChart1->Series(0)->asCircularGauge->YRadius)*( Math::Sin(alfa / (180 * Pi)));
axTChart1->Canvas->Font->Color= axTChart1->Series(0)->asCircularGauge->Axis->Labels->Font->Color;
axTChart1->Canvas->Font->Name= axTChart1->Series(0)->asCircularGauge->Axis->Labels->Font->Name;
axTChart1->Canvas->Font->Bold= axTChart1->Series(0)->asCircularGauge->Axis->Labels->Font->Bold;
axTChart1->Canvas->Font->Size= axTChart1->Series(0)->asCircularGauge->Axis->Labels->Font->Size;
axTChart1->Canvas->TextOut(XPos,YPos,(Math::Round(val)).ToString());
val= val+ axTChart1->Series(0)->asCircularGauge->Axis->Increment;
}
}
If it doesn't work for you please let me know.
I hope will helps.
Thanks,
-
wuhu_software
- Newbie

- Posts: 7
- Joined: Mon Oct 19, 2009 12:00 am
Post
by wuhu_software » Mon Jan 03, 2011 8:34 pm
Sandra,
I finally tried to implement your patch. I am guessing that what you posted was for C++ .Net? I am using VC 6.0 and MFC.
Here is what I attempted to translate to regular C++:
This resulted in an exception being thrown at the bold line
Please advise.
---
void CCircularGaugeTestDlg::OnOnAfterDrawTchart1()
{
double pi = 3.1415926535;
int val,XPos,YPos,alfa;
val = 0;
while(val< m_Gauge.Series(0).GetAsCircularGauge().GetMaximum())
{
alfa = val-90;
XPos=m_Gauge.Series(0).GetAsGauge().GetXCenter() + (m_Gauge.Series(0).GetAsGauge().GetXRadius())*(cos(alfa / (180 * pi)));
YPos= m_Gauge.Series(0).GetAsGauge().GetYCenter() + (m_Gauge.Series(0).GetAsGauge().GetYRadius())*(sin(alfa / (180 * pi)));
m_Gauge.GetCanvas().GetFont().SetColor(m_Gauge.GetAxis().GetBottom().GetLabels().GetFont().GetColor());
m_Gauge.GetCanvas().GetFont().SetName(m_Gauge.GetAxis().GetBottom().GetLabels().GetFont().GetName());
m_Gauge.GetCanvas().GetFont().SetBold(m_Gauge.GetAxis().GetBottom().GetLabels().GetFont().GetBold());
m_Gauge.GetCanvas().GetFont().SetSize(m_Gauge.GetAxis().GetBottom().GetLabels().GetFont().GetSize());
CString tString;
tString.Format("%d",val);
m_Gauge.GetCanvas().TextOut(XPos,YPos,tString);
val = val + m_Gauge.GetAxis().GetBottom().GetIncrement();
}
}
-
Sandra
- Site Admin

- Posts: 3132
- Joined: Fri Nov 07, 2008 12:00 am
Post
by Sandra » Tue Jan 04, 2011 2:22 pm
Hello wuhu_software,
I have detected that you use GetAsGauge() instead of GetAsCircularGauge(). Please, change each GetGauge() to GetCircularGauges() and try again if your application works as you expected.
I hope will helps.
Thanks,
-
wuhu_software
- Newbie

- Posts: 7
- Joined: Mon Oct 19, 2009 12:00 am
Post
by wuhu_software » Tue Jan 04, 2011 2:58 pm
Sandra,
The reason I changed that is because the CCircularGauge does not have the GetXCenter, GetXRadius, GetYCenter, and GetYRadius methods. Were these methods added in a later version? I have v8.0.0.7.x
Below are the public methods of CCircularGauge.
Thanks.
Heath
---
CTeeShape GetFace();
CFramedBorder GetFrame();
double GetValue();
void SetValue(double newValue);
CGaugePointerRange GetGreenLine();
BOOL GetHorizontal();
void SetHorizontal(BOOL bNewValue);
double GetMaximum();
void SetMaximum(double newValue);
double GetMinimum();
void SetMinimum(double newValue);
long GetMinorTickDistance();
void SetMinorTickDistance(long nNewValue);
CGaugeSeriesPointer GetMinorTicks();
CGaugePointerRange GetRedLine();
CGaugeSeriesPointer GetTicks();
CGaugeSeriesPointer GetCenter();
BOOL GetCircled();
void SetCircled(BOOL bNewValue);
CPointer GetEndPoint();
BOOL GetLabelsInside();
void SetLabelsInside(BOOL bNewValue);
BOOL GetRotateLabels();
void SetRotateLabels(BOOL bNewValue);
double GetRotationAngle();
void SetRotationAngle(double newValue);
double GetTotalAngle();
void SetTotalAngle(double newValue);
CGaugeHand GetHand();
-
Yeray
- Site Admin

- Posts: 9645
- Joined: Tue Dec 05, 2006 12:00 am
- Location: Girona, Catalonia
-
Contact:
Post
by Yeray » Wed Jan 05, 2011 1:54 pm
Hi wuhu_software,
You cannot call GetAsGauge having another type. Having a CircularGauges you only can call GetAsCircularGauge.
These methods are new features in TeeChart AX v2010. I can't think on a way to do the same in v8 right now.