home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 2001 December
/
Chip_2001-12_cd1.bin
/
zkuste
/
delphi
/
kolekce
/
d56
/
DM2KVCL.ZIP
/
PLOTDEMO
/
PLOTDMOU.PAS
< prev
Wrap
Pascal/Delphi Source File
|
2000-11-26
|
5KB
|
165 lines
{****************************************************************************}
{ Data Master 2000 }
{****************************************************************************}
unit PlotDmoU;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
ExtCtrls, Plot, StdCtrls, Data, Spin, ColorGrd, ComCtrls;
type
TPlotDemoForm = class(TForm)
Plot: TPlot;
Container: TContainer;
Panel: TPanel;
PlotHintLabel: TLabel;
PlotClickLabel: TLabel;
YAxisButton: TButton;
SerieLabel: TLabel;
SerieSpinEdit: TSpinEdit;
SerieButton: TButton;
SaveButton: TButton;
SelectionCheckBox: TCheckBox;
ColorGrid1: TColorGrid;
CopyRadioGroup: TRadioGroup;
CopyButton: TButton;
DeleteButton: TButton;
ModeComboBox: TComboBox;
ModifiedCheckBox: TCheckBox;
FillButton: TButton;
ProgressBar: TProgressBar;
Label1: TLabel;
procedure PlotHint(Sender: TObject; H: String);
procedure PlotPaint(Sender: TObject);
procedure PlotPointClick(Sender: TObject; Point, Serie: Integer);
procedure PlotSelectionChange(Sender: TObject);
procedure YAxisButtonClick(Sender: TObject);
procedure SerieButtonClick(Sender: TObject);
procedure SaveButtonClick(Sender: TObject);
procedure SelectionCheckBoxClick(Sender: TObject);
procedure ColorGrid1Change(Sender: TObject);
procedure CopyButtonClick(Sender: TObject);
procedure SerieSpinEditChange(Sender: TObject);
procedure DeleteButtonClick(Sender: TObject);
procedure ModeComboBoxChange(Sender: TObject);
procedure PlotError(Sender: TObject; H: String);
procedure ContainerChanged(Sender: TObject);
procedure FillButtonClick(Sender: TObject);
procedure ContainerProgress(Sender: TObject; P: Integer);
private
{ Private declarations }
public
{ Public declarations }
end;
var
PlotDemoForm: TPlotDemoForm;
implementation
uses AxisDlg, SerieDlg, Common;
{$R *.DFM}
procedure TPlotDemoForm.PlotHint(Sender: TObject; H: String);
begin
PlotHintLabel.Caption:=H; PlotHintLabel.Refresh;
end;
procedure TPlotDemoForm.PlotPaint(Sender: TObject);
begin
Plot.DrawPoint(5,100,ptCircle,20);
end;
procedure TPlotDemoForm.PlotPointClick(Sender: TObject; Point,Serie: Integer);
begin
MessageBeep($ffffffff);
PlotClickLabel.Caption:=Format('Point: %d, serie: %d',[Point,Serie]);
end;
procedure TPlotDemoForm.PlotSelectionChange(Sender: TObject);
begin
PlotClickLabel.Caption:=Format('X1:%g, X2:%g, Y1:%g, Y2:%g',
[Plot.SelectionLeft,Plot.SelectionRight,
Plot.SelectionBottom,Plot.SelectionTop]);
end;
procedure TPlotDemoForm.YAxisButtonClick(Sender: TObject);
begin
AxisPropsForm.Execute(Plot.YAxis);
end;
procedure TPlotDemoForm.SerieButtonClick(Sender: TObject);
begin
with SeriePropsForm do
begin
WorksheetComboBox.Clear;
WorksheetComboBox.Items.AddObject(Container.FileName,Container);
if Assigned(Plot.ThisSerie.Container)
then WorksheetComboBox.ItemIndex:=0 else WorksheetComboBox.ItemIndex:=-1;
XColumnComboBox.Items.Text:='Value'+CRLF+'Square';
YColumnComboBox.Items.Assign(XColumnComboBox.Items); // copy column labels
// here - set XExpressionComboBox.Items!
YExpressionComboBox.Items.Assign(XExpressionComboBox.Items); // copy hist.
Execute(Plot.ThisSerie);
YExpressionComboBox.Items.Assign(XExpressionComboBox.Items); // save hist.
end;
end;
procedure TPlotDemoForm.SaveButtonClick(Sender: TObject);
begin
Plot.SaveToFile(ChangeFileExt(Container.FileName,'.wmf'));
end;
procedure TPlotDemoForm.SelectionCheckBoxClick(Sender: TObject);
begin
Plot.SelectionVisible:=SelectionCheckBox.Checked;
end;
procedure TPlotDemoForm.ColorGrid1Change(Sender: TObject);
begin
{Plot.transparent!}Color:=ColorGrid1.ForeGroundColor;
end;
procedure TPlotDemoForm.CopyButtonClick(Sender: TObject);
begin Plot.CopyToClipboard(TPlotCopyMode(CopyRadioGroup.ItemIndex),true); end;
procedure TPlotDemoForm.SerieSpinEditChange(Sender: TObject);
begin Plot.SerieIndex:=SerieSpinEdit.Value; end;
procedure TPlotDemoForm.DeleteButtonClick(Sender: TObject);
begin Plot.Delete; end;
procedure TPlotDemoForm.ModeComboBoxChange(Sender: TObject);
begin Plot.MouseMode:=TPlotMouseMode(ModeComboBox.ItemIndex); end;
procedure TPlotDemoForm.PlotError(Sender: TObject; H: String);
begin PlotClickLabel.Caption:=H; end;
procedure TPlotDemoForm.ContainerChanged(Sender: TObject);
begin ModifiedCheckBox.Checked:=Container.Modified; Plot.Refresh; end;
procedure TPlotDemoForm.FillButtonClick(Sender: TObject);
var i: integer; d: trealdata;
begin
for i:=0 to plot.series.count-1 do plot.series[i].clearblock;
container.clear;
for i:=0 to 10000 do
begin
d:=trealdata.create; d.insitem(i); d.insitem(i*i/1.5);
container.items.add(d);
end;
plot.series[0].firstline:=0; plot.series[0].lastline:=10000;
plot.series[0].xcolumn:=1; plot.series[0].ycolumn:=2;
plot.xaxis.autoscale:=true; plot.yaxis.autoscale:=true;
end;
procedure TPlotDemoForm.ContainerProgress(Sender: TObject; P: Integer);
begin
if p<99 then Progressbar.position:=p else Progressbar.position:=0;
end;
end.