LazStats: Some tweaks in ChartUnit. Update help file for new chart in PlotXYUnit. Use FileDialog.InitialDir when opening data file.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@7627 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2020-08-22 17:53:57 +00:00
parent 8d74b6e07d
commit f8e970a929
7 changed files with 101 additions and 63 deletions

Binary file not shown.

View File

@ -1396,6 +1396,7 @@
<Filename Value="forms\misc\chartunit.pas"/> <Filename Value="forms\misc\chartunit.pas"/>
<IsPartOfProject Value="True"/> <IsPartOfProject Value="True"/>
<ComponentName Value="ChartForm"/> <ComponentName Value="ChartForm"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/> <ResourceBaseClass Value="Form"/>
<UnitName Value="ChartUnit"/> <UnitName Value="ChartUnit"/>
</Unit171> </Unit171>

View File

@ -357,10 +357,8 @@ begin
ChartForm.Clear; ChartForm.Clear;
// Titles // Titles
ChartForm.SetTitle(Format('X vs. Y plot using file "%s"', [ ChartForm.SetTitle('X vs. Y plot using file ' + OS3MainFrm.FileNameEdit.Text);
OS3MainFrm.FileNameEdit.Text ChartForm.SetFooter(Format('R(X,Y) = %.3f, Slope = %.3f, Intercept = %.3f', [
]));
ChartForm.SetFooter(Format('R(X,Y) = %.3f, Slope = %.2f, Intercept = %.2f', [
R, Slope, Intercept R, Slope, Intercept
])); ]));
ChartForm.SetXTitle(XEdit.Text); ChartForm.SetXTitle(XEdit.Text);

View File

@ -1,40 +1,41 @@
object ChartForm: TChartForm object ChartForm: TChartForm
Left = 299 Left = 475
Height = 518 Height = 500
Top = 133 Top = 183
Width = 860 Width = 700
ActiveControl = CloseBtn ActiveControl = CloseBtn
Caption = 'Plot window' Caption = 'Plot window'
ClientHeight = 518 ClientHeight = 500
ClientWidth = 860 ClientWidth = 700
OnActivate = FormActivate
OnCreate = FormCreate OnCreate = FormCreate
LCLVersion = '2.1.0.0' LCLVersion = '2.1.0.0'
object ButtonBevel: TBevel object ButtonBevel: TBevel
Left = 0 Left = 0
Height = 8 Height = 2
Top = 468 Top = 456
Width = 860 Width = 700
Align = alBottom Align = alBottom
Shape = bsBottomLine Shape = bsBottomLine
end end
object ButtonPanel: TPanel object ButtonPanel: TPanel
Left = 8 Left = 8
Height = 26 Height = 26
Top = 484 Top = 466
Width = 844 Width = 684
Align = alBottom Align = alBottom
AutoSize = True AutoSize = True
BorderSpacing.Around = 8 BorderSpacing.Around = 8
BevelOuter = bvNone BevelOuter = bvNone
ClientHeight = 26 ClientHeight = 26
ClientWidth = 844 ClientWidth = 684
TabOrder = 1 TabOrder = 0
object PrintBtn: TButton object PrintBtn: TButton
AnchorSideLeft.Control = ButtonPanel AnchorSideLeft.Control = ButtonPanel
AnchorSideLeft.Side = asrCenter AnchorSideLeft.Side = asrCenter
AnchorSideTop.Control = ButtonPanel AnchorSideTop.Control = ButtonPanel
AnchorSideTop.Side = asrCenter AnchorSideTop.Side = asrCenter
Left = 397 Left = 317
Height = 25 Height = 25
Top = 1 Top = 1
Width = 51 Width = 51
@ -49,7 +50,7 @@ object ChartForm: TChartForm
AnchorSideTop.Control = ButtonPanel AnchorSideTop.Control = ButtonPanel
AnchorSideTop.Side = asrCenter AnchorSideTop.Side = asrCenter
AnchorSideRight.Control = PrintBtn AnchorSideRight.Control = PrintBtn
Left = 299 Left = 219
Height = 25 Height = 25
Top = 1 Top = 1
Width = 86 Width = 86
@ -65,7 +66,7 @@ object ChartForm: TChartForm
AnchorSideTop.Control = ButtonPanel AnchorSideTop.Control = ButtonPanel
AnchorSideTop.Side = asrCenter AnchorSideTop.Side = asrCenter
AnchorSideRight.Side = asrBottom AnchorSideRight.Side = asrBottom
Left = 460 Left = 380
Height = 25 Height = 25
Top = 1 Top = 1
Width = 55 Width = 55
@ -77,47 +78,66 @@ object ChartForm: TChartForm
TabOrder = 2 TabOrder = 2
end end
end end
object Chart: TChart object Panel1: TPanel
Left = 6 Left = 6
Height = 456 Height = 444
Top = 6 Top = 6
Width = 848 Width = 688
AxisList = <
item
Grid.Color = clSilver
Grid.Style = psSolid
Grid.Visible = False
Marks.LabelBrush.Style = bsClear
Minors = <>
Title.LabelFont.Orientation = 900
Title.LabelFont.Style = [fsBold]
Title.LabelBrush.Style = bsClear
end
item
Grid.Color = clSilver
Grid.Style = psSolid
Grid.Visible = False
Alignment = calBottom
Marks.LabelBrush.Style = bsClear
Minors = <>
Title.LabelFont.Style = [fsBold]
Title.LabelBrush.Style = bsClear
end>
BackColor = clWhite
Foot.Brush.Color = clBtnFace
Foot.Font.Color = clBlue
Margins.Left = 8
Margins.Top = 8
Margins.Right = 8
Margins.Bottom = 8
Title.Brush.Color = clBtnFace
Title.Font.Color = clBlue
Title.Font.Style = [fsBold]
Title.Text.Strings = (
'TAChart'
)
Align = alClient Align = alClient
BorderSpacing.Around = 6 BorderSpacing.Around = 6
BevelOuter = bvNone
BorderStyle = bsSingle
Caption = 'Panel1'
ClientHeight = 440
ClientWidth = 684
Color = clWhite
ParentColor = False
TabOrder = 1
object Chart: TChart
Left = 6
Height = 428
Top = 6
Width = 672
AxisList = <
item
Grid.Color = clSilver
Grid.Style = psSolid
Grid.Visible = False
Marks.LabelBrush.Style = bsClear
Minors = <>
Title.LabelFont.Orientation = 900
Title.LabelFont.Style = [fsBold]
Title.LabelBrush.Style = bsClear
end
item
Grid.Color = clSilver
Grid.Style = psSolid
Grid.Visible = False
Alignment = calBottom
Marks.LabelBrush.Style = bsClear
Minors = <>
Title.LabelFont.Style = [fsBold]
Title.LabelBrush.Style = bsClear
end>
BackColor = clWhite
Foot.Brush.Color = clBtnFace
Foot.Brush.Style = bsClear
Foot.Font.Color = clBlue
Margins.Left = 8
Margins.Top = 8
Margins.Right = 8
Margins.Bottom = 8
Title.Brush.Color = clBtnFace
Title.Brush.Style = bsClear
Title.Font.Color = clBlue
Title.Font.Style = [fsBold]
Title.Text.Strings = (
'TAChart'
)
Align = alClient
BorderSpacing.Around = 6
Color = clWhite
end
end end
object SavePictureDialog: TSavePictureDialog object SavePictureDialog: TSavePictureDialog
Filter = 'Graphic (*.png;*.bmp;*.jpeg;*.jpg;*.jpe;*.jfif;*.svg)|*.png;*.bmp;*.jpeg;*.jpg;*.jpe;*.jfif;*.svg|Portable Network Graphic (*.png)|*.png|Bitmaps (*.bmp)|*.bmp|Joint Picture Expert Group (*.jpeg;*.jpg;*.jpe;*.jfif)|*.jpeg;*.jpg;*.jpe;*.jfif|Scaleable Vector Graphic (*.svg)|*.svg|All Files (*.*)|*.*' Filter = 'Graphic (*.png;*.bmp;*.jpeg;*.jpg;*.jpe;*.jfif;*.svg)|*.png;*.bmp;*.jpeg;*.jpg;*.jpe;*.jfif;*.svg|Portable Network Graphic (*.png)|*.png|Bitmaps (*.bmp)|*.bmp|Joint Picture Expert Group (*.jpeg;*.jpg;*.jpe;*.jfif)|*.jpeg;*.jpg;*.jpe;*.jfif|Scaleable Vector Graphic (*.svg)|*.svg|All Files (*.*)|*.*'

View File

@ -21,10 +21,12 @@ type
Chart: TChart; Chart: TChart;
CloseBtn: TButton; CloseBtn: TButton;
ButtonPanel: TPanel; ButtonPanel: TPanel;
Panel1: TPanel;
PrintBtn: TButton; PrintBtn: TButton;
PrintDialog: TPrintDialog; PrintDialog: TPrintDialog;
SaveBtn: TButton; SaveBtn: TButton;
SavePictureDialog: TSavePictureDialog; SavePictureDialog: TSavePictureDialog;
procedure FormActivate(Sender: TObject);
procedure FormCreate(Sender: TObject); procedure FormCreate(Sender: TObject);
procedure PrintBtnClick(Sender: TObject); procedure PrintBtnClick(Sender: TObject);
procedure SaveBtnClick(Sender: TObject); procedure SaveBtnClick(Sender: TObject);
@ -58,7 +60,7 @@ implementation
{$R *.lfm} {$R *.lfm}
uses uses
Math, Printers, //OSPrinters, Math, Printers, OSPrinters,
TAChartUtils, TATypes, TADrawerSVG, TAPrint; TAChartUtils, TATypes, TADrawerSVG, TAPrint;
{ TChartForm } { TChartForm }
@ -72,6 +74,16 @@ begin
Chart.LeftAxis.Title.Caption := ''; Chart.LeftAxis.Title.Caption := '';
end; end;
procedure TChartForm.FormActivate(Sender: TObject);
var
w: Integer;
begin
w := MaxValue([SaveBtn.Width, PrintBtn.Width, CloseBtn.Width]);
SaveBtn.Constraints.MinWidth := w;
PrintBtn.Constraints.MinWidth := w;
CloseBtn.Constraints.MinWidth := w;
end;
procedure TChartForm.FormCreate(Sender: TObject); procedure TChartForm.FormCreate(Sender: TObject);
begin begin
Clear; Clear;

View File

@ -278,11 +278,18 @@ end;
procedure OpenOS2File; procedure OpenOS2File;
begin begin
OS3MainFrm.OpenDialog1.DefaultExt := '.laz'; with OS3MainFrm.OpenDialog1 do
OS3MainFrm.OpenDialog1.Filter := 'LazStats files (*.laz)|*.laz;*.LAZ|All files (*.*)|*.*'; begin
OS3MainFrm.OpenDialog1.FilterIndex := 1; DefaultExt := '.laz';
if OS3MainFrm.OpenDialog1.Execute then Filter := 'LazStats files (*.laz)|*.laz;*.LAZ|All files (*.*)|*.*';
OpenOS2File(OS3MainFrm.OpenDialog1.FileName, true); if InitialDir = '' then
InitialDir := Globals.Options.DefaultDataPath;
FilterIndex := 1;
if Execute then begin
OpenOS2File(FileName, true);
InitialDir := ExtractFilePath(FileName);
end;
end;
end; end;
procedure OpenOS2File(const AFileName: String; ShowDictionaryForm: Boolean); procedure OpenOS2File(const AFileName: String; ShowDictionaryForm: Boolean);