TAChart: Fix axis labels for sorting a chart source with XCount = 0. Minor changes in sort_demo.

git-svn-id: trunk@60999 -
This commit is contained in:
wp 2019-04-16 21:41:46 +00:00
parent f6fc50d43c
commit abdb6abcaf
4 changed files with 8 additions and 25 deletions

View File

@ -156,15 +156,6 @@ object MainForm: TMainForm
)
end
end
object Button1: TButton
Left = 508
Height = 25
Top = 484
Width = 75
Caption = 'Button1'
OnClick = Button1Click
TabOrder = 2
end
object ListChartSource: TListChartSource
left = 192
top = 112

View File

@ -14,7 +14,6 @@ type
{ TMainForm }
TMainForm = class(TForm)
Button1: TButton;
Chart: TChart;
cbSortBy: TComboBox;
cbXCount0: TCheckBox;
@ -27,7 +26,6 @@ type
ListChartSource: TListChartSource;
SettingsPanel: TPanel;
TabControl: TTabControl;
procedure Button1Click(Sender: TObject);
procedure cbSortByChange(Sender: TObject);
procedure cbXCount0Change(Sender: TObject);
procedure DataPointClickToolPointClick(ATool: TChartTool; APoint: TPoint);
@ -93,7 +91,8 @@ begin
PieSeries := TPieSeries.Create(Chart);
PieSeries.Title := 'Pies';
PieSeries.Marks.Style := smsLabelValue;
PieSeries.Marks.Style := smsCustom;
PieSeries.Marks.Format := '%2:s' + LineEnding + '%0:.9g';
Chart.AddSeries(PieSeries);
TabControl.Tabs.Add('Pie series');
@ -158,14 +157,17 @@ begin
PolarSeries.Pointer.Style := psCircle;
PolarSeries.Pointer.HorizSize := 6;
PolarSeries.Pointer.VertSize := 6;
PolarSeries.Marks.Style := smsCustom;
PolarSeries.Marks.Format := '%2:s' + LineEnding + '%0:.9g';
Chart.AddSeries(PolarSeries);
TabControl.Tabs.Add('Polar series');
for i:=0 to Chart.SeriesCount-1 do begin
ser := Chart.Series[i] as TChartSeries;
if ser <> PieSeries then
ser.Marks.Style := smsLabel;
if (ser <> PieSeries) and (ser <> PolarSeries) then
ser.Marks.Style := smsValue;
ser.Marks.LinkPen.Color := clGray;
ser.Marks.Alignment := taCenter;
end;
TabControlChange(nil);
@ -203,15 +205,6 @@ begin
UpdateGrid;
end;
procedure TMainForm.Button1Click(Sender: TObject);
begin
if ListChartSource[0]^.Text <> 'abc' then
ListChartSource[0]^.Text := 'abc'
else
ListChartSource[0]^.Text := 'ABC';
chart.Invalidate;
end;
procedure TMainForm.cbXCount0Change(Sender: TObject);
begin
if cbXCount0.Checked then

View File

@ -12,7 +12,6 @@
<XPManifest>
<DpiAware Value="True"/>
</XPManifest>
<Icon Value="0"/>
</General>
<BuildModes>
<Item Name="Default" Default="True"/>

View File

@ -1437,7 +1437,7 @@ begin
AValues[start].FValue := SafeNan;
for i := 0 to Count - 1 do begin
with Item[I]^ do
v := IfThen(AParams.FUseY, Y, X);
v := IfThen(AParams.FUseY, Y, IfThen(XCount > 0, X, I));
if IsNan(v) then continue;
if v < AParams.FMin then begin
if v > lo.FValue then