mirror of
				https://gitlab.com/freepascal.org/lazarus/lazarus.git
				synced 2025-10-31 06:21:38 +01:00 
			
		
		
		
	TAChart: Add example to demonstrate usage of Axis.Marks.AtDataOnly
git-svn-id: trunk@54024 -
This commit is contained in:
		
							parent
							
								
									aad2a41b76
								
							
						
					
					
						commit
						61517bc3fb
					
				
							
								
								
									
										4
									
								
								.gitattributes
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										4
									
								
								.gitattributes
									
									
									
									
										vendored
									
									
								
							| @ -4315,6 +4315,10 @@ components/tachart/demo/panes-2/project1.lpi svneol=native#text/pascal | |||||||
| components/tachart/demo/panes-2/project1.lpr svneol=native#text/pascal | components/tachart/demo/panes-2/project1.lpr svneol=native#text/pascal | ||||||
| components/tachart/demo/panes-2/unit1.lfm svneol=native#text/pascal | components/tachart/demo/panes-2/unit1.lfm svneol=native#text/pascal | ||||||
| components/tachart/demo/panes-2/unit1.pas svneol=native#text/pascal | components/tachart/demo/panes-2/unit1.pas svneol=native#text/pascal | ||||||
|  | components/tachart/demo/panes-3/project1.lpi svneol=native#text/plain | ||||||
|  | components/tachart/demo/panes-3/project1.lpr svneol=native#text/plain | ||||||
|  | components/tachart/demo/panes-3/unit1.lfm svneol=native#text/plain | ||||||
|  | components/tachart/demo/panes-3/unit1.pas svneol=native#text/plain | ||||||
| components/tachart/demo/panes/Main.lfm svneol=native#text/plain | components/tachart/demo/panes/Main.lfm svneol=native#text/plain | ||||||
| components/tachart/demo/panes/Main.pas svneol=native#text/pascal | components/tachart/demo/panes/Main.pas svneol=native#text/pascal | ||||||
| components/tachart/demo/panes/panes.lpi svneol=native#text/plain | components/tachart/demo/panes/panes.lpi svneol=native#text/plain | ||||||
|  | |||||||
							
								
								
									
										79
									
								
								components/tachart/demo/panes-3/project1.lpi
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										79
									
								
								components/tachart/demo/panes-3/project1.lpi
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,79 @@ | |||||||
|  | <?xml version="1.0" encoding="UTF-8"?> | ||||||
|  | <CONFIG> | ||||||
|  |   <ProjectOptions> | ||||||
|  |     <Version Value="10"/> | ||||||
|  |     <PathDelim Value="\"/> | ||||||
|  |     <General> | ||||||
|  |       <SessionStorage Value="InProjectDir"/> | ||||||
|  |       <MainUnit Value="0"/> | ||||||
|  |       <Title Value="project1"/> | ||||||
|  |       <ResourceType Value="res"/> | ||||||
|  |       <UseXPManifest Value="True"/> | ||||||
|  |       <Icon Value="0"/> | ||||||
|  |     </General> | ||||||
|  |     <BuildModes Count="1"> | ||||||
|  |       <Item1 Name="Default" Default="True"/> | ||||||
|  |     </BuildModes> | ||||||
|  |     <PublishOptions> | ||||||
|  |       <Version Value="2"/> | ||||||
|  |     </PublishOptions> | ||||||
|  |     <RunParams> | ||||||
|  |       <local> | ||||||
|  |         <FormatVersion Value="1"/> | ||||||
|  |       </local> | ||||||
|  |     </RunParams> | ||||||
|  |     <RequiredPackages Count="2"> | ||||||
|  |       <Item1> | ||||||
|  |         <PackageName Value="TAChartLazarusPkg"/> | ||||||
|  |       </Item1> | ||||||
|  |       <Item2> | ||||||
|  |         <PackageName Value="LCL"/> | ||||||
|  |       </Item2> | ||||||
|  |     </RequiredPackages> | ||||||
|  |     <Units Count="2"> | ||||||
|  |       <Unit0> | ||||||
|  |         <Filename Value="project1.lpr"/> | ||||||
|  |         <IsPartOfProject Value="True"/> | ||||||
|  |       </Unit0> | ||||||
|  |       <Unit1> | ||||||
|  |         <Filename Value="unit1.pas"/> | ||||||
|  |         <IsPartOfProject Value="True"/> | ||||||
|  |         <ComponentName Value="Form1"/> | ||||||
|  |         <HasResources Value="True"/> | ||||||
|  |         <ResourceBaseClass Value="Form"/> | ||||||
|  |         <UnitName Value="Unit1"/> | ||||||
|  |       </Unit1> | ||||||
|  |     </Units> | ||||||
|  |   </ProjectOptions> | ||||||
|  |   <CompilerOptions> | ||||||
|  |     <Version Value="11"/> | ||||||
|  |     <PathDelim Value="\"/> | ||||||
|  |     <Target> | ||||||
|  |       <Filename Value="project1"/> | ||||||
|  |     </Target> | ||||||
|  |     <SearchPaths> | ||||||
|  |       <IncludeFiles Value="$(ProjOutDir)"/> | ||||||
|  |       <UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/> | ||||||
|  |     </SearchPaths> | ||||||
|  |     <Linking> | ||||||
|  |       <Options> | ||||||
|  |         <Win32> | ||||||
|  |           <GraphicApplication Value="True"/> | ||||||
|  |         </Win32> | ||||||
|  |       </Options> | ||||||
|  |     </Linking> | ||||||
|  |   </CompilerOptions> | ||||||
|  |   <Debugging> | ||||||
|  |     <Exceptions Count="3"> | ||||||
|  |       <Item1> | ||||||
|  |         <Name Value="EAbort"/> | ||||||
|  |       </Item1> | ||||||
|  |       <Item2> | ||||||
|  |         <Name Value="ECodetoolError"/> | ||||||
|  |       </Item2> | ||||||
|  |       <Item3> | ||||||
|  |         <Name Value="EFOpenError"/> | ||||||
|  |       </Item3> | ||||||
|  |     </Exceptions> | ||||||
|  |   </Debugging> | ||||||
|  | </CONFIG> | ||||||
							
								
								
									
										21
									
								
								components/tachart/demo/panes-3/project1.lpr
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										21
									
								
								components/tachart/demo/panes-3/project1.lpr
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,21 @@ | |||||||
|  | program project1; | ||||||
|  | 
 | ||||||
|  | {$mode objfpc}{$H+} | ||||||
|  | 
 | ||||||
|  | uses | ||||||
|  |   {$IFDEF UNIX}{$IFDEF UseCThreads} | ||||||
|  |   cthreads, | ||||||
|  |   {$ENDIF}{$ENDIF} | ||||||
|  |   Interfaces, // this includes the LCL widgetset | ||||||
|  |   Forms, Unit1, tachartlazaruspkg | ||||||
|  |   { you can add units after this }; | ||||||
|  | 
 | ||||||
|  | {$R *.res} | ||||||
|  | 
 | ||||||
|  | begin | ||||||
|  |   RequireDerivedFormResource := True; | ||||||
|  |   Application.Initialize; | ||||||
|  |   Application.CreateForm(TForm1, Form1); | ||||||
|  |   Application.Run; | ||||||
|  | end. | ||||||
|  | 
 | ||||||
							
								
								
									
										129
									
								
								components/tachart/demo/panes-3/unit1.lfm
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										129
									
								
								components/tachart/demo/panes-3/unit1.lfm
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,129 @@ | |||||||
|  | object Form1: TForm1 | ||||||
|  |   Left = 280 | ||||||
|  |   Height = 307 | ||||||
|  |   Top = 130 | ||||||
|  |   Width = 585 | ||||||
|  |   Caption = 'Form1' | ||||||
|  |   ClientHeight = 307 | ||||||
|  |   ClientWidth = 585 | ||||||
|  |   LCLVersion = '1.7' | ||||||
|  |   object Chart1: TChart | ||||||
|  |     AnchorSideBottom.Control = CheckBox1 | ||||||
|  |     AnchorSideBottom.Side = asrBottom | ||||||
|  |     Left = 0 | ||||||
|  |     Height = 276 | ||||||
|  |     Top = 0 | ||||||
|  |     Width = 585 | ||||||
|  |     AxisList = <     | ||||||
|  |       item | ||||||
|  |         Grid.Visible = False | ||||||
|  |         TickColor = clRed | ||||||
|  |         AxisPen.Color = clRed | ||||||
|  |         AxisPen.Visible = True | ||||||
|  |         Marks.LabelFont.Color = clRed | ||||||
|  |         Minors = <> | ||||||
|  |         Title.LabelFont.Color = clRed | ||||||
|  |         Title.LabelFont.Orientation = 900 | ||||||
|  |         Title.Visible = True | ||||||
|  |         Title.Caption = '1st y axis' | ||||||
|  |         Transformations = ChartAxisTransformations1 | ||||||
|  |       end     | ||||||
|  |       item | ||||||
|  |         Alignment = calBottom | ||||||
|  |         AxisPen.Visible = True | ||||||
|  |         Minors = <> | ||||||
|  |       end     | ||||||
|  |       item | ||||||
|  |         Grid.Visible = False | ||||||
|  |         TickColor = clBlue | ||||||
|  |         AxisPen.Color = clBlue | ||||||
|  |         AxisPen.Visible = True | ||||||
|  |         Marks.LabelFont.Color = clBlue | ||||||
|  |         Minors = <> | ||||||
|  |         Title.LabelFont.Color = clBlue | ||||||
|  |         Title.LabelFont.Orientation = 900 | ||||||
|  |         Title.Visible = True | ||||||
|  |         Title.Caption = '2nd y axis' | ||||||
|  |         Transformations = ChartAxisTransformations2 | ||||||
|  |       end> | ||||||
|  |     BackColor = clWhite | ||||||
|  |     Foot.Brush.Color = clBtnFace | ||||||
|  |     Foot.Font.Color = clBlue | ||||||
|  |     Frame.Visible = False | ||||||
|  |     Title.Brush.Color = clBtnFace | ||||||
|  |     Title.Font.Color = clBlue | ||||||
|  |     Title.Text.Strings = ( | ||||||
|  |       'TAChart' | ||||||
|  |     ) | ||||||
|  |     object Chart1LineSeries1: TLineSeries | ||||||
|  |       AxisIndexX = 1 | ||||||
|  |       AxisIndexY = 0 | ||||||
|  |       LinePen.Color = clRed | ||||||
|  |       Source = RandomChartSource1 | ||||||
|  |     end | ||||||
|  |     object Chart1LineSeries2: TLineSeries | ||||||
|  |       AxisIndexX = 1 | ||||||
|  |       AxisIndexY = 2 | ||||||
|  |       LinePen.Color = clBlue | ||||||
|  |       Source = RandomChartSource2 | ||||||
|  |     end | ||||||
|  |   end | ||||||
|  |   object CheckBox1: TCheckBox | ||||||
|  |     Left = 6 | ||||||
|  |     Height = 19 | ||||||
|  |     Top = 282 | ||||||
|  |     Width = 116 | ||||||
|  |     Anchors = [akLeft, akBottom] | ||||||
|  |     BorderSpacing.Around = 6 | ||||||
|  |     Caption = 'y axes at data only' | ||||||
|  |     OnChange = CheckBox1Change | ||||||
|  |     TabOrder = 1 | ||||||
|  |   end | ||||||
|  |   object CheckBox2: TCheckBox | ||||||
|  |     AnchorSideLeft.Control = CheckBox1 | ||||||
|  |     AnchorSideLeft.Side = asrBottom | ||||||
|  |     AnchorSideTop.Control = CheckBox1 | ||||||
|  |     Left = 138 | ||||||
|  |     Height = 19 | ||||||
|  |     Top = 282 | ||||||
|  |     Width = 66 | ||||||
|  |     BorderSpacing.Left = 16 | ||||||
|  |     Caption = 'Grouped' | ||||||
|  |     OnChange = CheckBox2Change | ||||||
|  |     TabOrder = 2 | ||||||
|  |   end | ||||||
|  |   object ChartAxisTransformations1: TChartAxisTransformations | ||||||
|  |     left = 96 | ||||||
|  |     top = 112 | ||||||
|  |     object ChartAxisTransformations1AutoScaleAxisTransform1: TAutoScaleAxisTransform | ||||||
|  |     end | ||||||
|  |   end | ||||||
|  |   object ChartAxisTransformations2: TChartAxisTransformations | ||||||
|  |     left = 440 | ||||||
|  |     top = 112 | ||||||
|  |     object ChartAxisTransformations2AutoScaleAxisTransform1: TAutoScaleAxisTransform | ||||||
|  |       MaxValue = 2 | ||||||
|  |       MinValue = 1 | ||||||
|  |     end | ||||||
|  |   end | ||||||
|  |   object RandomChartSource1: TRandomChartSource | ||||||
|  |     PointsNumber = 10 | ||||||
|  |     RandSeed = 1004835833 | ||||||
|  |     XMax = 1 | ||||||
|  |     XMin = 0 | ||||||
|  |     YMax = 1 | ||||||
|  |     YMin = 0 | ||||||
|  |     left = 96 | ||||||
|  |     top = 176 | ||||||
|  |   end | ||||||
|  |   object RandomChartSource2: TRandomChartSource | ||||||
|  |     PointsNumber = 5 | ||||||
|  |     RandSeed = 1004914276 | ||||||
|  |     XMax = 1 | ||||||
|  |     XMin = 0 | ||||||
|  |     YMax = 1000 | ||||||
|  |     YMin = -1000 | ||||||
|  |     left = 440 | ||||||
|  |     top = 176 | ||||||
|  |   end | ||||||
|  | end | ||||||
							
								
								
									
										80
									
								
								components/tachart/demo/panes-3/unit1.pas
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										80
									
								
								components/tachart/demo/panes-3/unit1.pas
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,80 @@ | |||||||
|  | unit Unit1; | ||||||
|  | 
 | ||||||
|  | {$mode objfpc}{$H+} | ||||||
|  | 
 | ||||||
|  | interface | ||||||
|  | 
 | ||||||
|  | uses | ||||||
|  |   Classes, SysUtils, FileUtil, TAGraph, TATransformations, TASeries, TASources, | ||||||
|  |   Forms, Controls, Graphics, Dialogs, StdCtrls; | ||||||
|  | 
 | ||||||
|  | type | ||||||
|  | 
 | ||||||
|  |   { TForm1 } | ||||||
|  | 
 | ||||||
|  |   TForm1 = class(TForm) | ||||||
|  |     Chart1: TChart; | ||||||
|  |     Chart1LineSeries1: TLineSeries; | ||||||
|  |     Chart1LineSeries2: TLineSeries; | ||||||
|  |     ChartAxisTransformations1: TChartAxisTransformations; | ||||||
|  |     ChartAxisTransformations1AutoScaleAxisTransform1: TAutoScaleAxisTransform; | ||||||
|  |     ChartAxisTransformations2: TChartAxisTransformations; | ||||||
|  |     ChartAxisTransformations2AutoScaleAxisTransform1: TAutoScaleAxisTransform; | ||||||
|  |     CheckBox1: TCheckBox; | ||||||
|  |     CheckBox2: TCheckBox; | ||||||
|  |     RandomChartSource1: TRandomChartSource; | ||||||
|  |     RandomChartSource2: TRandomChartSource; | ||||||
|  |     procedure CheckBox1Change(Sender: TObject); | ||||||
|  |     procedure CheckBox2Change(Sender: TObject); | ||||||
|  |   private | ||||||
|  | 
 | ||||||
|  |   public | ||||||
|  | 
 | ||||||
|  |   end; | ||||||
|  | 
 | ||||||
|  | var | ||||||
|  |   Form1: TForm1; | ||||||
|  | 
 | ||||||
|  | implementation | ||||||
|  | 
 | ||||||
|  | {$R *.lfm} | ||||||
|  | 
 | ||||||
|  | uses | ||||||
|  |   TAChartAxis; | ||||||
|  | 
 | ||||||
|  | { TForm1 } | ||||||
|  | 
 | ||||||
|  | procedure TForm1.CheckBox1Change(Sender: TObject); | ||||||
|  | var | ||||||
|  |   leftAxis1, leftAxis2: TChartAxis; | ||||||
|  | begin | ||||||
|  |   leftAxis1 := Chart1.AxisList[0]; | ||||||
|  |   leftAxis2 := Chart1.AxisList[2]; | ||||||
|  | 
 | ||||||
|  |   leftAxis1.AtDataOnly := Checkbox1.Checked; | ||||||
|  |   leftAxis1.Marks.AtDataOnly := Checkbox1.Checked; | ||||||
|  |   leftAxis1.Title.PositionOnMarks := Checkbox1.Checked; | ||||||
|  | 
 | ||||||
|  |   leftAxis2.AtDataOnly := Checkbox1.Checked; | ||||||
|  |   leftAxis2.Marks.AtDataOnly := Checkbox1.Checked; | ||||||
|  |   leftAxis2.Title.PositionOnMarks := Checkbox1.Checked; | ||||||
|  | end; | ||||||
|  | 
 | ||||||
|  | procedure TForm1.CheckBox2Change(Sender: TObject); | ||||||
|  | var | ||||||
|  |   leftAxis1, leftAxis2: TChartAxis; | ||||||
|  | begin | ||||||
|  |   leftAxis1 := Chart1.AxisList[0]; | ||||||
|  |   leftAxis2 := Chart1.AxisList[2]; | ||||||
|  | 
 | ||||||
|  |   if Checkbox2.Checked then begin | ||||||
|  |     leftAxis1.Group := 1; | ||||||
|  |     leftAxis2.Group := 1; | ||||||
|  |   end else begin | ||||||
|  |     leftAxis1.Group := 0; | ||||||
|  |     leftAxis2.Group := 0; | ||||||
|  |   end; | ||||||
|  | end; | ||||||
|  | 
 | ||||||
|  | end. | ||||||
|  | 
 | ||||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 wp
						wp