How to use custom labels in TpolarSeries?
How to use custom labels in TpolarSeries?
Using TPolarSeries in TeeChart 2015, how to replace the original circleLabels at 0, 90, 180, 270 degrees with custom labels?
Re: How to use custom labels in TpolarSeries?
Hello,
You can use the TPolarSeries' OnGetCircleLabel event for that. Ie:
You can use the TPolarSeries' OnGetCircleLabel event for that. Ie:
Code: Select all
procedure TForm1.PolarGetCircleLabel(Sender:TCustomPolarSeries; const Angle:Double;
Index:Integer; var Text:String);
begin
if Text='40°' then
Text:='this was 40°';
end;
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
Re: How to use custom labels in TpolarSeries?
Yes, it works. When Series1 exists, we can use the following procedure:
procedure TForm1.Series1GetCircleLabel(Sender: TCustomPolarSeries; const Angle: Double; Index: Integer; var Text: string);
begin
if Text = '40°' then
Text := 'This was 40°';
end;
But, if I create Series dynamically with codes, where to add and how to use the GetCircleLabel procedure? Would you like to give me an example?
Best Regards,
Xiushan
procedure TForm1.Series1GetCircleLabel(Sender: TCustomPolarSeries; const Angle: Double; Index: Integer; var Text: string);
begin
if Text = '40°' then
Text := 'This was 40°';
end;
But, if I create Series dynamically with codes, where to add and how to use the GetCircleLabel procedure? Would you like to give me an example?
Best Regards,
Xiushan
Re: How to use custom labels in TpolarSeries?
Hello,
To assign an event at runtime you just have to declare the method at the top, as the others. Note the method needs to declare the same parameter types than the event expects. Then, you can assign the event to the series. Ie:
To assign an event at runtime you just have to declare the method at the top, as the others. Note the method needs to declare the same parameter types than the event expects. Then, you can assign the event to the series. Ie:
Code: Select all
private
{ Private declarations }
procedure Series1GetCircleLabel(Sender: TCustomPolarSeries; const Angle: Double; Index: Integer; var Text: string);
//...
procedure TForm1.FormCreate(Sender: TObject);
begin
with Chart1.AddSeries(TPolarSeries) as TPolarSeries do
begin
FillSampleValues;
OnGetCircleLabel:=Series1GetCircleLabel;
end;
end;
procedure TForm1.Series1GetCircleLabel(Sender: TCustomPolarSeries; const Angle: Double; Index: Integer; var Text: string);
begin
if Text = '40°' then
Text := 'This was 40°';
end;
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
Re: How to use custom labels in TpolarSeries?
How to display Axis Labels at every Ticks?
Although I change the Label’s style and margins as far as possible, the Axis Labels do not display as crowded as expected (they are too sparse or few).
Although I change the Label’s style and margins as far as possible, the Axis Labels do not display as crowded as expected (they are too sparse or few).
- Attachments
-
- www.jpg (56.57 KiB) Viewed 9605 times
-
- w2.jpg (59.62 KiB) Viewed 9604 times
-
- w1.jpg (59.3 KiB) Viewed 9610 times
Re: How to use custom labels in TpolarSeries?
Hello,
You can modify the Increment:
However, if there isn't space for all the labels to be drawn, the circular grid will be drawn according to that Increment but the labels won't match.
In that case, you try setting a smaller font. Ie:
You can modify the Increment:
Code: Select all
GetVertAxis.Increment:=200;
In that case, you try setting a smaller font. Ie:
Code: Select all
Chart1.Axes.Bottom.LabelsFont.Size:=7;
Chart1.Axes.Top.LabelsFont.Size:=7;
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
Re: How to use custom labels in TpolarSeries?
It seems that the labels arrangement on the BottomAxis not only relate to the BottomAxis component properties, but also relate to the CircleLabels properties. Sometimes, changing GetVertAxis.Increment or LabelsFont.Size do not get satisfied results. Generally, we expect to arrange the labels on the radial axes and the Radar/Polar circle, respectively. That is to say, the label’s properties on the radial axes and the Radar/Polar circle may be different. Do you have any good solutions to arrange the labels on the radial axes closely? Thanks a lot.
Re: How to use custom labels in TpolarSeries?
Hello,
If I understand the problem correctly, you can use custom labels to manually place the labels you want. Ie:
If I understand the problem correctly, you can use custom labels to manually place the labels you want. Ie:
Code: Select all
uses TeePolar;
procedure TForm1.FormCreate(Sender: TObject);
var i, tmp, tmpInc: Integer;
begin
Chart1.View3D:=false;
Chart1.Legend.Visible:=false;
Chart1.Gradient.Visible:=false;
with Chart1.AddSeries(TPolarSeries) as TPolarSeries do
begin
FillSampleValues;
Pointer.Visible:=false;
Brush.Clear;
Pen.Color:=Color;
CircleBrush.Clear;
end;
Chart1.Axes.Bottom.LabelsFont.Size:=7;
Chart1.Axes.Top.LabelsFont.Size:=7;
Chart1.Draw;
with Chart1.Axes.Top do
begin
tmpInc:=Round((Chart1[0].MaxYValue-Chart1[0].MinYValue)/5);
Items.Clear;
for i:=0 to 4 do
begin
tmp:=Round(Minimum+(i*tmpInc));
Items.Add(tmp, IntToStr(tmp));
end;
end;
end;
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |