mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-19 18:59:10 +02:00
TAChart: Add "slice scaling" page to the "bgra" demo
git-svn-id: trunk@40080 -
This commit is contained in:
parent
96b4a2c072
commit
115f0340d0
@ -1,110 +1,331 @@
|
||||
object Form1: TForm1
|
||||
Left = 1036
|
||||
Height = 459
|
||||
Top = 154
|
||||
Width = 620
|
||||
Left = 402
|
||||
Height = 481
|
||||
Top = 136
|
||||
Width = 720
|
||||
Caption = 'Form1'
|
||||
ClientHeight = 459
|
||||
ClientWidth = 620
|
||||
ClientHeight = 481
|
||||
ClientWidth = 720
|
||||
OnCreate = FormCreate
|
||||
OnDestroy = FormDestroy
|
||||
Position = poScreenCenter
|
||||
LCLVersion = '1.1'
|
||||
object Chart1: TChart
|
||||
Left = 0
|
||||
Height = 425
|
||||
Top = 0
|
||||
Width = 308
|
||||
AntialiasingMode = amOff
|
||||
AxisList = <
|
||||
item
|
||||
Marks.LabelFont.Height = 13
|
||||
Marks.LabelFont.Orientation = 400
|
||||
Minors = <>
|
||||
Title.LabelFont.Orientation = 900
|
||||
end
|
||||
item
|
||||
Alignment = calBottom
|
||||
Marks.LabelFont.Height = 13
|
||||
Minors = <>
|
||||
end>
|
||||
BackColor = clMoneyGreen
|
||||
Foot.Brush.Color = clBtnFace
|
||||
Foot.Font.Color = clBlue
|
||||
Title.Brush.Color = clBtnFace
|
||||
Title.Brush.Style = bsClear
|
||||
Title.Font.Color = clBlue
|
||||
Title.Font.Height = -16
|
||||
Title.Text.Strings = (
|
||||
'Standard'
|
||||
)
|
||||
Title.Visible = True
|
||||
OnAfterPaint = Chart1AfterPaint
|
||||
Align = alLeft
|
||||
Color = clGreen
|
||||
ParentColor = False
|
||||
object Chart1LineSeries1: TLineSeries
|
||||
ZPosition = 10
|
||||
LinePen.Color = clMaroon
|
||||
LinePen.Style = psDot
|
||||
LinePen.Width = 8
|
||||
Source = RandomChartSource1
|
||||
end
|
||||
object Chart1BarSeries1: TBarSeries
|
||||
Transparency = 60
|
||||
BarBrush.Color = 3059701
|
||||
Source = RandomChartSource1
|
||||
end
|
||||
object Chart1PieSeries1: TPieSeries
|
||||
Transparency = 128
|
||||
Active = False
|
||||
Source = RandomChartSource1
|
||||
end
|
||||
object Chart1AreaSeries1: TAreaSeries
|
||||
ZPosition = 9
|
||||
AreaBrush.Color = clRed
|
||||
AreaBrush.Style = bsDiagCross
|
||||
Source = RandomChartSource1
|
||||
end
|
||||
end
|
||||
object PaintBox1: TPaintBox
|
||||
Left = 312
|
||||
Height = 425
|
||||
Top = 0
|
||||
Width = 308
|
||||
Align = alClient
|
||||
OnPaint = PaintBox1Paint
|
||||
end
|
||||
object Splitter1: TSplitter
|
||||
Left = 308
|
||||
Height = 425
|
||||
Left = 0
|
||||
Height = 481
|
||||
Top = 0
|
||||
Width = 4
|
||||
end
|
||||
object Panel1: TPanel
|
||||
Left = 0
|
||||
Height = 34
|
||||
Top = 425
|
||||
Width = 620
|
||||
Align = alBottom
|
||||
ClientHeight = 34
|
||||
ClientWidth = 620
|
||||
TabOrder = 2
|
||||
object cbAntialiasing: TCheckBox
|
||||
Left = 8
|
||||
Height = 17
|
||||
Top = 8
|
||||
Width = 74
|
||||
Caption = 'Antialiasing'
|
||||
OnChange = cbAntialiasingChange
|
||||
TabOrder = 0
|
||||
object PageControl1: TPageControl
|
||||
Left = 4
|
||||
Height = 481
|
||||
Top = 0
|
||||
Width = 716
|
||||
ActivePage = tsSimple
|
||||
Align = alClient
|
||||
TabIndex = 0
|
||||
TabOrder = 1
|
||||
object tsSimple: TTabSheet
|
||||
Caption = 'Simple'
|
||||
ClientHeight = 455
|
||||
ClientWidth = 708
|
||||
object Panel1: TPanel
|
||||
Left = 0
|
||||
Height = 34
|
||||
Top = 421
|
||||
Width = 708
|
||||
Align = alBottom
|
||||
ClientHeight = 34
|
||||
ClientWidth = 708
|
||||
TabOrder = 0
|
||||
object cbAntialiasing: TCheckBox
|
||||
Left = 8
|
||||
Height = 17
|
||||
Top = 8
|
||||
Width = 74
|
||||
Caption = 'Antialiasing'
|
||||
OnChange = cbAntialiasingChange
|
||||
TabOrder = 0
|
||||
end
|
||||
object cbPie: TCheckBox
|
||||
Left = 104
|
||||
Height = 17
|
||||
Top = 7
|
||||
Width = 34
|
||||
Caption = 'Pie'
|
||||
OnChange = cbPieChange
|
||||
TabOrder = 1
|
||||
end
|
||||
end
|
||||
object chSimple: TChart
|
||||
Left = 0
|
||||
Height = 421
|
||||
Top = 0
|
||||
Width = 354
|
||||
AntialiasingMode = amOff
|
||||
AxisList = <
|
||||
item
|
||||
Marks.LabelFont.Height = 13
|
||||
Marks.LabelFont.Orientation = 400
|
||||
Minors = <>
|
||||
Title.LabelFont.Orientation = 900
|
||||
end
|
||||
item
|
||||
Alignment = calBottom
|
||||
Marks.LabelFont.Height = 13
|
||||
Minors = <>
|
||||
end>
|
||||
BackColor = clMoneyGreen
|
||||
Foot.Brush.Color = clBtnFace
|
||||
Foot.Font.Color = clBlue
|
||||
Title.Brush.Color = clBtnFace
|
||||
Title.Brush.Style = bsClear
|
||||
Title.Font.Color = clBlue
|
||||
Title.Font.Height = -16
|
||||
Title.Text.Strings = (
|
||||
'Standard'
|
||||
)
|
||||
Title.Visible = True
|
||||
OnAfterPaint = chSimpleAfterPaint
|
||||
Align = alLeft
|
||||
Color = clGreen
|
||||
ParentColor = False
|
||||
object chSimpleLineSeries1: TLineSeries
|
||||
ZPosition = 10
|
||||
LinePen.Color = clMaroon
|
||||
LinePen.Style = psDot
|
||||
LinePen.Width = 8
|
||||
Source = RandomChartSource1
|
||||
end
|
||||
object chSimpleBarSeries1: TBarSeries
|
||||
Transparency = 60
|
||||
BarBrush.Color = 3059701
|
||||
Source = RandomChartSource1
|
||||
end
|
||||
object chSimplePieSeries1: TPieSeries
|
||||
Transparency = 128
|
||||
Active = False
|
||||
Source = RandomChartSource1
|
||||
end
|
||||
object chSimpleAreaSeries1: TAreaSeries
|
||||
ZPosition = 9
|
||||
AreaBrush.Color = clRed
|
||||
AreaBrush.Style = bsDiagCross
|
||||
Source = RandomChartSource1
|
||||
end
|
||||
end
|
||||
object PaintBox1: TPaintBox
|
||||
Left = 354
|
||||
Height = 421
|
||||
Top = 0
|
||||
Width = 354
|
||||
Align = alClient
|
||||
OnPaint = PaintBox1Paint
|
||||
end
|
||||
end
|
||||
object cbPie: TCheckBox
|
||||
Left = 104
|
||||
Height = 17
|
||||
Top = 7
|
||||
Width = 34
|
||||
Caption = 'Pie'
|
||||
OnChange = cbPieChange
|
||||
TabOrder = 1
|
||||
object tsSliceScaling: TTabSheet
|
||||
Caption = 'Slice scaling'
|
||||
ClientHeight = 455
|
||||
ClientWidth = 708
|
||||
object Panel2: TPanel
|
||||
Left = 586
|
||||
Height = 455
|
||||
Top = 0
|
||||
Width = 122
|
||||
Align = alRight
|
||||
ClientHeight = 455
|
||||
ClientWidth = 122
|
||||
TabOrder = 0
|
||||
object rgMethod: TRadioGroup
|
||||
Left = 1
|
||||
Height = 97
|
||||
Top = 1
|
||||
Width = 120
|
||||
Align = alTop
|
||||
AutoFill = True
|
||||
Caption = ' Method '
|
||||
ChildSizing.LeftRightSpacing = 6
|
||||
ChildSizing.TopBottomSpacing = 6
|
||||
ChildSizing.EnlargeHorizontal = crsHomogenousChildResize
|
||||
ChildSizing.EnlargeVertical = crsHomogenousChildResize
|
||||
ChildSizing.ShrinkHorizontal = crsScaleChilds
|
||||
ChildSizing.ShrinkVertical = crsScaleChilds
|
||||
ChildSizing.Layout = cclLeftToRightThenTopToBottom
|
||||
ChildSizing.ControlsPerLine = 1
|
||||
ClientHeight = 79
|
||||
ClientWidth = 116
|
||||
ItemIndex = 0
|
||||
Items.Strings = (
|
||||
'Grow'
|
||||
'Add'
|
||||
'Add then grow'
|
||||
)
|
||||
OnClick = rgMethodClick
|
||||
TabOrder = 0
|
||||
end
|
||||
object btnStartStop: TButton
|
||||
Left = 6
|
||||
Height = 25
|
||||
Top = 106
|
||||
Width = 75
|
||||
Caption = 'Start / stop'
|
||||
OnClick = btnStartStopClick
|
||||
TabOrder = 1
|
||||
end
|
||||
object lblSkipped: TLabel
|
||||
Left = 9
|
||||
Height = 1
|
||||
Top = 340
|
||||
Width = 1
|
||||
ParentColor = False
|
||||
end
|
||||
object Image1: TImage
|
||||
Left = 9
|
||||
Height = 148
|
||||
Top = 176
|
||||
Width = 61
|
||||
Picture.Data = {
|
||||
1754506F727461626C654E6574776F726B477261706869636D0C000089504E47
|
||||
0D0A1A0A0000000D494844520000007A0000012B080600000011FC970200000C
|
||||
3449444154789CED9BDD6F1CD519879F77776D2724C1490089508AD77C5541A5
|
||||
711042A288DA6E8B6855150CA8BD4014D652ABF68EE52F60F31F6CEE0A05692D
|
||||
A45E4445904A6D2F682BBB1555D5A6C2B9EAED5AAA2805DAD89010278E7D7A71
|
||||
66D88D598F77D7B3F3B1EFFB4823DBBBB373CECCB3E7FCCE39331614E1CE318E
|
||||
A30680509307594BB74646ECB8BFF2A2FB1B17DCDF71EE1CCEFD830BEE1C2FA6
|
||||
5DAFA490B42B3068DC5F98A64003A18CC0751B80D0042AF2004B69D531098656
|
||||
B47B97090A3480998E820BC1CFD6EB8B8C5291FB5849BCB2093074A2DD39C659
|
||||
A746816A5BABED4674F85E9D83D4E4AEE1CAEFA112EDFECC8B408D0287B775CF
|
||||
BD880658A5404DEEE77412F54E82A110EDFEC4348E06851D73B837D1ADBF9B14
|
||||
A9C8F1FCE777AE45BB7799608306D22187E311DDCA6FF29DDFB914EDDE619C12
|
||||
35242287E315ED37479DB17CE677EE44BBDFF30205EAC82E393C08D1FEBD5584
|
||||
AA7C8585019CDEC0C88D68F747A6D9A28E30D5879C384587DB324255EEC9477E
|
||||
675EB4FB031381E0B94871C98B0E5F7B9B2255B933DBF99D59D1EE1DC6D9A28A
|
||||
50EB4A5C7AA2C3DF6B403DABF99D49D1EE77BC806CCBE1EC8B6EE5F764F6F23B
|
||||
53A2DD6F99861D72381FA2C36D992255F97276F23B13A2DD6F98805D72385FA2
|
||||
FDE6789B51AA725BFAF99DAA68F70EE3AC7799C37914DD7AAFC601EA7234BDFC
|
||||
4E4DB43BDB630EE75B3410E4F7EDE9E477E2A2DDAF99668B1AC24CE2173B4DD1
|
||||
AD6D11A126C792CDEFC444BB3799A0400DA192FAC54EB3ECD67B0DF6519323C9
|
||||
E4F7C045BB338C53A48A5F973E9C898B9D66D9D7BFB78A506764F0F93D50D1EE
|
||||
57BC805F482867EA62A75976A7F7A049919ADC3CB8FC1E886877866924C8E12C
|
||||
5EEC34CB8E3ED622256A7224FEFC8E55B47B930936A851087238AB173BCDB2BB
|
||||
3B568342BCF91D8B68778671363BE470562F769A65777F2C9FDF87A98BEC3DBF
|
||||
F72CDAFD322287B37AB1D32CBBF763352950931BF796DF7D8B766F7002A14E21
|
||||
2287B37AB1D32CBBDF633916295195839CA70F7A16EDCE30CE3AF5AE7238AB17
|
||||
3BCDB2F77A2C6870886AAFDD7961F75D5AB8377899759A08955E3E67C48850E1
|
||||
224D7789977BFB5817B8059EC451FFFC71DAF093796D5569961DEF7934295195
|
||||
31CEB20B91A2DDEB9C081EC49B19AA8B9D66D983398F458A546574E7FCEE28DA
|
||||
BDC23825EAC8B61C1E968B9D66D9833D8F06A39DF3FB0B19ED5EE7654AFE3F0C
|
||||
B7BF67649E0A1B34DDC617F3FBF316ED7ED1450E0F4BAB4AB3ECA4CEC3D1A440
|
||||
554A3EBFC5FD9C13D0361FCE422587B9ECA4CF23C8EF12C232C63033C316CB3D
|
||||
CDA38D9CE1828DB0E14BF09BECF4092357386093CF250394AEDBA15DF86672F5
|
||||
32622214DC9ED301A50EBBFB9D4681AD6033B24D7B0BDEA167EE2C3AA418EC61
|
||||
C2B3CB355AAD3862C4152D9AE000A5E0E735AEEBF78D14D90436D85570C8EEA2
|
||||
430418C38BBEDA57D58C38D8A275FD3B64F14E742F3AA408DC806FDD1B3D7FDA
|
||||
E897B0815DC3B7E01E27C6BD8B0E190DB6ABD8087DD05C05AEB0A72970FFA209
|
||||
0ADD8FFFB65DC184C7CD35609DD6687A0FEC4D74481138C8F51533FA67137F1D
|
||||
37896D212B1ED12123F801DB9560337A231C68ADD3570E4711AFE890FDC03E7C
|
||||
856D84DE1DEBC067F43492EE85C18806FF6D3C88FF965EC277EBC617B98ABF3E
|
||||
8E814986418A6E2FE1307E2A7611CBEF904DFCF5D820F66EBA1383171D3286EF
|
||||
D22F0197D12B7C0BDF4587DD7442378A93131D7230D83E45DF80ED33FC794362
|
||||
824392170DFE248FE0BBAD4F19FE15B62BF8F30C57B552B8EF9F8EE89031FCE8
|
||||
FC32FE420CDB1DB26BF8F3BA4C22391C45BAA2430EE0D7CF2F311C03B62DBCE0
|
||||
8B0C7424DD0BD9100DFEDB3E0E1C023EC14BCF23178135BCEC0C3D9E951DD121
|
||||
25E066BCF035F23360BB8CAFEF55322538247BA243F6E1BBF3B08564F586C906
|
||||
B04AE2D3A55EC9AEE89043B4A6639F909D01DB26BE3EE17F3965547048F64583
|
||||
BF3B76149FE1FFC3B7F23459032EE0BF74196EC5EDE44374C808702BFE06C0C7
|
||||
247FC3641DF888D6430039101C922FD1213700657CD7F91183EFCE37810FF1F1
|
||||
919316BC9D7C8A0E19076EC40F863E1E50191FE1BBE9189EF248937C8B069FDF
|
||||
B7E0EF907D487CF9FD09F01F627DCA234DF22F3A6414B8033F9FFD80FEE7DF97
|
||||
F1823F2377391CC5F0880E3900DC8D1F19FF9BEEF37B33D87F95A168C1DB193E
|
||||
D12147F0DDF97FF12DB49DED123FA095F143263864784583CFEF5B819B80F7F1
|
||||
B9DBCE6AF07A9F0FC5E789E1161D320ADC891FA8BD8F5F74F917995FB68C1305
|
||||
A7D8C621E038F04FD25F5D4B185DA21563A29560A29560A29560A29560A29560
|
||||
A29560A29560A29560A29560A29560A29560A29560A29560A29560A29560A295
|
||||
60A29560A29560A29560A29560A29560A29560A29560A29560A29560A29560A2
|
||||
9560A29560A29560A29560A29560A29560A29560A29560A29560A29560A29560
|
||||
A29560A29560A29560A29560A29560A29560A29560A29560A29560A29560A295
|
||||
60A29560A29560A29560A29560A29560A29560A29560A29560A29560A29560A2
|
||||
9560A29560A29560A29560A29560A29560A29560A29560A29560A29560A29560
|
||||
A29560A29560A29560A29560A29560A29560A29560A29560A29560A29560A295
|
||||
60A29560A29560A29560A29560A29560A29560A29560A29560A29560A29560A2
|
||||
9560A29560A29560A29560A29560A29560A29560A29560A29560A29560A29560
|
||||
A29560A29560A29560A29560A29560A29560A29560A29560A29560A29560A295
|
||||
60A29560A29560A29560A29560A29560A29560A29560A29560A29560A29560A2
|
||||
9560A29560A29560A29560A29560A29560A29560A29560A29560A29560A29560
|
||||
A29560A29560A29560A29560A29560A29560A29560A29560A29560A29560A295
|
||||
60A29560A29560A29560A29560A29560A29560A29560A29560A29560A29560A2
|
||||
9560A29560A29560A29560A29560A29560A29560A29560A29560A29560A29560
|
||||
A29560A29560A29560A29560A29560A29560A29560A29560A29560A29560A295
|
||||
60A29560A29560A29560A29560A29560A29560A29560A29560A29560A29560A2
|
||||
9560A29560A29560A29560A29560A29550C0510556D3AE88313056816A417EC6
|
||||
691C651CF5B46B64C44E9D12652972BA00203F654D7EC24B38CAC062AA5533E2
|
||||
609131CA32CA4B22ACC1B68C961FB322F3CC22CCE068A65245A37F1C4D0ACCC8
|
||||
7E664558697FABE3604C9E67499E6712471567F99D035681AADCC8A4EC67A9D3
|
||||
0E91A36EF911A719B1FCCE348E3AE394659CD351BBED3ABD921FB226CFF21225
|
||||
CBEF8CB14891B2DCD4CAE128BA9E47CB33ACC80F82FCC6F23B457C0EDFC2AC1C
|
||||
B93E87A3E879C1449E66499E6612B1FC4E1417E4F03126E596CE391C45DF2B63
|
||||
F224A739401947A3DF63185DD3E00065B92D3A87A3D8D312A83CC69A3CC13C5B
|
||||
4C61F93D081629322577302F4777CFE1286259EB96EF735EBECB2C3067F3EF18
|
||||
F0F3E1399964566EE77C1C878CF5A6867C87B3F2389308356CFDBC1F56116A72
|
||||
2F9332C9D9380F3C90BB57F22D4EB145192CBF7BA0C10865B987538338F8C06E
|
||||
53CA63ACC92CF3142CBF776111C7941C675EEEDA5B0E4731F0FBD1F228E7E51B
|
||||
CC22CC61F3EF769A0873723FB3F2D57872388AC41E3C9047382B5F6712D4E7B7
|
||||
CFE12926E56BF1E67014893F61220F738AA2D2F9B7A381A32C270793C351A4F2
|
||||
28913CC89A3CC47CB09CBA98461D12661161461E625E1E1C5C0E4791EA3363F2
|
||||
004BF200B30895219D7F37112AF230B3F250EFCB967192898703E5040B1C620A
|
||||
A80DC5FAB9F339CC3EA6E46116D2AE0E64443480DCC59ADCCFA9603AD648BB3E
|
||||
7BA0C10853F228A7D2EAA63B9119D121721F2B729C798AB9CB6F9FC3B3CCCB23
|
||||
DDDF3E4C8ACC890E917B58927B83FCCEF6FCBB89A322DF6656BE996E0E479159
|
||||
D12172370B90C1FCF675A951644A1ECF460E47216957A017DCFB4C708D1A052A
|
||||
14F0B52F04DB4EBFB7FF1DFE7CADC36B3BEDDBE975A141919A7C2F7B5DF44E64
|
||||
BE45B723B7B1227704F9ED584EA10ACB0833F204F379920C39131D22C758922F
|
||||
7112A890CC72EA2A5091394ECA13D9CDE12872293A448EB1C00865FCFAF9A0A8
|
||||
B149599ECE7E0E4791AB8C8EC25D6002479D0273B16434BCCD185579265F5DF4
|
||||
4EE4BA45B723475891A33C15437E2F0333F22C4F0D8B641822D12172882539CC
|
||||
C960FDBCFBFCF6CB9615798E93F26C3E73388AA1131D220759E040D7F95DE306
|
||||
CAF25CBE73583DCE31E1AEF096DBC0B94D9C7B05E75EC5B9D778CBBDC644DAF5
|
||||
3362C66D30ED3679CFBDC27BEE55A6D3AE4F92FC1FB4C45EB54DA944FF000000
|
||||
0049454E44AE426082
|
||||
}
|
||||
Proportional = True
|
||||
Stretch = True
|
||||
Visible = False
|
||||
end
|
||||
end
|
||||
object chSliceScaling: TChart
|
||||
Left = 0
|
||||
Height = 455
|
||||
Top = 0
|
||||
Width = 586
|
||||
AxisList = <
|
||||
item
|
||||
Minors = <>
|
||||
Title.LabelFont.Orientation = 900
|
||||
end
|
||||
item
|
||||
Alignment = calBottom
|
||||
Minors = <>
|
||||
end>
|
||||
BackColor = clBlack
|
||||
Foot.Brush.Color = clBtnFace
|
||||
Foot.Font.Color = clBlue
|
||||
Margins.Top = 40
|
||||
Margins.Bottom = 0
|
||||
Title.Brush.Color = clBtnFace
|
||||
Title.Font.Color = clBlue
|
||||
Title.Text.Strings = (
|
||||
'TAChart'
|
||||
)
|
||||
Align = alClient
|
||||
DoubleBuffered = True
|
||||
ParentColor = False
|
||||
object chSliceScalingBarSeries1: TBarSeries
|
||||
BarBrush.Color = 2183646
|
||||
BarBrush.Style = bsClear
|
||||
BarPen.Style = psClear
|
||||
OnBeforeDrawBar = chSliceScalingBarSeries1BeforeDrawBar
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
object RandomChartSource1: TRandomChartSource
|
||||
@ -117,4 +338,17 @@ object Form1: TForm1
|
||||
left = 189
|
||||
top = 263
|
||||
end
|
||||
object ListChartSource1: TListChartSource
|
||||
DataPoints.Strings = (
|
||||
'1|2|?|'
|
||||
'2|3|?|'
|
||||
'3|5|?|'
|
||||
'4|6|?|'
|
||||
'5|9|?|'
|
||||
'6|7|?|'
|
||||
'7|8|?|'
|
||||
)
|
||||
left = 192
|
||||
top = 320
|
||||
end
|
||||
end
|
||||
|
@ -5,29 +5,57 @@ unit Main;
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, ExtCtrls, StdCtrls, SysUtils, FileUtil, Forms, Controls,
|
||||
Graphics, Dialogs, TAGraph, TASeries, TASources;
|
||||
Classes, ComCtrls, ExtCtrls, Spin, StdCtrls, SysUtils, FileUtil, Forms,
|
||||
Controls, Graphics, Dialogs,
|
||||
TAGraph, TASeries, TASources, TAAnimatedSource, TACustomSource,
|
||||
BGRASliceScaling;
|
||||
|
||||
type
|
||||
|
||||
{ TForm1 }
|
||||
|
||||
TForm1 = class(TForm)
|
||||
Chart1: TChart;
|
||||
Chart1AreaSeries1: TAreaSeries;
|
||||
Chart1BarSeries1: TBarSeries;
|
||||
Chart1LineSeries1: TLineSeries;
|
||||
Chart1PieSeries1: TPieSeries;
|
||||
btnStartStop: TButton;
|
||||
cbAntialiasing: TCheckBox;
|
||||
cbPie: TCheckBox;
|
||||
chSimple: TChart;
|
||||
chSimpleAreaSeries1: TAreaSeries;
|
||||
chSimpleBarSeries1: TBarSeries;
|
||||
chSimpleLineSeries1: TLineSeries;
|
||||
chSimplePieSeries1: TPieSeries;
|
||||
chSliceScaling: TChart;
|
||||
chSliceScalingBarSeries1: TBarSeries;
|
||||
Image1: TImage;
|
||||
lblSkipped: TLabel;
|
||||
ListChartSource1: TListChartSource;
|
||||
PageControl1: TPageControl;
|
||||
PaintBox1: TPaintBox;
|
||||
Panel1: TPanel;
|
||||
Panel2: TPanel;
|
||||
RandomChartSource1: TRandomChartSource;
|
||||
rgMethod: TRadioGroup;
|
||||
Splitter1: TSplitter;
|
||||
tsSimple: TTabSheet;
|
||||
tsSliceScaling: TTabSheet;
|
||||
procedure btnStartStopClick(Sender: TObject);
|
||||
procedure cbAntialiasingChange(Sender: TObject);
|
||||
procedure cbPieChange(Sender: TObject);
|
||||
procedure Chart1AfterPaint(ASender: TChart);
|
||||
procedure chSimpleAfterPaint(ASender: TChart);
|
||||
procedure chSliceScalingBarSeries1BeforeDrawBar(ASender: TBarSeries;
|
||||
ACanvas: TCanvas; const ARect: TRect; APointIndex, AStackIndex: Integer;
|
||||
var ADoDefaultDrawing: Boolean);
|
||||
procedure FormCreate(Sender: TObject);
|
||||
procedure FormDestroy(Sender: TObject);
|
||||
procedure PaintBox1Paint(Sender: TObject);
|
||||
procedure rgMethodClick(Sender: TObject);
|
||||
private
|
||||
FAnimatedSource: TCustomAnimatedChartSource;
|
||||
procedure OnGetItem(
|
||||
ASource: TCustomAnimatedChartSource;
|
||||
AIndex: Integer; var AItem: TChartDataItem);
|
||||
procedure OnStop(ASource: TCustomAnimatedChartSource);
|
||||
public
|
||||
sliceScaling: TBGRASliceScaling;
|
||||
end;
|
||||
|
||||
var
|
||||
@ -38,29 +66,75 @@ implementation
|
||||
{$R *.lfm}
|
||||
|
||||
uses
|
||||
BGRABitmap, TAChartUtils, TADrawerBGRA, TADrawerCanvas, TADrawUtils;
|
||||
Math, BGRABitmap, BGRABitmapTypes,
|
||||
TAChartUtils, TADrawerBGRA, TADrawerCanvas, TADrawUtils, TAGeometry;
|
||||
|
||||
{ TForm1 }
|
||||
|
||||
procedure TForm1.btnStartStopClick(Sender: TObject);
|
||||
begin
|
||||
if FAnimatedSource.IsAnimating then
|
||||
FAnimatedSource.Stop
|
||||
else
|
||||
FAnimatedSource.Start;
|
||||
end;
|
||||
|
||||
procedure TForm1.cbAntialiasingChange(Sender: TObject);
|
||||
begin
|
||||
if cbAntialiasing.Checked then
|
||||
Chart1.AntialiasingMode := amOn
|
||||
chSimple.AntialiasingMode := amOn
|
||||
else
|
||||
Chart1.AntialiasingMode := amOff;
|
||||
chSimple.AntialiasingMode := amOff;
|
||||
end;
|
||||
|
||||
procedure TForm1.cbPieChange(Sender: TObject);
|
||||
begin
|
||||
Chart1PieSeries1.Active := cbPie.Checked;
|
||||
chSimplePieSeries1.Active := cbPie.Checked;
|
||||
end;
|
||||
|
||||
procedure TForm1.Chart1AfterPaint(ASender: TChart);
|
||||
procedure TForm1.chSimpleAfterPaint(ASender: TChart);
|
||||
begin
|
||||
Unused(ASender);
|
||||
PaintBox1.Invalidate;
|
||||
end;
|
||||
|
||||
procedure TForm1.chSliceScalingBarSeries1BeforeDrawBar(ASender: TBarSeries;
|
||||
ACanvas: TCanvas; const ARect: TRect; APointIndex, AStackIndex: Integer;
|
||||
var ADoDefaultDrawing: Boolean);
|
||||
var
|
||||
temp: TBGRABitmap;
|
||||
sz: TPoint;
|
||||
begin
|
||||
sz := ARect.BottomRight - ARect.TopLeft;
|
||||
temp := TBGRABitmap.Create(
|
||||
sliceScaling.BitmapWidth, Round(sliceScaling.BitmapWidth * sz.Y / sz.X));
|
||||
try
|
||||
sliceScaling.Draw(temp, 0, 0, temp.Width, temp.Height);
|
||||
temp.Draw(ACanvas, ARect);
|
||||
finally
|
||||
temp.Free;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TForm1.FormCreate(Sender: TObject);
|
||||
begin
|
||||
FAnimatedSource := TCustomAnimatedChartSource.Create(Self);
|
||||
FAnimatedSource.Origin := ListChartSource1;
|
||||
FAnimatedSource.AnimationInterval := 30;
|
||||
FAnimatedSource.AnimationTime := 1000;
|
||||
FAnimatedSource.OnGetItem := @OnGetItem;
|
||||
FAnimatedSource.OnStop := @OnStop;
|
||||
chSliceScalingBarSeries1.Source := FAnimatedSource;
|
||||
|
||||
sliceScaling := TBGRASliceScaling.Create(Image1.Picture.Bitmap, 70, 0, 35, 0);
|
||||
sliceScaling.AutodetectRepeat;
|
||||
end;
|
||||
|
||||
procedure TForm1.FormDestroy(Sender: TObject);
|
||||
begin
|
||||
sliceScaling.Free;
|
||||
end;
|
||||
|
||||
procedure TForm1.PaintBox1Paint(Sender: TObject);
|
||||
var
|
||||
bmp: TBGRABitmap;
|
||||
@ -68,21 +142,48 @@ var
|
||||
rp: TChartRenderingParams;
|
||||
begin
|
||||
bmp := TBGRABitmap.Create(PaintBox1.Width, PaintBox1.Height);
|
||||
Chart1.DisableRedrawing;
|
||||
chSimple.DisableRedrawing;
|
||||
try
|
||||
Chart1.Title.Text.Text := 'BGRABitmap';
|
||||
chSimple.Title.Text.Text := 'BGRABitmap';
|
||||
id := TBGRABitmapDrawer.Create(bmp);
|
||||
id.DoGetFontOrientation := @CanvasGetFontOrientationFunc;
|
||||
rp := Chart1.RenderingParams;
|
||||
Chart1.Draw(id, Rect(0, 0, PaintBox1.Width, PaintBox1.Height));
|
||||
Chart1.RenderingParams := rp;
|
||||
rp := chSimple.RenderingParams;
|
||||
chSimple.Draw(id, Rect(0, 0, PaintBox1.Width, PaintBox1.Height));
|
||||
chSimple.RenderingParams := rp;
|
||||
bmp.Draw(PaintBox1.Canvas, 0, 0);
|
||||
Chart1.Title.Text.Text := 'Standard';
|
||||
chSimple.Title.Text.Text := 'Standard';
|
||||
finally
|
||||
Chart1.EnableRedrawing;
|
||||
chSimple.EnableRedrawing;
|
||||
bmp.Free;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TForm1.OnGetItem(
|
||||
ASource: TCustomAnimatedChartSource;
|
||||
AIndex: Integer; var AItem: TChartDataItem);
|
||||
begin
|
||||
case rgMethod.ItemIndex of
|
||||
0: AItem.Y *= ASource.Progress;
|
||||
1:
|
||||
if ASource.Count * ASource.Progress < AIndex then
|
||||
AItem.Y := 0;
|
||||
2:
|
||||
case Sign(Trunc(ASource.Count * ASource.Progress) - AIndex) of
|
||||
0: AItem.Y *= Frac(ASource.Count * ASource.Progress);
|
||||
-1: AItem.Y := 0;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TForm1.OnStop(ASource: TCustomAnimatedChartSource);
|
||||
begin
|
||||
lblSkipped.Caption := Format('Skipped frames: %d', [ASource.SkippedFramesCount]);
|
||||
end;
|
||||
|
||||
procedure TForm1.rgMethodClick(Sender: TObject);
|
||||
begin
|
||||
FAnimatedSource.Start;
|
||||
end;
|
||||
|
||||
end.
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user