![]() | 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: | Adding a new series messes up the custom palette | ||
|---|---|---|---|
| Product: | VCL TeeChart | Reporter: | h.hasenack <hans> |
| Component: | Editors | Assignee: | Steema Issue Manager <issuemanager> |
| Status: | IN_PROGRESS --- | ||
| Severity: | major | CC: | algonzalez74, yeray |
| Priority: | --- | ||
| Version: | 20.170306 | ||
| Target Milestone: | --- | ||
| Hardware: | PC | ||
| OS: | Windows | ||
| Chart Series: | --- | Delphi / C++ Builder RAD IDE Version: | |
|
Description
h.hasenack
2016-11-08 08:44:14 EST
Here's the fix, in TeeGally.pas mared with HH_PATCH_REGISTERPALETTE
-------------------
Function CreateNewSeriesGallery( const AOwner:TComponent;
const OldSeries:TChartSeries;
const tmpChart:TCustomAxisPanel;
ShowFunctions,
CheckSeries:Boolean;
Var SubIndex : Integer;
AGalleryWidth: Integer=0;
AGalleryHeight: Integer=0 ):TChartSeries;
function InternalShowGallery:TChartSeries;
var Show3D : Boolean;
tmpClass : TChartSeriesClass;
tmpFunctionClass : TTeeFunctionClass;
tmpPalette : Integer;
{$ifdef HH_PATCH_REGISTERPALETTE}
tmpColorPalette:TColorArray;
{$endif}
tmpOwner : TComponent;
begin
result:=nil;
Show3D:=tmpChart.View3D;
tmpPalette:=(tmpChart as TCustomChart).ColorPaletteIndex;
{$ifdef HH_PATCH_REGISTERPALETTE}
tmpColorPalette:=(tmpChart as TCustomChart).ColorPalette;
{$endif}
//If we show the gallery from the chart editor we use its gallery size
if (AOwner is TChartEditForm) and
(TChartEditForm(AOwner).GalleryWidth>0) and
(TChartEditForm(AOwner).GalleryHeight>0) then
begin
AGalleryWidth:=TChartEditForm(AOwner).GalleryWidth;
AGalleryHeight:=TChartEditForm(AOwner).GalleryHeight;
end;
if GetChartGalleryClass(AOwner,OldSeries,ShowFunctions,tmpClass,Show3D,
tmpFunctionClass,CheckSeries,SubIndex,
tmpPalette, AGalleryWidth, AGalleryHeight,
tmpChart) then
begin
tmpChart.View3D:=Show3D;
(tmpChart as TCustomChart).ColorPaletteIndex:=tmpPalette;
{$ifdef HH_PATCH_REGISTERPALETTE}
if tmpPalette<0 then // restore custom palette
(tmpChart as TCustomChart).ColorPalette:=tmpColorPalette;
{$endif}
if (not Assigned(OldSeries)) or
(ShowFunctions or ((tmpClass<>OldSeries.ClassType) or (SubIndex<>-1))) then
begin
if Assigned(OldSeries) then tmpOwner:=OldSeries.Owner
else tmpOwner:=TCustomAxisPanelAccess(tmpChart).GetDesignOwner;
result:=CreateNewSeries(tmpOwner,tmpChart,tmpClass,tmpFunctionClass);
if SubIndex<>-1 then
TSeriesAccess(result).SetSubGallery(result,SubIndex);
end;
end;
end;
begin
try
result:=InternalShowGallery;
except
on E:Exception do
begin
{$IFDEF TEEEXCEPTIONS}
if csDesigning in tmpChart.ComponentState then
TTeeExceptionForm.Send('GALL',E);
{$ENDIF}
raise;
end;
end;
end;
|