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"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="ChartForm"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="ChartUnit"/>
</Unit171>

View File

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

View File

@ -1,40 +1,41 @@
object ChartForm: TChartForm
Left = 299
Height = 518
Top = 133
Width = 860
Left = 475
Height = 500
Top = 183
Width = 700
ActiveControl = CloseBtn
Caption = 'Plot window'
ClientHeight = 518
ClientWidth = 860
ClientHeight = 500
ClientWidth = 700
OnActivate = FormActivate
OnCreate = FormCreate
LCLVersion = '2.1.0.0'
object ButtonBevel: TBevel
Left = 0
Height = 8
Top = 468
Width = 860
Height = 2
Top = 456
Width = 700
Align = alBottom
Shape = bsBottomLine
end
object ButtonPanel: TPanel
Left = 8
Height = 26
Top = 484
Width = 844
Top = 466
Width = 684
Align = alBottom
AutoSize = True
BorderSpacing.Around = 8
BevelOuter = bvNone
ClientHeight = 26
ClientWidth = 844
TabOrder = 1
ClientWidth = 684
TabOrder = 0
object PrintBtn: TButton
AnchorSideLeft.Control = ButtonPanel
AnchorSideLeft.Side = asrCenter
AnchorSideTop.Control = ButtonPanel
AnchorSideTop.Side = asrCenter
Left = 397
Left = 317
Height = 25
Top = 1
Width = 51
@ -49,7 +50,7 @@ object ChartForm: TChartForm
AnchorSideTop.Control = ButtonPanel
AnchorSideTop.Side = asrCenter
AnchorSideRight.Control = PrintBtn
Left = 299
Left = 219
Height = 25
Top = 1
Width = 86
@ -65,7 +66,7 @@ object ChartForm: TChartForm
AnchorSideTop.Control = ButtonPanel
AnchorSideTop.Side = asrCenter
AnchorSideRight.Side = asrBottom
Left = 460
Left = 380
Height = 25
Top = 1
Width = 55
@ -77,47 +78,66 @@ object ChartForm: TChartForm
TabOrder = 2
end
end
object Chart: TChart
object Panel1: TPanel
Left = 6
Height = 456
Height = 444
Top = 6
Width = 848
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'
)
Width = 688
Align = alClient
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
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 (*.*)|*.*'

View File

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

View File

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