You've already forked lazarus-ccr
jvcllaz: Fix axis title positioning in TJvChart. Some more setters for TJvChart properties.
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@7177 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -58,6 +58,7 @@
|
||||
<Filename Value="jvpeneditor.pas"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<ComponentName Value="PenEditorForm"/>
|
||||
<HasResources Value="True"/>
|
||||
<ResourceBaseClass Value="Form"/>
|
||||
<UnitName Value="jvPenEditor"/>
|
||||
</Unit>
|
||||
|
@ -431,6 +431,10 @@ object JvChartDemoForm: TJvChartDemoForm
|
||||
object MenuItem2: TMenuItem
|
||||
Caption = '-'
|
||||
end
|
||||
object mnuSetTitle: TMenuItem
|
||||
Caption = 'Set Title...'
|
||||
OnClick = mnuSetTitleClick
|
||||
end
|
||||
object mnuSetXAxisHeader: TMenuItem
|
||||
Caption = 'Set X Axis Header...'
|
||||
OnClick = mnuSetXAxisHeaderClick
|
||||
@ -439,10 +443,6 @@ object JvChartDemoForm: TJvChartDemoForm
|
||||
Caption = 'Set Y Axis Header...'
|
||||
OnClick = mnuSetYAxisHeaderClick
|
||||
end
|
||||
object mnuSetMarkerSize: TMenuItem
|
||||
Caption = 'Set Marker Size...'
|
||||
OnClick = mnuSetMarkerSizeClick
|
||||
end
|
||||
object MenuItem3: TMenuItem
|
||||
Caption = '-'
|
||||
end
|
||||
@ -503,6 +503,33 @@ object JvChartDemoForm: TJvChartDemoForm
|
||||
Caption = 'Pens...'
|
||||
OnClick = mnuPensClick
|
||||
end
|
||||
object mnuSetMarkerSize: TMenuItem
|
||||
Caption = 'Marker Size...'
|
||||
OnClick = mnuSetMarkerSizeClick
|
||||
end
|
||||
object mnuFillUnderLine: TMenuItem
|
||||
Caption = 'Fill under line'
|
||||
OnClick = mnuFillUnderLineClick
|
||||
end
|
||||
object mnuLegend: TMenuItem
|
||||
Caption = 'Legend'
|
||||
object mnuLegendNone: TMenuItem
|
||||
Caption = 'None'
|
||||
GroupIndex = 113
|
||||
OnClick = mnuLegenClick
|
||||
end
|
||||
object mnuLegendRight: TMenuItem
|
||||
Caption = 'Right'
|
||||
GroupIndex = 113
|
||||
OnClick = mnuLegenClick
|
||||
end
|
||||
object mnuLegendBelow: TMenuItem
|
||||
Caption = 'Below'
|
||||
Checked = True
|
||||
GroupIndex = 113
|
||||
OnClick = mnuLegenClick
|
||||
end
|
||||
end
|
||||
object mnuSetXStartOffset: TMenuItem
|
||||
Caption = 'X Start Offset...'
|
||||
OnClick = mnuSetXStartOffsetClick
|
||||
|
@ -46,6 +46,12 @@ type
|
||||
{ TJvChartDemoForm }
|
||||
|
||||
TJvChartDemoForm = class(TForm)
|
||||
mnuSetTitle: TMenuItem;
|
||||
mnuFillUnderLine: TMenuItem;
|
||||
mnuLegendNone: TMenuItem;
|
||||
mnuLegendRight: TMenuItem;
|
||||
mnuLegendBelow: TMenuItem;
|
||||
mnuLegend: TMenuItem;
|
||||
mnuSetXStartOffset: TMenuItem;
|
||||
mnuSetPenLineWidth: TMenuItem;
|
||||
mnuSetAxisLineWidth: TMenuItem;
|
||||
@ -112,10 +118,13 @@ type
|
||||
procedure ButtonBarChartClick(Sender: TObject);
|
||||
procedure ButtonStackedBarAveClick(Sender: TObject);
|
||||
procedure ButtonStackedBarClick(Sender: TObject);
|
||||
procedure mnuFillUnderLineClick(Sender: TObject);
|
||||
procedure mnuLegenClick(Sender: TObject);
|
||||
procedure mnuSetAxisLineWidthClick(Sender: TObject);
|
||||
procedure mnuSetCursorColorClick(Sender: TObject);
|
||||
procedure mnuSetHintColorClick(Sender: TObject);
|
||||
procedure mnuSetPenLineWidthClick(Sender: TObject);
|
||||
procedure mnuSetTitleClick(Sender: TObject);
|
||||
procedure mnuSetXStartOffsetClick(Sender: TObject);
|
||||
procedure SpeedButton7Click(Sender: TObject);
|
||||
procedure ButtonBarAveClick(Sender: TObject);
|
||||
@ -490,7 +499,7 @@ begin
|
||||
PenUnit.Add('%'); // Optional Pen in percentage scale.
|
||||
|
||||
//ShowLegend := TRUE;
|
||||
Legend := clChartLegendBelow;
|
||||
// Legend := clChartLegendBelow;
|
||||
|
||||
//ChartKind := ckChartLine;
|
||||
end;
|
||||
@ -651,16 +660,6 @@ begin
|
||||
if (mnu <> nil) and (mnu.Tag >= TAG_PENCOLORS) and (mnu.tag < TAG_PENCOLORS + MAX_PEN) then
|
||||
mnuPens.Delete(i);
|
||||
end;
|
||||
(*
|
||||
for i:=0 to Chart.Options.PenCount - 1do
|
||||
begin
|
||||
mnu := TMenuItem.Create(mnuPens);
|
||||
mnu.Caption := 'Set Pen ' + IntToStr(i + 1);
|
||||
mnu.Tag := TAG_PENCOLORS + i;
|
||||
mnu.OnClick := @mnuSetPen;
|
||||
mnuPens.Add(mnu);
|
||||
end;
|
||||
*)
|
||||
end;
|
||||
|
||||
procedure TJvChartDemoForm.mnuSetAxisFontClick(Sender: TObject);
|
||||
@ -790,6 +789,14 @@ begin
|
||||
Chart.Options.ShadowColor := ColorDialog1.Color;
|
||||
end;
|
||||
|
||||
procedure TJvChartDemoForm.mnuSetTitleClick(Sender: TObject);
|
||||
var
|
||||
s: String;
|
||||
begin
|
||||
s := InputBox('Set Chart Title', 'Text:', Chart.Options.Title);
|
||||
Chart.Options.Title := s;
|
||||
end;
|
||||
|
||||
procedure TJvChartDemoForm.mnuSetXAxisHeaderClick(Sender: TObject);
|
||||
var
|
||||
s: String;
|
||||
@ -895,6 +902,25 @@ begin
|
||||
NewValues;
|
||||
end;
|
||||
|
||||
procedure TJvChartDemoForm.mnuFillUnderLineClick(Sender: TObject);
|
||||
begin
|
||||
mnuFillUnderLine.Checked := not mnuFillUnderLine.Checked;
|
||||
Chart.Options.FillUnderLine := mnuFillUnderLine.Checked;
|
||||
end;
|
||||
|
||||
procedure TJvChartDemoForm.mnuLegenClick(Sender: TObject);
|
||||
begin
|
||||
mnuLegendNone.Checked := (Sender = mnuLegendNone);
|
||||
mnuLegendBelow.Checked := (Sender = mnuLegendBelow);
|
||||
mnuLegendRight.Checked := (Sender = mnuLegendRight);
|
||||
if mnuLegendNone.Checked then
|
||||
Chart.Options.Legend := clChartLegendNone
|
||||
else if mnuLegendRight.Checked then
|
||||
Chart.Options.Legend := clChartLegendRight
|
||||
else if mnuLegendBelow.Checked then
|
||||
Chart.Options.Legend := clChartLegendBelow;
|
||||
end;
|
||||
|
||||
procedure TJvChartDemoForm.mnuPensClick(Sender: TObject);
|
||||
var
|
||||
F: TPenEditorForm;
|
||||
|
@ -10,9 +10,9 @@ object PenEditorForm: TPenEditorForm
|
||||
OnDestroy = FormDestroy
|
||||
LCLVersion = '2.1.0.0'
|
||||
object btnPenColor: TButton
|
||||
Left = 224
|
||||
Left = 232
|
||||
Height = 25
|
||||
Top = 128
|
||||
Top = 216
|
||||
Width = 64
|
||||
AutoSize = True
|
||||
Caption = 'Color...'
|
||||
@ -21,9 +21,9 @@ object PenEditorForm: TPenEditorForm
|
||||
end
|
||||
object rgPenStyle: TRadioGroup
|
||||
Left = 224
|
||||
Height = 80
|
||||
Height = 160
|
||||
Top = 40
|
||||
Width = 265
|
||||
Width = 121
|
||||
AutoFill = True
|
||||
Caption = 'Style'
|
||||
ChildSizing.LeftRightSpacing = 6
|
||||
@ -32,10 +32,9 @@ object PenEditorForm: TPenEditorForm
|
||||
ChildSizing.ShrinkHorizontal = crsScaleChilds
|
||||
ChildSizing.ShrinkVertical = crsScaleChilds
|
||||
ChildSizing.Layout = cclLeftToRightThenTopToBottom
|
||||
ChildSizing.ControlsPerLine = 3
|
||||
ClientHeight = 60
|
||||
ClientWidth = 261
|
||||
Columns = 3
|
||||
ChildSizing.ControlsPerLine = 1
|
||||
ClientHeight = 140
|
||||
ClientWidth = 117
|
||||
Items.Strings = (
|
||||
'Solid'
|
||||
'Dash'
|
||||
@ -123,9 +122,35 @@ object PenEditorForm: TPenEditorForm
|
||||
object ColorSample: TShape
|
||||
Left = 304
|
||||
Height = 25
|
||||
Top = 128
|
||||
Top = 216
|
||||
Width = 25
|
||||
end
|
||||
object rgMarker: TRadioGroup
|
||||
Left = 376
|
||||
Height = 160
|
||||
Top = 40
|
||||
Width = 112
|
||||
AutoFill = True
|
||||
Caption = 'Marker'
|
||||
ChildSizing.LeftRightSpacing = 6
|
||||
ChildSizing.EnlargeHorizontal = crsHomogenousChildResize
|
||||
ChildSizing.EnlargeVertical = crsHomogenousChildResize
|
||||
ChildSizing.ShrinkHorizontal = crsScaleChilds
|
||||
ChildSizing.ShrinkVertical = crsScaleChilds
|
||||
ChildSizing.Layout = cclLeftToRightThenTopToBottom
|
||||
ChildSizing.ControlsPerLine = 1
|
||||
ClientHeight = 140
|
||||
ClientWidth = 108
|
||||
Items.Strings = (
|
||||
'None'
|
||||
'Diamond'
|
||||
'Circle'
|
||||
'Square'
|
||||
'Cross'
|
||||
)
|
||||
OnClick = rgMarkerClick
|
||||
TabOrder = 8
|
||||
end
|
||||
object ColorDialog: TColorDialog
|
||||
Color = clBlack
|
||||
CustomColors.Strings = (
|
||||
@ -150,7 +175,7 @@ object PenEditorForm: TPenEditorForm
|
||||
'ColorS=F0FBFF'
|
||||
'ColorT=A4A0A0'
|
||||
)
|
||||
left = 243
|
||||
top = 168
|
||||
left = 144
|
||||
top = 88
|
||||
end
|
||||
end
|
||||
|
@ -14,6 +14,7 @@ type
|
||||
Legend: String;
|
||||
Color: TColor;
|
||||
Style: TPenStyle;
|
||||
Marker: TJvChartPenMarkerKind;
|
||||
end;
|
||||
|
||||
{ TPenEditorForm }
|
||||
@ -28,6 +29,7 @@ type
|
||||
edPenLegend: TEdit;
|
||||
lblLegend: TLabel;
|
||||
lbPens: TListBox;
|
||||
rgMarker: TRadioGroup;
|
||||
rgPenStyle: TRadioGroup;
|
||||
ColorSample: TShape;
|
||||
procedure btnAddClick(Sender: TObject);
|
||||
@ -40,6 +42,7 @@ type
|
||||
procedure lbPensDrawItem(Control: TWinControl; Index: Integer;
|
||||
ARect: TRect; State: TOwnerDrawState);
|
||||
procedure lbPensSelectionChange(Sender: TObject; User: boolean);
|
||||
procedure rgMarkerClick(Sender: TObject);
|
||||
procedure rgPenStyleClick(Sender: TObject);
|
||||
private
|
||||
FPens: TObjectList;
|
||||
@ -78,6 +81,7 @@ begin
|
||||
AChart.Options.PenLegends.Add(pen.Legend);
|
||||
AChart.Options.PenColor[i] := pen.Color;
|
||||
AChart.Options.PenStyle[i] := pen.Style;
|
||||
AChart.Options.PenMarkerKind[i] := pen.Marker;
|
||||
end;
|
||||
end;
|
||||
|
||||
@ -89,6 +93,7 @@ begin
|
||||
pen.Legend := '';
|
||||
pen.Style := psSolid;
|
||||
pen.Color := clBlack;
|
||||
pen.Marker := pmkNone;
|
||||
FPens.Add(pen);
|
||||
lbPens.Items.Add('');
|
||||
end;
|
||||
@ -134,6 +139,7 @@ begin
|
||||
pen.Style := psClear
|
||||
else
|
||||
pen.Style := TPenStyle(rgPenStyle.ItemIndex);
|
||||
pen.Marker := TJvChartPenMarkerKind(rgMarker.ItemIndex);
|
||||
pen.Color := ColorSample.Brush.Color;
|
||||
end;
|
||||
|
||||
@ -171,9 +177,12 @@ procedure TPenEditorForm.lbPensDrawItem(Control: TWinControl; Index: Integer;
|
||||
var
|
||||
R: TRect;
|
||||
pen: TPenObj;
|
||||
x, y, dx, dy: Integer;
|
||||
begin
|
||||
pen := TPenObj(FPens[Index]);
|
||||
lbPens.Canvas.Font.Assign(lbPens.Font);
|
||||
|
||||
// Background
|
||||
if [odSelected, odFocused] * State <> [] then
|
||||
begin
|
||||
lbPens.Canvas.Brush.Color := clHighlight;
|
||||
@ -184,13 +193,52 @@ begin
|
||||
lbPens.Canvas.Font.Color := lbPens.Font.Color;
|
||||
end;
|
||||
lbPens.Canvas.FillRect(ARect);
|
||||
|
||||
// Line
|
||||
R := ARect;
|
||||
R.Right := R.Left + 50;
|
||||
InflateRect(R, -2, 0);
|
||||
InflateRect(R, -2, -2);
|
||||
lbPens.Canvas.Pen.Style := pen.Style;
|
||||
lbPens.Canvas.Pen.Color := pen.Color;
|
||||
lbPens.Canvas.Line(R.Left, (R.Top + R.Bottom) div 2, R.Right, (R.Top + R.Bottom) div 2);
|
||||
|
||||
// Marker
|
||||
x := (R.Left + R.Right) div 2;
|
||||
y := (R.Top + R.Bottom) div 2;
|
||||
dx := (R.Bottom - R.Top) div 2;
|
||||
dy := dx;
|
||||
lbPens.Canvas.Pen.Style := psSolid;
|
||||
case pen.Marker of
|
||||
pmkNone: ;
|
||||
pmkDiamond:
|
||||
begin
|
||||
lbPens.Canvas.Brush.Color := pen.Color;
|
||||
lbPens.Canvas.Brush.Style := bsSolid;
|
||||
lbPens.Canvas.Polygon([Point(x, y-dy), Point(x-dx, y), Point(x, y+dy), Point(x+dx, y)]);
|
||||
end;
|
||||
pmkCircle:
|
||||
begin
|
||||
lbPens.Canvas.Brush.Style := bsClear;
|
||||
lbPens.Canvas.Ellipse(x-dx, y-dy, x+dx, y+dy);
|
||||
end;
|
||||
pmkSquare:
|
||||
begin
|
||||
lbPens.Canvas.Brush.Style := bsClear;
|
||||
lbPens.Canvas.Rectangle(x-dx, y-dy, x+dx, y+dy);
|
||||
end;
|
||||
pmkCross:
|
||||
begin
|
||||
lbPens.Canvas.Line(x-dx, y, x+dx, y);
|
||||
lbPens.Canvas.Line(x, y-dy, x, y+dy);
|
||||
end;
|
||||
else
|
||||
raise Exception.Create('Marker style not supported.');
|
||||
end;
|
||||
|
||||
// Text
|
||||
lbPens.Canvas.TextOut(R.Right + 2, (R.Top + R.Bottom - lbPens.Canvas.TextHeight('Rg')) div 2, pen.Legend);
|
||||
|
||||
// Focus rect
|
||||
if odFocused in State then
|
||||
lbPens.Canvas.DrawFocusRect(ARect);
|
||||
end;
|
||||
@ -213,14 +261,27 @@ begin
|
||||
rgPenStyle.ItemIndex := rgPenStyle.Items.Count-1
|
||||
else
|
||||
rgPenStyle.ItemIndex := ord(pen.Style);
|
||||
rgMarker.ItemIndex := ord(pen.Marker);
|
||||
ColorSample.Brush.Color := pen.Color;
|
||||
|
||||
edPenLegend.Enabled := true;
|
||||
rgPenStyle.Enabled := true;
|
||||
rgMarker.Enabled := true;
|
||||
btnPenColor.Enabled := true;
|
||||
ColorSample.Visible := true;
|
||||
end;
|
||||
|
||||
procedure TPenEditorForm.rgMarkerClick(Sender: TObject);
|
||||
var
|
||||
pen: TPenObj;
|
||||
begin
|
||||
pen := GetCurrentPen;
|
||||
if pen = nil then
|
||||
exit;
|
||||
pen.Marker := TJvChartPenMarkerKind(rgMarker.ItemIndex);
|
||||
lbPens.Invalidate;
|
||||
end;
|
||||
|
||||
procedure TPenEditorForm.rgPenStyleClick(Sender: TObject);
|
||||
var
|
||||
pen: TPenObj;
|
||||
@ -251,12 +312,14 @@ begin
|
||||
pen.Legend := AChart.Options.PenLegends[i];
|
||||
pen.Color := AChart.Options.PenColor[i];
|
||||
pen.Style := AChart.Options.PenStyle[i];
|
||||
pen.Marker := AChart.Options.PenMarkerKind[i];
|
||||
FPens.Add(pen);
|
||||
lbPens.Items.Add('');
|
||||
end;
|
||||
|
||||
edPenLegend.Enabled := false;
|
||||
rgpenStyle.Enabled := false;
|
||||
rgPenStyle.Enabled := false;
|
||||
rgMarker.Enabled := false;
|
||||
btnPenColor.Enabled := false;
|
||||
ColorSample.Visible := false;
|
||||
end;
|
||||
|
@ -87,6 +87,10 @@ Last Modified:
|
||||
You may retrieve the latest version of this file at the Project JEDI's JVCL home page,
|
||||
located at http://jvcl.delphi-jedi.org
|
||||
|
||||
To do:
|
||||
- Drawing of legend at right (clChartLegendRight) not implemented
|
||||
- Print-out used screen coordinates
|
||||
|
||||
-----------------------------------------------------------------------------}
|
||||
// $Id$
|
||||
|
||||
@ -428,7 +432,6 @@ type
|
||||
function GetPenColor(Index: Integer): TColor;
|
||||
function GetPenStyle(Index: Integer): TPenStyle;
|
||||
function GetPenMarkerKind(Index: Integer): TJvChartPenMarkerKind;
|
||||
procedure SetPenMarkerKind(Index: Integer; AMarkKind: TJvChartPenMarkerKind);
|
||||
function GetPenSecondaryAxisFlag(Index: Integer): Boolean;
|
||||
procedure SetPenSecondaryAxisFlag(Index: Integer; NewValue: Boolean);
|
||||
function GetPenValueLabels(Index: Integer): Boolean;
|
||||
@ -452,14 +455,18 @@ type
|
||||
procedure SetAxisTitleFont(const Value: TFont);
|
||||
procedure SetChartKind(AKind: TJvChartKind);
|
||||
procedure SetDivisionLineColor(const AColor: TColor);
|
||||
procedure SetFillUnderline(const AValue: Boolean);
|
||||
procedure SetLegend(const ALegend: TJvChartLegend);
|
||||
procedure SetMarkerSize(const Value: Integer);
|
||||
procedure SetPaperColor(const AColor: TColor);
|
||||
procedure SetPenColor(Index: Integer; AColor: TColor);
|
||||
procedure SetPenCount(Count: Integer);
|
||||
procedure SetPenLegends(Value: TStrings);
|
||||
procedure SetPenLineWidth(const Value: Integer);
|
||||
procedure SetPenMarkerKind(Index: Integer; AMarkKind: TJvChartPenMarkerKind);
|
||||
procedure SetPenStyle(Index: Integer; APenStyle: TPenStyle);
|
||||
procedure SetShadowColor(const AColor: TColor);
|
||||
procedure SetTitle(const Value: String);
|
||||
procedure SetXAxisDateTimeDivision(const Value: Double);
|
||||
procedure SetXAxisHeader(const Value: String);
|
||||
procedure SetXStartOffset(Offset: Integer);
|
||||
@ -578,7 +585,7 @@ type
|
||||
property PenLegends: TStrings read GetPenLegends write SetPenLegends;
|
||||
property PenUnit: TStrings read GetPenUnit write SetPenUnit;
|
||||
property ChartKind: TJvChartKind read FChartKind write SetChartKind default ckChartLine;
|
||||
property Title: string read FTitle write FTitle;
|
||||
property Title: string read FTitle write SetTitle;
|
||||
property NoDataMessage: string read FNoDataMessage write FNoDataMessage;
|
||||
//NEW! NOV 2004. Optionally display this instead of fixed resource string rsNoData
|
||||
|
||||
@ -615,7 +622,7 @@ type
|
||||
{ Y Range }
|
||||
{ plotting markers }
|
||||
property MarkerSize: Integer read FMarkerSize write SetMarkerSize default JvChartDefaultMarkerSize;
|
||||
property FillUnderLine : Boolean read FFillUnderLine write FFillUnderLine default False;
|
||||
property FillUnderLine : Boolean read FFillUnderLine write SetFillUnderLine default False;
|
||||
{ !! New: Primary (left side) Y axis, and Secondary (right side) Y Axis !!}
|
||||
property PrimaryYAxis: TJvChartYAxisOptions read FPrimaryYAxis write SetPrimaryYAxis;
|
||||
property SecondaryYAxis: TJvChartYAxisOptions read FSecondaryYAxis write SetSecondaryYAxis;
|
||||
@ -629,7 +636,7 @@ type
|
||||
property MouseInfo: Boolean read FMouseInfo write FMouseInfo default True;
|
||||
//OLD:property ShowLegend: Boolean read FShowLegend write FShowLegend default True;
|
||||
//CHANGEDTO:
|
||||
property Legend: TJvChartLegend read FLegend write FLegend default clChartLegendNone;
|
||||
property Legend: TJvChartLegend read FLegend write SetLegend default clChartLegendNone;
|
||||
property LegendRowCount: Integer read FLegendRowCount write FLegendRowCount;
|
||||
property LegendWidth: Integer read FLegendWidth write FLegendWidth default 150;
|
||||
property PenLineWidth: Integer read FPenLineWidth write SetPenLineWidth default 1;
|
||||
@ -1906,9 +1913,7 @@ begin
|
||||
if (Source is TJvChartOptions) then begin
|
||||
src := Source as TJvChartOptions;
|
||||
|
||||
|
||||
FLegend := src.Legend;//: TJvChartLegend;
|
||||
|
||||
FLegend := src.Legend;
|
||||
FHeaderFont.Assign(src.HeaderFont);
|
||||
FLegendFont.Assign(src.LegendFont);
|
||||
FAxisFont.Assign(src.AxisFont);
|
||||
@ -2039,16 +2044,6 @@ begin
|
||||
Result := pmkNone;
|
||||
end;
|
||||
|
||||
procedure TJvChartOptions.SetPenMarkerKind(Index: Integer; AMarkKind: TJvChartPenMarkerKind);
|
||||
begin
|
||||
if Index >= 0 then
|
||||
begin
|
||||
if Index >= Length(FPenMarkerKind) then
|
||||
SetLength(FPenMarkerKind, Index + 1);
|
||||
FPenMarkerKind[Index] := AMarkKind;
|
||||
end;
|
||||
end;
|
||||
|
||||
function TJvChartOptions.GetPenColor(Index: Integer): TColor;
|
||||
begin
|
||||
// Don't check for out of range values, since we use that on purpose in this
|
||||
@ -2077,31 +2072,6 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TJvChartOptions.SetPenColor(Index: Integer; AColor: TColor);
|
||||
begin
|
||||
if (Index < 0) or (Index >= MAX_PEN) then
|
||||
raise ERangeError.CreateRes(@RsEChartOptionsPenCountPenCountOutOf);
|
||||
|
||||
if Index >= Length(FPenColors) then
|
||||
SetLength(FPenColors, Index + 1);
|
||||
|
||||
FPenColors[Index] := AColor;
|
||||
if Assigned(FOwner) then
|
||||
FOwner.Invalidate;
|
||||
end;
|
||||
|
||||
procedure TJvChartOptions.SetPenStyle(Index: Integer; APenStyle: TPenStyle);
|
||||
begin
|
||||
if (Index < 0) or (Index >= MAX_PEN) then
|
||||
raise ERangeError.CreateRes(@RsEChartOptionsPenCountPenCountOutOf);
|
||||
|
||||
if Index >= Length(FPenStyles) then
|
||||
SetLength(FPenStyles, Index + 1);
|
||||
FPenStyles[Index] := APenStyle;
|
||||
if Assigned(FOwner) then
|
||||
FOwner.Invalidate;
|
||||
end;
|
||||
|
||||
function TJvChartOptions.GetPenStyle(Index: Integer): TPenStyle;
|
||||
begin
|
||||
if (Index >= 0) and (Index < Length(FPenStyles)) then
|
||||
@ -2144,6 +2114,7 @@ begin
|
||||
if Index >= Length(FPenSecondaryAxisFlag) then
|
||||
SetLength(FPenSecondaryAxisFlag, Index + 1);
|
||||
FPenSecondaryAxisFlag[Index] := NewValue;
|
||||
NotifyOptionsChange;
|
||||
end;
|
||||
|
||||
function TJvChartOptions.GetPenValueLabels(Index: Integer): Boolean;
|
||||
@ -2196,39 +2167,62 @@ end;
|
||||
|
||||
procedure TJvChartOptions.SetAxisLineWidth(const Value: Integer);
|
||||
begin
|
||||
if FAxisLineWidth = Value then exit;
|
||||
FAxisLineWidth := Value;
|
||||
NotifyOptionsChange;
|
||||
if FAxisLineWidth <> Value then
|
||||
begin
|
||||
FAxisLineWidth := Value;
|
||||
NotifyOptionsChange;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TJvChartOptions.SetAxisTitleFont(const Value: TFont);
|
||||
begin
|
||||
FAxisTitleFont.Assign(Value);
|
||||
FAxisTitleFont.Orientation := 900;
|
||||
NotifyOptionsChange;
|
||||
end;
|
||||
|
||||
procedure TJvChartOptions.SetChartKind(AKind: TJvChartKind);
|
||||
begin
|
||||
if AKind = FChartKind then exit;
|
||||
|
||||
FChartKind := AKind;
|
||||
NotifyOptionsChange;
|
||||
if AKind <> FChartKind then
|
||||
begin
|
||||
FChartKind := AKind;
|
||||
NotifyOptionsChange;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TJvChartOptions.SetDivisionLinecolor(const AColor: TColor);
|
||||
begin
|
||||
if FDivisionLineColor = AColor then exit;
|
||||
FDivisionLineColor := AColor;
|
||||
if Assigned(FOwner) then
|
||||
FOwner.Invalidate;
|
||||
if FDivisionLineColor <> AColor then
|
||||
begin
|
||||
FDivisionLineColor := AColor;
|
||||
NotifyOptionsChange;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TJvChartOptions.SetFillUnderLine(const AValue: Boolean);
|
||||
begin
|
||||
if FFillUnderLine <> AValue then
|
||||
begin
|
||||
FFillUnderLine := AValue;
|
||||
NotifyOptionsChange;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TJvChartOptions.SetLegend(const ALegend: TJvChartLegend);
|
||||
begin
|
||||
if FLegend <> ALegend then
|
||||
begin
|
||||
FLegend := ALegend;
|
||||
NotifyOptionsChange;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TJvChartOptions.SetMarkerSize(const Value: Integer);
|
||||
begin
|
||||
if FMarkerSize = Value then exit;
|
||||
FMarkerSize := Value;
|
||||
NotifyOptionsChange;
|
||||
if FMarkerSize <> Value then
|
||||
begin
|
||||
FMarkerSize := Value;
|
||||
NotifyOptionsChange;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TJvChartOptions.SetPaperColor(const AColor: TColor);
|
||||
@ -2236,11 +2230,22 @@ begin
|
||||
if AColor <> FPaperColor then
|
||||
begin
|
||||
FPaperColor := AColor;
|
||||
if Assigned(FOwner) then
|
||||
FOwner.Invalidate;
|
||||
NotifyOptionsChange;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TJvChartOptions.SetPenColor(Index: Integer; AColor: TColor);
|
||||
begin
|
||||
if (Index < 0) or (Index >= MAX_PEN) then
|
||||
raise ERangeError.CreateRes(@RsEChartOptionsPenCountPenCountOutOf);
|
||||
|
||||
if Index >= Length(FPenColors) then
|
||||
SetLength(FPenColors, Index + 1);
|
||||
|
||||
FPenColors[Index] := AColor;
|
||||
NotifyOptionsChange;
|
||||
end;
|
||||
|
||||
procedure TJvChartOptions.SetPenLegends(Value: TStrings);
|
||||
begin
|
||||
FPenLegends.Assign(Value);
|
||||
@ -2249,17 +2254,51 @@ end;
|
||||
|
||||
procedure TJvChartOptions.SetPenLineWidth(const Value: Integer);
|
||||
begin
|
||||
if FPenLineWidth = Value then exit;
|
||||
FPenLineWidth := Value;
|
||||
if FPenLineWidth <> Value then
|
||||
begin
|
||||
FPenLineWidth := Value;
|
||||
NotifyOptionsChange;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TJvChartOptions.SetPenMarkerKind(Index: Integer; AMarkKind: TJvChartPenMarkerKind);
|
||||
begin
|
||||
if Index >= 0 then
|
||||
begin
|
||||
if Index >= Length(FPenMarkerKind) then
|
||||
SetLength(FPenMarkerKind, Index + 1);
|
||||
FPenMarkerKind[Index] := AMarkKind;
|
||||
NotifyOptionsChange;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TJvChartOptions.SetPenStyle(Index: Integer; APenStyle: TPenStyle);
|
||||
begin
|
||||
if (Index < 0) or (Index >= MAX_PEN) then
|
||||
raise ERangeError.CreateRes(@RsEChartOptionsPenCountPenCountOutOf);
|
||||
|
||||
if Index >= Length(FPenStyles) then
|
||||
SetLength(FPenStyles, Index + 1);
|
||||
FPenStyles[Index] := APenStyle;
|
||||
NotifyOptionsChange;
|
||||
end;
|
||||
|
||||
procedure TJvChartOptions.SetShadowColor(const AColor: TColor);
|
||||
begin
|
||||
if FShadowColor = AColor then exit;
|
||||
FShadowColor := AColor;
|
||||
if Assigned(FOwner) then
|
||||
FOwner.Invalidate;
|
||||
if FShadowColor <> AColor then
|
||||
begin
|
||||
FShadowColor := AColor;
|
||||
NotifyOptionsChange;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TJvchartOptions.SetTitle(const Value: String);
|
||||
begin
|
||||
if FTitle <> Value then
|
||||
begin
|
||||
FTitle := Value;
|
||||
NotifyOptionsChange;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TJvChartOptions.SetXAxisDateTimeDivision(const Value: Double);
|
||||
@ -2269,9 +2308,11 @@ end;
|
||||
|
||||
procedure TJvChartOptions.SetXAxisHeader(const Value: String);
|
||||
begin
|
||||
if FXAxisHeader = Value then exit;
|
||||
FXAxisHeader := Value;
|
||||
NotifyOptionsChange;
|
||||
if FXAxisHeader <> Value then
|
||||
begin
|
||||
FXAxisHeader := Value;
|
||||
NotifyOptionsChange;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TJvChartOptions.SetXLegends(Value: TStrings);
|
||||
@ -2281,9 +2322,11 @@ end;
|
||||
|
||||
procedure TJvChartOptions.SetYAxisHeader(const Value: String);
|
||||
begin
|
||||
if FYAxisHeader = Value then exit;
|
||||
FYAxisHeader := Value;
|
||||
NotifyOptionsChange;
|
||||
if FYAxisHeader <> Value then
|
||||
begin
|
||||
FYAxisHeader := Value;
|
||||
NotifyOptionsChange;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TJvChartOptions.SetHeaderFont(AFont: TFont);
|
||||
@ -2313,21 +2356,20 @@ end;
|
||||
|
||||
procedure TJvChartOptions.SetXStartOffset(Offset: Integer);
|
||||
begin
|
||||
//if not PrintInSession then
|
||||
// if (Offset < 10) or (Offset > (FOwner.Width div 2)) then
|
||||
// raise ERangeError.CreateRes(@RsEChartOptionsXStartOffsetValueOutO);
|
||||
if FXStartOffset = Offset then
|
||||
exit;
|
||||
FXStartOffset := Offset;
|
||||
NotifyOptionsChange;
|
||||
if FXStartOffset <> Offset then
|
||||
begin
|
||||
FXStartOffset := Offset;
|
||||
NotifyOptionsChange;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TJvChartOptions.SetYStartOffset(Offset: Integer);
|
||||
begin
|
||||
if FYStartOffset = Offset then
|
||||
exit;
|
||||
FYStartOffset := Offset;
|
||||
NotifyOptionsChange;
|
||||
if FYStartOffset <> Offset then
|
||||
begin
|
||||
FYStartOffset := Offset;
|
||||
NotifyOptionsChange;
|
||||
end;
|
||||
end;
|
||||
|
||||
|
||||
@ -4181,8 +4223,6 @@ begin
|
||||
DefaultXAxisLegendMode;
|
||||
end;
|
||||
DrawChartLegendBelow(ACanvas);
|
||||
|
||||
|
||||
end;
|
||||
|
||||
procedure TJvChart.DrawPenColorBox(ACanvas: TCanvas; NColor, W, H, X, Y: Integer);
|
||||
@ -4191,6 +4231,7 @@ begin
|
||||
SetRectangleColor(ACanvas, jvChartPaperColorIndex);
|
||||
end;
|
||||
|
||||
|
||||
{**************************************************************************}
|
||||
{ call this function : }
|
||||
{ a) when you want to print the graph to Windows default printer }
|
||||
@ -4319,15 +4360,14 @@ begin
|
||||
|
||||
// external picture mode?
|
||||
if Assigned(FExtPicture) and Assigned(FExtPicture.Graphic) then begin
|
||||
if FExtPicture.Graphic is TBitmap then begin
|
||||
result := TBitmap(FExtPicture.Graphic).Canvas;
|
||||
exit;
|
||||
end else begin
|
||||
raise EInvalidOperation.Create(RsEUnableToGetCanvas);
|
||||
end;
|
||||
if FExtPicture.Graphic is TBitmap then begin
|
||||
Result := TBitmap(FExtPicture.Graphic).Canvas;
|
||||
exit;
|
||||
end else begin
|
||||
raise EInvalidOperation.Create(RsEUnableToGetCanvas);
|
||||
end;
|
||||
end;
|
||||
|
||||
|
||||
{ printer canvas }
|
||||
if PrintInSession then
|
||||
begin
|
||||
@ -4339,11 +4379,10 @@ begin
|
||||
|
||||
{ Floating marker draw but not external picture mode:}
|
||||
if isFloating then begin
|
||||
Result := Self.Canvas;
|
||||
exit;
|
||||
Result := Self.Canvas;
|
||||
exit;
|
||||
end;
|
||||
|
||||
|
||||
{ FPicture.Graphic -bitmap canvas - normal display method. }
|
||||
if FPicture.Graphic = nil then
|
||||
begin
|
||||
@ -4374,15 +4413,18 @@ begin
|
||||
Result := Width;
|
||||
Exit;
|
||||
end;
|
||||
|
||||
if Assigned(FExtPicture) then begin
|
||||
result := FExtPicture.Graphic.Width;
|
||||
exit;
|
||||
end;
|
||||
|
||||
if PrintInSession then
|
||||
begin
|
||||
Result := Printer.PageWidth;
|
||||
Exit;
|
||||
end;
|
||||
|
||||
if Assigned(FPicture) then
|
||||
Result := FPicture.Width
|
||||
else
|
||||
@ -4397,6 +4439,7 @@ begin
|
||||
Result := Self.Height;
|
||||
Exit;
|
||||
end;
|
||||
|
||||
if Assigned(FExtPicture) then begin
|
||||
result := FExtPicture.Graphic.Height;
|
||||
exit;
|
||||
@ -4418,7 +4461,7 @@ end;
|
||||
|
||||
procedure TJvChart.CalcYEnd;
|
||||
var
|
||||
aHeight:Integer;
|
||||
aHeight: Integer;
|
||||
begin
|
||||
if Assigned(FExtPicture) then begin
|
||||
aHeight := FExtPicture.Bitmap.Height;
|
||||
@ -4427,16 +4470,16 @@ begin
|
||||
aHeight := FBitmap.Height;
|
||||
end;
|
||||
|
||||
Options.YEnd := aHeight - 2 * Options.YStartOffset; {canvas size, excluding margin}
|
||||
Options.YEnd := aHeight - 2 * Options.YStartOffset; {canvas size, excluding margin}
|
||||
end;
|
||||
|
||||
|
||||
{**************************************************************************}
|
||||
{ call this function : }
|
||||
{ a) when you resize the canvas for the AABsoftGraph }
|
||||
{ b) at program startup before drawing the first graph }
|
||||
{**************************************************************************}
|
||||
|
||||
// ResizeChartCanvas/PlotGraph endless recursion loop fixed. --WP
|
||||
|
||||
procedure TJvChart.ResizeChartCanvas;
|
||||
var
|
||||
awidth:Integer;
|
||||
@ -4491,7 +4534,6 @@ begin
|
||||
end;
|
||||
|
||||
{This procedure is called when user clicks on the main header}
|
||||
|
||||
procedure TJvChart.EditHeader;
|
||||
var
|
||||
StrString: string;
|
||||
@ -4506,7 +4548,6 @@ begin
|
||||
end;
|
||||
|
||||
{This procedure is called when user clicks on the X-axis header}
|
||||
|
||||
procedure TJvChart.EditXHeader;
|
||||
var
|
||||
StrString: string;
|
||||
@ -4542,7 +4583,6 @@ end;
|
||||
|
||||
// NEW: X Axis Header has to move to make room if there is a horizontal
|
||||
// X axis legend:
|
||||
|
||||
procedure TJvChart.MyXHeader(ACanvas: TCanvas; StrText: string);
|
||||
var
|
||||
X, Y, H: Integer;
|
||||
@ -4558,14 +4598,15 @@ begin
|
||||
end
|
||||
else
|
||||
begin
|
||||
X := Options.XStartOffset + (Options.XEnd div 2);
|
||||
X := (Options.XStartOffset + Options.XEnd) div 2;
|
||||
MyCenterTextOut(ACanvas, X, Y, StrText);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TJvChart.MyYHeader(ACanvas: TCanvas; StrText: string);
|
||||
var
|
||||
{ht,}WD, Vert, Horiz: Integer; // not used (ahuser)
|
||||
{ht,} // not used (ahuser)
|
||||
WD, Vert, Horiz: Integer;
|
||||
begin
|
||||
if Length(StrText) = 0 then
|
||||
Exit;
|
||||
@ -4577,10 +4618,8 @@ begin
|
||||
begin
|
||||
{ht := MyTextHeight(StrText); }// not used (ahuser)
|
||||
WD := ACanvas.TextWidth(StrText);
|
||||
// Kindof a fudge, but we'll work out something better later... :-) -WAP.
|
||||
Vert := Options.YStartOffset * 2 + Height div 2 - WD div 2;
|
||||
if Vert < 0 then
|
||||
Vert := 0;
|
||||
//Vert := Options.YStartOffset + WD; // top-aligned
|
||||
Vert := Max(0, Options.YStartOffset + (Options.YEnd + WD) div 2); // centered
|
||||
Horiz := 2;
|
||||
// NOTE: Because of the logical font selected, this time TextOut goes vertical.
|
||||
// If this doesn't go vertical, it may be because the font selection above failed.
|
||||
@ -4590,6 +4629,7 @@ begin
|
||||
// Self.MyLeftTextOut(Horiz, Vert+50, '*');
|
||||
end;
|
||||
|
||||
|
||||
{***************************************************************************}
|
||||
{ MOUSE FUNCTIONS AND PROCEDURES }
|
||||
{***************************************************************************}
|
||||
|
Reference in New Issue
Block a user