TAChart: Adapt DataPointToolDemo to tracing line segments of TLineSeries.

git-svn-id: trunk@63049 -
This commit is contained in:
wp 2020-04-22 20:25:24 +00:00
parent e4de3e6dec
commit f86c4782e6
3 changed files with 16 additions and 5 deletions

View File

@ -1,11 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<CONFIG>
<ProjectOptions>
<Version Value="11"/>
<Version Value="12"/>
<PathDelim Value="\"/>
<General>
<Flags>
<CompatibilityMode Value="True"/>
</Flags>
<SessionStorage Value="InProjectDir"/>
<MainUnit Value="0"/>
<Title Value="datapointtooldemo"/>
<ResourceType Value="res"/>
<UseXPManifest Value="True"/>

View File

@ -15,7 +15,7 @@ object MainForm: TMainForm
Width = 637
MultiLine = True
OnChange = TabControlChange
TabIndex = 5
TabIndex = 0
Tabs.Strings = (
'Line series'
'Bar series'
@ -81,6 +81,7 @@ object MainForm: TMainForm
Stacked = True
Source = ListChartSource
Styles = ChartStyles
ToolTargets = [nptPoint, nptYList, nptCustom]
end
object BarSeries: TBarSeries
Legend.Multiplicity = lmStyle
@ -212,7 +213,7 @@ object MainForm: TMainForm
Left = 8
Height = 19
Top = 8
Width = 113
Width = 114
BorderSpacing.Left = 8
BorderSpacing.Top = 8
BorderSpacing.Bottom = 8
@ -225,7 +226,7 @@ object MainForm: TMainForm
object DatapointInfo: TLabel
AnchorSideLeft.Control = CbDragXY
AnchorSideLeft.Side = asrBottom
Left = 145
Left = 146
Height = 15
Top = 11
Width = 73

View File

@ -286,6 +286,14 @@ begin
ser.XValue[ATool.PointIndex],
ser.YValues[ATool.PointIndex, ATool.YIndex],
ATool.YIndex
])
else
if (ATool.PointIndex = -1) and (ser.Source.YCount > 1) and (ATool.YIndex > -1) then
Result := Format('"%s": on segment, x = %.2f, y = %.2f (y index %d)', [
ser.Title,
ser.GraphToAxisX(ATool.NearestGraphPoint.X),
ser.GraphToAxisY(ATool.NearestGraphPoint.Y),
ATool.YIndex
]);
end;
end;