⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 constantlinesandstripes.pas

📁 Delphi Component - Chart Fx
💻 PAS
字号:
unit ConstantLinesAndStripes;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls, OleCtrls, ChartfxLib_TLB;

type
  TForm1 = class(TForm)
    ChartFX1: TChartFX;
    Button1: TButton;
    Button2: TButton;
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.Button1Click(Sender: TObject);
begin
    {create 3 constant lines}
    ChartFX1.OpenDataEx(COD_CONSTANTS, 3, 0);

    With ChartFX1.ConstantLine[0] do
    begin
        Value := 70;
        Axis := AXIS_Y; {horizontal}
        Label_ := 'Average 2';
        {set the label of the constant line to be aligned to the right}
        Style := Style Or CC_RIGHTALIGNED;
        LineColor := RGB(255, 0, 0);
        LineStyle := CHART_DASH;
        LineWidth := 2;
    end;

    With ChartFX1.ConstantLine[1] do
    begin
        Value := 30;
        Axis := AXIS_Y; {horizontal}
        Label_ := 'Average 1';
        {set the label of the constant line to be aligned to the right}
        Style := Style Or CC_RIGHTALIGNED;
        LineColor := RGB(255, 0, 0);
        LineStyle := CHART_DASH;
        LineWidth := 2;
    end;
    With ChartFX1.ConstantLine[2] do
    begin
        Value := 5;
        Axis := AXIS_X; {vertical}
        Label_ := 'Check point';
        LineColor := RGB(0, 0, 255);
        LineStyle := CHART_DOT;
        LineWidth := 1;
    end;

    ChartFX1.CloseData(COD_CONSTANTS);

    {assign font properties for the text labels of the constant lines}
    ChartFX1.Fonts[CHART_FIXEDFT] := CF_BOLD Or CF_ARIAL Or 12;
    {assign text color for the labels of the constant lines}
    ChartFX1.RGBFont[CHART_FIXEDFT] := RGB(0, 128, 128);


end;

procedure TForm1.Button2Click(Sender: TObject);
begin
    ChartFX1.OpenDataEx(COD_STRIPES, 3, 0);

    { Create 3 color stripes }
    With ChartFX1.Stripe[0] do
    begin
        Axis := AXIS_X;   { vertical }
        From := 4.5;
        To_ := 5.5;
        Color := CHART_PALETTECOLOR Or 19;
    end;

    With ChartFX1.Stripe[1] do
    begin
        Axis := AXIS_Y;
        From := 10;
        To_ := 30;
        Color := CHART_PALETTECOLOR Or 2;
    end;

    With ChartFX1.Stripe[2] do
    begin
        Axis := AXIS_Y;
        From := 60;
        To_ := 90;
        Color := CHART_PALETTECOLOR Or 41;
    end;
    ChartFX1.CloseData(COD_STRIPES);


end;

end.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -