![]() | Steema Issues DatabaseNote: 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. |
| Summary: | Area series cannot handle stacked positive and negatiove values properly | ||
|---|---|---|---|
| Product: | VCL TeeChart | Reporter: | h.hasenack <hans> |
| Component: | Series | Assignee: | Steema Issue Manager <issuemanager> |
| Status: | CONFIRMED --- | ||
| Severity: | major | CC: | sandra |
| Priority: | High | ||
| Version: | 150901 | ||
| Target Milestone: | --- | ||
| Hardware: | PC | ||
| OS: | Windows | ||
| Chart Series: | Area | Delphi / C++ Builder RAD IDE Version: | |
| Attachments: |
The unpatched result (nitice yellow series drawon over green seirs, making values of green series impossible to analyse
Patch installed. crossing x axis still ugly but at leas values are displayed correctly |
||
|
Description
h.hasenack
2016-07-14 05:04:22 EDT
Created attachment 617 [details]
The unpatched result (nitice yellow series drawon over green seirs, making values of green series impossible to analyse
Created attachment 618 [details]
Patch installed. crossing x axis still ugly but at leas values are displayed correctly
Patches applied to series.pas (using condition compiling for HH_PATCH_TC_STACKEDAREA)
interface
....
TCustomSeries=class(TCustomLineSeries)
....
Function PointOrigin(ValueIndex:Integer; SumAll:Boolean):Double; {$ifdef HH_PATCH_TC_STACKEDAREA} virtual; {$endif}
....
TAreaSeries=Class(TCustomSeries)
....
{$IFDEF HH_PATCH_TC_STACKEDAREA}
Function PointOrigin(ValueIndex:Integer; SumAll:Boolean):Double; override;
{$ENDIF} public
....
implementation
....
{$ifdef HH_PATCH_TC_STACKEDAREA}
// negative values are wrongly stacked in the original code. This overriden
// function calculates the correct origin value for each datapoint
Function TAreaSeries.PointOrigin(ValueIndex:Integer; SumAll:Boolean):Double;
Function LocalPointOrigin:Double;
var t : Longint;
tmpSeries : TChartSeries;
val:double;
sumneg,sumpos:boolean;
Begin
result:=0;
// first of determine wheter we have to sum negative or positive values
val:=MandatoryValueList[ValueIndex];
sumneg:=val<0;
sumpos:=val>=0;
if Assigned(ParentChart) then with ParentChart do
begin
if SumPos then
begin
for t:=0 to SeriesList.Count-1 do
Begin
tmpSeries:=Series[t];
if (not SumAll) and (tmpSeries=Self) then
Break
else
With tmpSeries do
if Active and SameClass(Self) and (tmpSeries.Count>ValueIndex) then
begin
val:=GetOriginValue(ValueIndex);
if (val>=0.0) and sumpos then
result:=result+val
end;
end
end
else if SumNeg then
begin
for t:=0 to SeriesList.Count-1 do
Begin
tmpSeries:=Series[t];
if (not SumAll) and (tmpSeries=Self) then
Break
else
With tmpSeries do
if Active and SameClass(Self) and (tmpSeries.Count>ValueIndex) then
begin
val:=GetOriginValue(ValueIndex);
if (val<0.0) then
result:=result+val
end;
end;
end
end;
end;
Begin
if MultiArea in [maStacked,maStacked100] then
result:=LocalPointOrigin
else result:=inherited PointOrigin(ValueIndex,SumAll);
End;
{$ENDIF}
|