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