PlotPanel/zh CN

From Lazarus wiki
Revision as of 07:56, 29 April 2014 by Wangyouworld (talk | contribs) (→‎PlotPanel/zh CN)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

Deutsch (de) English (en) español (es) français (fr) português (pt) 中文(中国大陆)‎ (zh_CN)

Plotpanel

目前,PlotPanel不在积极开发和维护,只提供兼容性。请考虑使用 TAChart 包中的相应功能


PlotPanel是Lazarusk中用来代替(或多或少)TChart的组件。 通过一些修改可以在Kylix、Delphi 5、6、7中使用。


PlotPanel可以画线、点和条形图。也可以做动画图形。


软件没有任何书面保证,所以使用时需要您自担风险。


屏幕截图

Plotpanel2.png

安装

在Lazarus中安装PlotPanel,你需要做到以下几点:

当你完成上面的操作后,palet组件会在组件工具栏“Extra(额外)”选项卡里。 现在,您可以使用Plotpanel了。


运行PlotPanelDemo 来探索PlotPanel新功能。N.B.你可以尝试在没有安装PlotPanel 组件的情况下,运行TryPlotPanel!

Plotpanel在Lazarus 0.9.28.x上有个问题

在我的网站上 (http://science4all.nl/?Programming:MICAM:Lazarus) 你可以找到更新的版本: PlotPanel-0.97

PlotPanel组件描述

这是一个欠佳的组件描述。示例将演示如何使用组件。 PlotPanel 组件来源于 TCustomPanel组件。 面板绘图功能被添加。

属性继承自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

添加以下属性

BackColor 绘图区域的背景颜色
GridColor 网格颜色,当和背景色相同时,会看不到网格
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 绘图区边框宽度(单位:像素)。
PlotMode 三种模式: pmBar, pmLine 和 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 标题在图的顶部居中位置,并使用Font属性
PlotBMP This is a bitmap holding the whole graph (see demo for its use)


x轴属性:

XLabel 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)


y轴的相同应用。

方法

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 automaticly

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 重绘整图(必要时由系统自动完成)


Marien van Westen