As you can see on the other pages, I am interested in Delphi and Linux.
So I was very pleased to find information on the Lazarus project: I started working on porting my Delphi programs to Lazarus and found out that it was very easy to port my Delphi 1 programs.
What I discovered very soon when trying to port my Delphi 5 programs was the lack of the Chart component. So I started programming a replacement for it.
The result was the PlotPanel component
Whit this component you can draw up to 8 plots in one diagram, it has auto scaling properties and has the ability to show animated plots. The TryPlotPanelDemo program allows you to try Plotpanel without installing the component This program gives you some hints for your own program ideas.
You can download this component (version 0.91) here:
There seems to be some problems with the LRS file in the Demo programs. Here is an updated version that should run on Lazarus 0.9.26
This version also allows you to place a label at the x and y axis
The licence is also changed to LGPL now.
A nice feature to change the Marks along X and Y axis was supplied by Jorge Solla. You can find those extentions in version 0.96:
Version 0.96 of Plotpanel does not work correct with Lazarus version0.9.28.x. Here an updated version:
N.B. version 0.97 was wrong, so it was not possible to install. Version 0.97.1 will install
Here is a short description of this component:
PlotPanel is a component for Delphi or Lazarus to replace (more or less) the TChart component.
With PlotPanel you can draw line- , dot- and bar-graphs. Animated graphs are also possible.
This software is presented as is, without any written warranty. So use the software at your own risk.
To Install the PlotPanel component in Delphi you have to do the following:
- Download the PlotPanel package (plotpanel_l.zip or one of the newer packages).
- Unzip plotpanel in a directory of your choice.
- Start Delphi or Lazarus
- Perform the necessary actions to install the package.
After you have done that all, there must be a new Tab in the component palet with the name "Extra". You can use the Plotpanel now
Run the PlotPanelDemo to explore the features of PlotPanel. N.B. You can try PlotPanel without installing the component by running TryPlotPanel!
Description of the PlotPanel component
This is a very rude description of the component. See the examples for an explanation of how to use the component. The PlotPanel component is derived from the TCustomPanel-component. To this Panel plotting capabilities are added.
Properties inherited from TCustomPanel
- Align, Anchors, Autosize, BevelInner / Outer / Width
- Borderspacing, BorderStyle, Borderwidth
- Color is the color of the border of the plot
- Constraints, Cursor, Dragmode, Enabled
- Font is the font of the title of the plot
- Height, HelpContext, HelpKeyword, HelpType, Hint
- Left, Name, ParenColor, Parentfont, ParentShowHint
- PopupMenu, ShowHint, TabOrder, TabStop
- Tag, Top, Visible, Width
The following properties are added
- BackColor This is the background color of the plotting area
- GridColor When you make this the same as Backcolor, the grid is invisible
- LayerOption For easy plotting of a single layer this can be set to False. It is not possible to set this to True directly (see methods)
- Margin The width of the border of the plot in pixels
- PlotMode Three plotmodes are possible: pmBar, pmLine and pmDot
- PlotPen Properties of the plotting pen. If LayerOption is False, then all sub-properties can be set. If LayerOption is True, then information about the plotting pen is transferred via the LayerOptions method (methods)
- Title The Title is at the top center of the plot and uses the Font property
- PlotBMP This is a bitmap holding the whole graph (see demo for its use)
The X-axis properties:
- XLabel Place a label at the x-axis
- XMarks When True, the X-axis has marks
- XMarksFont Font used for the XMarks
- XMarksInterval Interval between to lines in the grid (applies for linear scales only)
- XMax Maximum value of X that is visible
- XMin Minimal value of X that is visible
- XScaleLog When TRUE the scale is logarithmic (the interval is determined by the component)
For the Y-axis the same applies.
- AddXY(X,Y:Extended) With this method you can add points (or lines) to the plot Example for i:= -10 to 10 do PlotPanel1.AddXY(i,i*i) This plots a parbola .The line is plotted with the PlotPen properties Note you can only plot a single layer.
- AddXY(X,Y:Extended, Color:Tcolor,Layer:Integer) With this method it is possible to plot up to 8 lines in different colors, plotmodes and penwidths (see LayerOptions how to set linewidth and plotmodes)
- LayerOptions(Layer:Integer;PlotMode:TPlotMode;PenWidth:Integer) Every Layer can use a different Plotmode and PenWidth When you call this method LayerOPtion will be set TRUE. When you want to use a single Layer again you have to set LayerOption False! Autoscale(Layer:Integer) With this method you can adjust the size of the plot automatically
- ClearData Clears the data on the plot.
- ConvertS2W(x,y: Extended; var WX,WY : Extended) Converts the screen-coordinates in X,Y to the real coordinates WX,WY. When X and Y are out of bounds, the function returns False, otherwise True
- Freeze(Boolean) When Freeze(True) is executed all plotting is done on a invisible bitmap. After a Freeze(False) the whole plot is displayed. This produces flicker-free animations.
- HideLayer(Layer:Integer) Use this to hide a single layer in the plot
- UnHideLayer(Layer:Integer) Shows the hidden layer again N.B. When you add points to a hidden layer, the old layer is deleted and the new points are the only points in this layer!
- Paint Repaints the whole Graph (is done automatically by the system when necessary)
To encourage other people to use Lazarus I have converted some programs from Delphi to Lazarus. You have to compile the programs yourself. All source code is free under terms of the GPL
See a description of these programs elsewhere on this site
A simple game, but teasing when you don't know how to solve it
Educational program to demonstrate how light is focussed by a lens
Demonstration af additive color mixing
Calculation of frequency, capacitance and inductance in series or parallel resonance circuits
Make Me Small
The programs compiled with the current version of Lazarus tend to be big. With this program you can reduce the size by a factor of 10 to 20!
Most programs have an educational purpose, but some are usefull for serious applications.
You can use this software under the terms of the GPL.