Steema Issues Database

Note: This database is for bugs and wishes only. For technical support help, if you are a customer please visit our online forums;
otherwise you can use StackOverflow.
Before using this bug-tracker we recommend a look at this document, Steema Bug Fixing Policy.



Bug 947 - TChartAxis.InternalCalcSize doesn't consider multiline for the height
Summary: TChartAxis.InternalCalcSize doesn't consider multiline for the height
Status: RESOLVED FIXED
Alias: None
Product: VCL TeeChart
Classification: Unclassified
Component: Axis (show other bugs)
Version: 140923
Hardware: Other Other
: High major
Target Milestone: ---
Assignee: Steema Issue Manager
URL: http://www.teechart.net/support/viewt...
Keywords:
Depends on:
Blocks:
 
Reported: 2014-10-07 04:44 EDT by yeray alonso
Modified: 2015-04-30 03:05 EDT (History)
2 users (show)

See Also:
Chart Series: ---
Delphi / C++ Builder RAD IDE Version: Delphi 7


Attachments
test app for labels rotation (2.63 KB, application/zip)
2014-10-23 03:35 EDT, yeray alonso
Details

Note You need to log in before you can comment on or make changes to this bug.
Description yeray alonso 2014-10-07 04:44:56 EDT
TChartAxis.InternalCalcSize doesn't consider multiline for the height.
If you have axis labels with multiple lines the space taken for the labels 
isn't enough and they are cut.

uses Series;

procedure TForm1.FormCreate(Sender: TObject);
var i: Integer;
begin
  Chart1.Align:=alClient;
  Chart1.View3D:=false;
  Chart1.Legend.Visible:=false;

  with Chart1.AddSeries(TBarSeries) as TBarSeries do
  begin
    FillSampleValues();
    Marks.Visible:=false;

    for i:=0 to Count-1 do
      Labels[i]:=FormatFloat('#0.##', YValue[i]) + #13 + 'Extra Line 1' + #13 + 
'Extra Line 2';
  end;
end;
Comment 1 david berneda 2014-10-09 13:11:53 EDT
Difficult to fix. Its a catch-two situation.
When we're calculating the height, we don't know yet how many labels will be displayed or not. And we need the height to calculate later which labels should display.
Comment 2 david berneda 2014-10-09 13:25:22 EDT
The solution is to use the Axis.Texts.Size property, setting it manually to a number of pixels.

Calculating the correct height involves lots of steps that are done only when drawing the labels, not when calculating the needed space.

Axis orientation and labels rotation angle, the number of visible series, if that series have texts or not, Texts.MultiLine, the LabelsFormat string and many other settings affect the calculation, so its a complex thing to improve.
Comment 3 david berneda 2014-10-09 13:38:41 EDT
I've implemented a possible solution, but it has a **massive** performance hit difficult to avoid.
Comment 5 yeray alonso 2014-10-23 03:35:55 EDT
Created attachment 314 [details]
test app for labels rotation

Attached the internal project for testing labels rotation
Comment 6 yeray alonso 2014-10-24 03:44:51 EDT
This customer found the problem with the multi-lined axis labels appeared with November 2013 release (2013.09.131119)
http://www.teechart.net/support/viewtopic.php?p=67590#p67590