Page 1 of 1

Circular Gauge Label Problem

Posted: Sat Oct 09, 2010 10:12 pm
by 15054435
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:

Image

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:

Image

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.

Re: Circular Gauge Label Problem

Posted: Mon Oct 11, 2010 9:54 am
by yeray
Hi wuhu_software,

I could reproduce it and added it to the defect list to be fixed in future releases (TV52015197).

Re: Circular Gauge Label Problem

Posted: Sat Dec 11, 2010 11:35 pm
by 15054435
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.

Re: Circular Gauge Label Problem

Posted: Mon Dec 13, 2010 8:32 am
by yeray
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.

Re: Circular Gauge Label Problem

Posted: Mon Dec 13, 2010 12:37 pm
by 15054435
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?

Re: Circular Gauge Label Problem

Posted: Tue Dec 14, 2010 5:18 pm
by yeray
Hi wuhu_software,

Some options you have:

- Set:

Code: Select all

RotateLabels = true
- Set:

Code: Select all

LabelsInside = False
- 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

Re: Circular Gauge Label Problem

Posted: Tue Dec 14, 2010 6:00 pm
by 15054435
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.

Re: Circular Gauge Label Problem

Posted: Fri Dec 17, 2010 1:01 pm
by 10050769
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,

Re: Circular Gauge Label Problem

Posted: Mon Jan 03, 2011 8:34 pm
by 15054435
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();
}
}

Re: Circular Gauge Label Problem

Posted: Tue Jan 04, 2011 2:22 pm
by 10050769
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,

Re: Circular Gauge Label Problem

Posted: Tue Jan 04, 2011 2:58 pm
by 15054435
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();

Re: Circular Gauge Label Problem

Posted: Wed Jan 05, 2011 1:54 pm
by yeray
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.