diff --git a/components/jvcllaz/examples/JvChartDemo/jvchartdemofm.lfm b/components/jvcllaz/examples/JvChartDemo/jvchartdemofm.lfm index b4968df61..b3c9548ca 100644 --- a/components/jvcllaz/examples/JvChartDemo/jvchartdemofm.lfm +++ b/components/jvcllaz/examples/JvChartDemo/jvchartdemofm.lfm @@ -569,9 +569,9 @@ object JvChartDemoForm: TJvChartDemoForm ShortCut = 16455 OnClick = ShowgapinLineChart1Click end - object DateTimeAxisMode: TMenuItem + object mnuDateTimeAxisMode: TMenuItem Caption = 'Date/Time Axis Mode' - OnClick = DateTimeAxisModeClick + OnClick = mnuDateTimeAxisModeClick end object MenuNegValueTest: TMenuItem AutoCheck = True diff --git a/components/jvcllaz/examples/JvChartDemo/jvchartdemofm.pas b/components/jvcllaz/examples/JvChartDemo/jvchartdemofm.pas index e9d68aea8..be9e2ff0c 100644 --- a/components/jvcllaz/examples/JvChartDemo/jvchartdemofm.pas +++ b/components/jvcllaz/examples/JvChartDemo/jvchartdemofm.pas @@ -105,7 +105,7 @@ type ShowDataInListbox1: TMenuItem; N4: TMenuItem; LargeDataset576samples1: TMenuItem; - DateTimeAxisMode: TMenuItem; + mnuDateTimeAxisMode: TMenuItem; PrintOptions1: TMenuItem; PrinterSetupDialog1: TPrinterSetupDialog; PrintDialog1: TPrintDialog; @@ -145,7 +145,7 @@ type procedure Timer1Timer(Sender: TObject); procedure ShowDataInListbox1Click(Sender: TObject); procedure LargeDataset576samples1Click(Sender: TObject); - procedure DateTimeAxisModeClick(Sender: TObject); + procedure mnuDateTimeAxisModeClick(Sender: TObject); procedure FormCreate(Sender: TObject); procedure FormDestroy(Sender: TObject); @@ -281,7 +281,7 @@ begin Fds := Fdt + (FGenerationIndex / 576); // There are TWO ways to get an X Axis label plotted: - if DateTimeAxisMode.Checked then + if mnuDateTimeAxisMode.Checked then Chart.Data.Timestamp[I] := Fds // X legends generated by timestamps else // X Legends generated by user are used by default. @@ -366,7 +366,7 @@ begin Randomize; - Chart.Options.XAxisDateTimeMode := DateTimeAxisMode.Checked; // Use datetime timestamp labels, just Fer Instance. + Chart.Options.XAxisDateTimeMode := mnuDateTimeAxisMode.Checked; // Use datetime timestamp labels, just Fer Instance. if not Chart.Options.XAxisDateTimeMode then Chart.Options.XAxisLegendSkipBy := 5; @@ -869,11 +869,11 @@ begin NewValues; end; -procedure TJvChartDemoForm.DateTimeAxisModeClick(Sender: TObject); +procedure TJvChartDemoForm.mnuDateTimeAxisModeClick(Sender: TObject); begin - DateTimeAxisMode.Checked := not DateTimeAxisMode.Checked; + mnuDateTimeAxisMode.Checked := not mnuDateTimeAxisMode.Checked; if SpeedButtonTestMouseOver.Down then begin - Chart.Options.XLegends.Clear; + Chart.Options.XLegends.Clear; end else NewValues; end; @@ -996,7 +996,6 @@ begin marker1.Caption :='Start'; marker1.Visible := true; - marker2 := Chart.AddFloatingMarker; marker2.XPosition := 66; marker2.YPosition := Chart.Data.Value[0,marker2.XPosition]; // Snap to Pen 1 diff --git a/components/jvcllaz/examples/JvChartDemo/jvpeneditor.lfm b/components/jvcllaz/examples/JvChartDemo/jvpeneditor.lfm index 0681f45d6..10d22ac59 100644 --- a/components/jvcllaz/examples/JvChartDemo/jvpeneditor.lfm +++ b/components/jvcllaz/examples/JvChartDemo/jvpeneditor.lfm @@ -8,6 +8,7 @@ object PenEditorForm: TPenEditorForm ClientWidth = 505 OnCreate = FormCreate OnDestroy = FormDestroy + Position = poScreenCenter LCLVersion = '2.1.0.0' object btnPenColor: TButton Left = 232 diff --git a/components/jvcllaz/examples/JvChartDemo/jvpeneditor.pas b/components/jvcllaz/examples/JvChartDemo/jvpeneditor.pas index c2a859b7f..cf94804fc 100644 --- a/components/jvcllaz/examples/JvChartDemo/jvpeneditor.pas +++ b/components/jvcllaz/examples/JvChartDemo/jvpeneditor.pas @@ -6,8 +6,8 @@ interface uses Classes, SysUtils, Forms, Controls, Graphics, Dialogs, ExtCtrls, StdCtrls, - Spin, ButtonPanel,Contnrs, - JvChart, Types; + ButtonPanel, Contnrs, Types, + JvChart; type TPenObj = class @@ -236,6 +236,7 @@ begin end; // Text + lbPens.Canvas.Brush.Style := bsClear; lbPens.Canvas.TextOut(R.Right + 2, (R.Top + R.Bottom - lbPens.Canvas.TextHeight('Rg')) div 2, pen.Legend); // Focus rect diff --git a/components/jvcllaz/run/JvCustomControls/jvchart.pas b/components/jvcllaz/run/JvCustomControls/jvchart.pas index 9a19b1047..bc97a9263 100644 --- a/components/jvcllaz/run/JvCustomControls/jvchart.pas +++ b/components/jvcllaz/run/JvCustomControls/jvchart.pas @@ -103,8 +103,6 @@ unit JvChart; interface uses - { - Windows, Messages, } LCLType, LCLIntf, Classes, Types, Graphics, Controls, Contnrs, JvComponent; @@ -115,7 +113,7 @@ const JvDefaultHintColor = TColor($00DDFBFA); JvDefaultAvgLineColor = TColor($00EEDDDD); JvDefaultDivisionLineColor = clLtGray; //NEW! - JvDefaultShadowColor = clLtGray; //NEW! + JvDefaultShadowColor = clDkGray; //NEW! JvDefaultPaperColor = clWhite; JvDefaultYLegends = 20; @@ -4587,6 +4585,9 @@ procedure TJvChart.MyXHeader(ACanvas: TCanvas; StrText: string); var X, Y, H: Integer; begin + if StrText = '' then + exit; + H := ACanvas.TextHeight(StrText); MyAxisFont(ACanvas); Y := Options.YStartOffset + Options.YEnd + Round(1.6 * H); @@ -4598,6 +4599,7 @@ begin end else begin + { center title within range covered by x axis } X := (Options.XStartOffset + Options.XEnd) div 2; MyCenterTextOut(ACanvas, X, Y, StrText); end; @@ -4605,28 +4607,21 @@ end; procedure TJvChart.MyYHeader(ACanvas: TCanvas; StrText: string); var - {ht,} // not used (ahuser) WD, Vert, Horiz: Integer; begin if Length(StrText) = 0 then Exit; ACanvas.Brush.Color := Color; - { !!warning: uses Win32 only font-handle stuff!!} ACanvas.Font.Assign(FOptions.AxisTitleFont); -// MyGraphVertFont(ACanvas); // Select Vertical Font Output. if Options.XStartOffset > 10 then begin - {ht := MyTextHeight(StrText); }// not used (ahuser) WD := ACanvas.TextWidth(StrText); //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. MyLeftTextOut(ACanvas, Horiz, Vert, StrText); end; MyAxisFont(ACanvas); - // Self.MyLeftTextOut(Horiz, Vert+50, '*'); end;