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 2428 - Access violation in editor when legend is hidden
Summary: Access violation in editor when legend is hidden
Status: RESOLVED FIXED
Alias: None
Product: VCL TeeChart
Classification: Unclassified
Component: Editors (show other bugs)
Version: 30.200525
Hardware: PC Windows
: --- major
Target Milestone: ---
Assignee: Steema Issue Manager
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-06-01 12:46 EDT by fabrice
Modified: 2023-03-15 08:46 EDT (History)
2 users (show)

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


Attachments
Screenshot and bug report (by MadExcept) (285.94 KB, application/x-zip-compressed)
2021-06-01 12:46 EDT, fabrice
Details

Note You need to log in before you can comment on or make changes to this bug.
Description fabrice 2021-06-01 12:46:19 EDT
Created attachment 964 [details]
Screenshot and bug report (by MadExcept)

Possible access violation if you open an editor (run time) when legend is hidden because too large.

Occurs when you go in column option of legend when legend is hidden because it's contain to large width to be displayed.

Reproduce :
1) A chart with large legend visible
2) Reduce width of the chart until legend become hidden
3) Open Chart editor go in legend / columns. Column value (disabled) is equal to -1
=> Access violation (see in attachment)



Call stack :
VCLTee.Chart                      CalcColumnsWidth
VCLTee.Chart                      CalcFittingItems
VCLTee.Chart                      MaxLegendColumns
VCLTee.Chart                      TCustomChartLegend.CalcRect
VCLTee.Chart                      TCustomChart.DrawTitlesAndLegend
VCLTee.TeEngine                   TCustomAxisPanel.InternalDraw
VCLTee.TeeProcs                   InnerDraw
VCLTee.TeeProcs                   TCustomTeePanel.Draw
VCLTee.TeeProcs                   TCustomTeePanel.Draw
VCLTee.TeeProcs                   TCustomTeePanel.Paint
Vcl.Controls                      TCustomControl.PaintWindow
Vcl.Controls                      TWinControl.PaintHandler
Vcl.Controls                      TWinControl.WMPaint
Vcl.Controls                      TCustomControl.WMPaint
Vcl.Controls                      TControl.WndProc
Vcl.Controls                      TWinControl.WndProc
VCLTee.TeeProcs                   TCustomTeePanel.WndProc
Comment 1 fabrice 2021-06-02 03:24:41 EDT
Copy of my TDBChart :

object DBChart_NbCLick: TDBChart
  Left = 2
  Top = 21
  Width = 370
  Height = 425
  Border.Color = clNavy
  Border.Width = 6
  Border.Visible = True
  BorderRound = 10
  Gradient.EndColor = clGray
  Gradient.Visible = True
  MarginBottom = 3
  MarginTop = 3
  Title.Text.Strings = (
	'Nombre de clics par lien')
  OnClickSeries = DBChart_NbCLickClickSeries
  Chart3DPercent = 25
  Legend.Alignment = laBottom
  Legend.Brush.Gradient.Direction = gdTopBottom
  Legend.Brush.Gradient.EndColor = clYellow
  Legend.Brush.Gradient.StartColor = clWhite
  Legend.Brush.Gradient.Visible = True
  Legend.CheckBoxesStyle = cbsRadio
  Legend.DrawBehind = True
  Legend.Font.Height = -9
  Legend.PositionUnits = muPercent
  Legend.ResizeChart = False
  Legend.TopPos = 0
  View3D = False
  View3DOptions.Elevation = 315
  View3DOptions.Orthogonal = False
  View3DOptions.Perspective = 0
  View3DOptions.Rotation = 360
  Zoom.Animated = True
  Align = alLeft
  BevelOuter = bvNone
  PopupMenu = PopupGraphique
  TabOrder = 0
  DefaultCanvas = 'TGDIPlusCanvas'
  ColorPaletteIndex = 2
  object Series2: TPieSeries
	HoverElement = []
	Marks.Style = smsPercent
	Marks.Tail.Margin = 2
	DataSource = Q_STAT_NBClic
	XLabelsSource = 'TR_LIEN'
	XValues.Order = loAscending
	YValues.Name = 'Camembert'
	YValues.Order = loNone
	YValues.ValueSource = 'NOMBRE'
	Frame.InnerBrush.BackColor = clRed
	Frame.InnerBrush.Gradient.EndColor = clGray
	Frame.InnerBrush.Gradient.MidColor = clWhite
	Frame.InnerBrush.Gradient.StartColor = 4210752
	Frame.InnerBrush.Gradient.Visible = True
	Frame.MiddleBrush.BackColor = clYellow
	Frame.MiddleBrush.Gradient.EndColor = 8553090
	Frame.MiddleBrush.Gradient.MidColor = clWhite
	Frame.MiddleBrush.Gradient.StartColor = clGray
	Frame.MiddleBrush.Gradient.Visible = True
	Frame.OuterBrush.BackColor = clGreen
	Frame.OuterBrush.Gradient.EndColor = 4210752
	Frame.OuterBrush.Gradient.MidColor = clWhite
	Frame.OuterBrush.Gradient.StartColor = clSilver
	Frame.OuterBrush.Gradient.Visible = True
	Frame.Width = 4
	Shadow.HorizSize = 10
	Shadow.VertSize = 10
	ExplodeBiggest = 30
	OtherSlice.Legend.Visible = False
  end
end
Comment 2 yeray alonso 2021-10-11 09:07:06 EDT
Access Violation reproduced with this code, opening the Columns tab in the Legend editor:

uses Series, EditChar;

procedure TForm1.Button1Click(Sender: TObject);
begin
  EditChartLegend(Self, Chart1);
end;

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

  Chart1.Width:=100;
  Chart1.Legend.Alignment:=laBottom;

  with Chart1.AddSeries(TLineSeries) do
  begin
    FillSampleValues;
    for i:=0 to Count-1 do
      Labels[i]:='This is a long string for the label ' + IntToStr(i);
  end;
end;
Comment 3 david berneda 2023-03-15 08:45:57 EDT
Fixed in latest build.
Comment 4 david berneda 2023-03-15 08:46:08 EDT
(Cannot reproduce)