300分求助关于chart控件的用法!!!(300分)

  • 主题发起人 主题发起人 Fermi
  • 开始时间 开始时间
F

Fermi

Unregistered / Unconfirmed
GUEST, unregistred user!
用chart画曲线,数据的值均在0-0.3之间,用默认设置坐标轴只能最小表示到0.1,0.2,0.3。现在想
增加坐标轴标尺的有效位数,精确到0.01或更小。尝试过改变chart->axis中的Desired Increment
可是也只能精确到0.1。各位有什么办法,请教了!
 
Delphi中的相关帮助:
========================================
Increment Property
See also Example
Applies to
TChartAxis component
Declaration
property Increment : Double;
Description
Axis Increment is the minimum step between axis labels. It must be a positive number or DateTime value.
TChart will use this value as the starting axis labels step. If there is not enough space for all labels,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TChart will calculate a bigger one. You can use the DateTimeStep constant array for DateTime increments.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
==================================================================
请注意帮助中加~~~~~部分,也就是说,设置了Increment(如设为0.01)后,TChart必须有足够的空间来显示在Minimum
和Maximum之间的数据,即你只要把TChart高度或宽度变大就可以了
下面是我试验的例子你可以看看:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, TeEngine, Series, ExtCtrls, TeeProcs, Chart;
type
TForm1 = class(TForm)
Chart1: TChart;
Button1: TButton;
Series1: TLineSeries;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
begin
Series1.AddY(0.06,'a');
Series1.AddY(0.19,'b');
Series1.AddY(0.20,'c');
Series1.AddY(0.03,'d');
end;
end.

object Form1: TForm1
Left = -4
Top = -4
Width = 808
Height = 608
Caption = 'Form1'
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = []
OldCreateOrder = False
PixelsPerInch = 96
TextHeight = 13
object Chart1: TChart
Left = 16
Top = 16
Width = 400
Height = 529
BackWall.Brush.Color = clWhite
BackWall.Brush.Style = bsClear
Title.Text.Strings = (
'TChart')
LeftAxis.Automatic = False
LeftAxis.AutomaticMaximum = False
LeftAxis.AutomaticMinimum = False
LeftAxis.ExactDateTime = False
LeftAxis.Increment = 0.01
LeftAxis.LabelsSeparation = 1
LeftAxis.Maximum = 0.3
TabOrder = 0
object Series1: TLineSeries
Marks.ArrowLength = 8
Marks.Visible = False
SeriesColor = clRed
Pointer.InflateMargins = True
Pointer.Style = psRectangle
Pointer.Visible = False
XValues.DateTime = False
XValues.Name = 'X'
XValues.Multiplier = 1
XValues.Order = loAscending
YValues.DateTime = False
YValues.Name = 'Y'
YValues.Multiplier = 1
YValues.Order = loNone
end
end
object Button1: TButton
Left = 432
Top = 24
Width = 75
Height = 25
Caption = 'Button1'
TabOrder = 1
OnClick = Button1Click
end
end
 
在chart的坐标轴的label里有个format的属性,看看。
 
多人接受答案了。
 
后退
顶部