Delphi中TeeChart用法------柱状图

接上例,代码如下:

unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, TeEngine, ExtCtrls, TeeProcs, Chart, Series, StdCtrls; type TForm1 = class(TForm) Chart1: TChart; Button1: TButton; Button2: TButton; procedure Chart1ClickSeries(Sender: TCustomChart; Series: TChartSeries; ValueIndex: Integer; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); procedure Button1Click(Sender: TObject); procedure Button2Click(Sender: TObject); private { Private declarations } public { Public declarations } end; var Form1: TForm1; implementation {$R *.dfm} procedure TForm1.Button1Click(Sender: TObject); var series1 : TPieSeries; begin Series1 := TPieSeries.Create(Chart1); Series1.Clear; Series1.Add( 1, 'abc', clRed ); Series1.Add( 2, 'def', clYellow ); Series1.Add( 3, 'ghi', clGreen ); Chart1.ClearChart; Chart1.AddSeries(series1); end; procedure TForm1.Button2Click(Sender: TObject); var series1 : TBarSeries; begin Series1 := TBarSeries.Create(Chart1); Series1.Clear; Series1.Add( 1, 'abc', clRed ); Series1.Add( 2, 'def', clYellow ); Series1.Add( 3, 'ghi', clGreen ); Chart1.ClearChart; Chart1.AddSeries(series1); end; procedure TForm1.Chart1ClickSeries(Sender: TCustomChart; Series: TChartSeries; ValueIndex: Integer; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); begin ShowMessage(Series.XLabel[ValueIndex]); end; end.

你可能感兴趣的:(windows,Integer,Class,button,Delphi,Forms)