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 1942

Summary: Negative stacked bars rendered wrongly when in correlative StackGroups
Product: VCL TeeChart Reporter: yeray alonso <yeray>
Component: SeriesAssignee: yeray alonso <yeray>
Status: RESOLVED FIXED    
Severity: enhancement CC: paul
Priority: ---    
Version: 22.170619   
Target Milestone: ---   
Hardware: PC   
OS: Windows   
URL: https://forums.embarcadero.com//thread.jspa?threadID=260455
Chart Series: --- Delphi / C++ Builder RAD IDE Version:

Description yeray alonso 2017-11-13 10:08:31 EST
Negative stacked bars rendered wrongly when in correlative StackGroups.
The drawing order may be revised for this scenario:

uses Series, TeCanvas, Math;

procedure TForm1.FormCreate(Sender: TObject);
var i, j, sCount, nCount, tmp: Integer;
begin
  Chart1.Legend.Visible:=False;

  sCount:=3;
  nCount:=Round(Power(2, sCount));
  for i:=0 to sCount-1 do
    with Chart1.AddSeries(TBarSeries) as TBarSeries do
    begin
      for j:=0 to nCount-1 do
      begin
        tmp:=Round(nCount / Power(2, i));

        if j mod tmp < tmp div 2 then
           Add(10)
        else
           Add(-10);
      end;

      Marks.Visible:=False;
      MultiBar:=mbStacked;

      StackGroup:=(i+1) div 2;
    end;
end;