Hi Uli,
ulibru wrote:the basic idea was just to get a label (maybe together with a major tick) at the end of the axis.
Indeed it is not necessary to create new minor ticks. They can simply match the log base as before. No change.
I've checked ProcessMinorTicks but honestly speaking this is beyond my skills. I fear to create an undesired side-effect by changing the procedure.
In that method I read:
Code: Select all
if FLogarithmic then
begin
tmpTicks:=nil;
try
if tmpNumTicks>0 then // 7.0 fix first tick
begin
tmpValue:=CalcPosPoint(Tick[tmpNumTicks-1])/LogarithmicBase;
DrawLogMinorTicks(tmpValue);
for t:=0 to tmpNumTicks-3 do // 8.02
DrawLogMinorTicks(CalcPosPoint(Tick[t]));
DrawLogMinorTicks(CalcPosPoint(Tick[tmpNumTicks-1]));
end;
finally
tmpTicks:=nil;
end;
end
If you comment the two lines
Code: Select all
tmpValue:=CalcPosPoint(Tick[tmpNumTicks-1])/LogarithmicBase;
DrawLogMinorTicks(tmpValue);
To have this:
Code: Select all
if FLogarithmic then
begin
tmpTicks:=nil;
try
if tmpNumTicks>0 then // 7.0 fix first tick
begin
//tmpValue:=CalcPosPoint(Tick[tmpNumTicks-1])/LogarithmicBase;
//DrawLogMinorTicks(tmpValue);
for t:=0 to tmpNumTicks-3 do // 8.02
DrawLogMinorTicks(CalcPosPoint(Tick[t]));
DrawLogMinorTicks(CalcPosPoint(Tick[tmpNumTicks-1]));
end;
finally
tmpTicks:=nil;
end;
end
It seems to behave as you described. However, this is not a very good/elegant solution as it simply doesn't draw the minor ticks in the last interval, regardless if you want them or not.
A more elegant solution would be not to add the non LogarithmicBase custom label:
Code: Select all
Clear;
Add(1,'1');
Add(10,'10');
Add(100,'100');
Add(1000,'1000');
Add(10000,'10000');
// Add(Chart1.Axes.Bottom.Maximum,System.SysUtils.Format('%1.0f',[Chart1.Axes.Bottom.Maximum]));
and draw it manually at OnAfterDraw event as follows:
Code: Select all
procedure TForm1.Chart1AfterDraw(Sender: TObject);
var XPos, YPos, ZPos, TLength: Integer;
text: String;
begin
with Chart1.Canvas, Chart1.Axes.Bottom do
begin
Pen.Assign(Ticks);
Font.Assign(LabelsFont);
text:=FormatFloat('#,##0', Maximum);
TLength:=TickLength;
XPos:=IEndPos;
YPos:=PosAxis;
ZPos:=Round(Chart1.Width3D*ZPosition*0.01);
VertLine3D(XPos, YPos, YPos+TLength, ZPos);
TextOut3D(XPos-(TextWidth(text) div 2), PosLabels, ZPos, text);
end;
end;