home *** CD-ROM | disk | FTP | other *** search
- unit Umarks;
- {$P-} { <-- Delphi 1.0 compatibility when using OnGetMarkText }
-
- interface
-
- { This example shows how to customize Series Marks.
- The OnGetMarkText event is used to supply custom text for Marks.
- }
- uses
- SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
- Forms, Dialogs, TeEngine, Series, StdCtrls, ExtCtrls, Buttons, TeeProcs,
- Chart;
-
- type
- TCustomMarksForm = class(TForm)
- Chart1: TChart;
- BitBtn1: TBitBtn;
- RadioGroup1: TRadioGroup;
- Series1: TPieSeries;
- procedure BitBtn1Click(Sender: TObject);
- procedure FormCreate(Sender: TObject);
- procedure Series1GetMarkText(Sender: TChartSeries; ValueIndex: Integer;
- var MarkText: String);
- procedure RadioGroup1Click(Sender: TObject);
- private
- { Private declarations }
- public
- { Public declarations }
- end;
-
- var
- CustomMarksForm: TCustomMarksForm;
-
- implementation
-
- {$R *.DFM}
-
- procedure TCustomMarksForm.BitBtn1Click(Sender: TObject);
- begin
- Close;
- end;
-
- procedure TCustomMarksForm.FormCreate(Sender: TObject);
- begin
- Series1.FillSampleValues(8);
- end;
-
- { This event does the conversion... }
- procedure TCustomMarksForm.Series1GetMarkText(Sender: TChartSeries;
- ValueIndex: Integer; var MarkText: String);
- begin
- if RadioGroup1.ItemIndex=0 then
- begin
- { example: change the mark text }
- MarkText:='This is: '+Sender.XLabel[ValueIndex];
-
- { example: hide specific marks }
- if ValueIndex<3 then MarkText:='';
-
- { example: change Marks Font style for specific marks }
- if ValueIndex>5 then
- Sender.Marks.Font.Style:=[fsBold]
- else
- Sender.Marks.Font.Style:=[];
- end;
- end;
-
- procedure TCustomMarksForm.RadioGroup1Click(Sender: TObject);
- begin
- Series1.Marks.Font.Style:=[];
- Chart1.Repaint; { <-- force repaint }
- end;
-
- end.
-