I would like to change the labels for a Polar Series from 0-360 to a 12 hr clock format. I tried to change the labels using:
for(int x=0;x<360;x++){
AnsiString aStr = IntToStr(((360-ang)/30) + 1);
Series1->Labels[x] = aStr;
}
But I still get 0-360 on the chart. I have a couple of other series on the chart as well. I also tried editing the Series "Text" field in the Chart editor on the Series/Data display grid. Still no change. What am I doing or is it not possible?
thanks.
Kev
Polar Series Labesl
-
- Advanced
- Posts: 103
- Joined: Tue Mar 02, 2004 5:00 am
- Location: Bad Wurzach
- Contact:
Hi, Kev.
Changing XLabels array won't work in this case as polar labels are "calculated" in the TCustomPolarSeries.GetCircleLabel method. The solution in your case is to derive new series type from TPolarSeries, override it's GetCircleLabel method and change it's implementataion. In your case:
Very similar code can also be used with BCB.
Changing XLabels array won't work in this case as polar labels are "calculated" in the TCustomPolarSeries.GetCircleLabel method. The solution in your case is to derive new series type from TPolarSeries, override it's GetCircleLabel method and change it's implementataion. In your case:
Code: Select all
type
TPolarSeriesEx = class (TPolarSeries)
protected
function GetCircleLabel(Const Angle:Double; Index:Integer):String; override;
end;
{ TPolarSeriesEx }
function TPolarSeriesEx.GetCircleLabel(const Angle: Double;
Index: Integer): String;
var tmpAngle : Integer;
begin
tmpAngle:=Round((360.0-Angle)/30.0);
result := IntToStr(tmpAngle);
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
Chart1.FreeAllSeries(nil);
Chart1.AddSeries(TPolarSeriesEx);
With (Chart1.Series[0] as TPolarSeriesEx) do
begin
ClockwiseLabels := True;
RotationAngle:=90;
AngleIncrement := 30;
CircleLabels := True;
FillSampleValues(10);
end;
end;
Marjan Slatinek,
http://www.steema.com
http://www.steema.com
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Kev,
It may also be of your interest knowing that there's already a clock series type (TClockSeries). This type is available at the "Other" series tab.
It may also be of your interest knowing that there's already a clock series type (TClockSeries). This type is available at the "Other" series tab.
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 |