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 693

Summary: Publish Legend title Offset property so you can move it. Text alignment would be also interesting
Product: VCL TeeChart Reporter: yeray alonso <yeray>
Component: LegendAssignee: Steema Issue Manager <issuemanager>
Status: CONFIRMED ---    
Severity: enhancement CC: gustav.kaiser
Priority: ---    
Version: 140220   
Target Milestone: ---   
Hardware: PC   
OS: Windows   
URL: http://www.teechart.net/support/viewtopic.php?f=3&t=14818
Chart Series: --- Delphi / C++ Builder RAD IDE Version:

Description yeray alonso 2014-04-02 06:29:05 EDT
Having a Title in the Legend, if you also have it with fosRoundRectangle ShapeStyle, the legend title may be cut by the legend border.

Code to reproduce the issue and workaround below. The workaround consists on manually positioning the legend's text accessing the TCustomTextShape's ITextOffset property. But it would be interesting to offer some public property to change this offset and/or have some Text Align property for the legend title.

uses Series, TeCanvas;

Type
  TCustomTextShapeClass = Class(TCustomTextShape);

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

  for i:=0 to 4 do
    with Chart1.AddSeries(TLineSeries) as TLineSeries do
    begin
      FillSampleValues(10);
      Pointer.Visible:=true;
    end;

  Chart1.Legend.ShapeStyle:=fosRoundRectangle;
  Chart1.Legend.RoundSize:=40;
  Chart1.Legend.Title.Caption:='My series';
  Chart1.Legend.Symbol.Squared:=false;
  Chart1.Legend.Symbol.Width:=50;

  //Workaround
  {Chart1.Legend.Title.AutoSize:=false;
  Chart1.Legend.Title.Height:=20;
  Chart1.Legend.Title.Width:=80;
  TCustomTextShapeClass(Chart1.Legend.Title).ITextOffset:=13;{}
end;