I have 3 bars per date and the bars overlap. It seems to be by creation order so the older ones are behind the newer ones. How do I eliminate this overlapping behavior?
Thanks
Overlapping bars
Re: Overlapping bars
Hello,
Please make sure the three bars have the same XValue.
Here it is a simple example doing something similar to what I understood you are doing, and I see no overlapping bars:
If you still find problems with it, please arrange a simple example project we can run as-is to reproduce the problem here.
Please make sure the three bars have the same XValue.
Here it is a simple example doing something similar to what I understood you are doing, and I see no overlapping bars:
Code: Select all
uses Series, DateUtils;
procedure TForm1.FormCreate(Sender: TObject);
var i, j: Integer;
tmpDate: TDateTime;
begin
Chart1.Axes.Bottom.LabelStyle:=talPointValue;
for i:=0 to 2 do
with Chart1.AddSeries(TBarSeries) as TBarSeries do
begin
XValues.DateTime:=true;
for j:=0 to 3 do
begin
tmpDate:=IncDay(Today, j);
AddXY(tmpDate, 25+random*75);
end;
end;
end;
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
Re: Overlapping bars
Here's the full code-
I will email you a screen shot of the overlapping bars if you want. I dont see how to upload images here.
Code: Select all
procedure TfrmPsrGraph.SetupGraph(const v1,v2,v3:shortstring);
var
xBar1,xBar2,xBar3:TBarSeries;
xLine1,xLine2,xLine3:TLineSeries;
xTrend:TTrendFunction;
i:integer;
m, b: Double;
begin
xTrend:=TTrendFunction.Create(self);
for i := chtPSR.SeriesCount -1 downto 0 do
chtPSR.Series[i].Free;
CalcScrapPercent;
// chtPSR.Axes.Bottom.LabelStyle:=talPointValue; //only show dates with data
xBar3:=TBarSeries.Create(chtPSR);
xBar3.ParentChart:=chtPSR;
xBar3.DataSource:=fPSRTable;
xBar3.YValues.ValueSource:=v3;
xBar3.XValues.ValueSource:='psrdate';
xBar3.XValues.DateTime:=true;
xBar3.ShowInLegend:=false;
xBar3.Marks.Visible:=false;
xBar3.color:=clAqua;
xBar3.RefreshSeries;
xBar3.Title:='s3 ';
xBar3.ShowInLegend:=true;
xBar1:=TBarSeries.Create(chtPSR);
xBar1.ParentChart:=chtPSR;
xBar1.DataSource:=fPSRTable;
xBar1.YValues.ValueSource:=v1;
xBar1.XValues.ValueSource:='psrdate';
xBar1.XValues.DateTime:=true;
xBar1.ShowInLegend:=false;
xBar1.Marks.Visible:=false;
xBar1.color:=clRed;
xBar1.RefreshSeries;
xBar1.Title:='s1 ';
xBar1.ShowInLegend:=true;
xBar2:=TBarSeries.Create(chtPSR);
xBar2.ParentChart:=chtPSR;
xBar2.DataSource:=fPSRTable;
xBar2.YValues.ValueSource:=v2;
xBar2.XValues.ValueSource:='psrdate';
xBar2.XValues.DateTime:=true;
xBar2.ShowInLegend:=false;
xBar2.Marks.Visible:=false;
xBar2.color:=clGreen;
xBar2.RefreshSeries;
xBar2.Title:='s2 ';
xBar2.ShowInLegend:=true;
if pos('scrap',v1)>0 then begin
MakeTitle('SCRAP: ');
xBar3.Title:='s3 '+formatfloat('0.00%',fScrap.s3);
xBar1.Title:='s1 '+formatfloat('0.00%',fScrap.s1);
xBar2.Title:='s2 '+formatfloat('0.00%',fScrap.s2);
end
else MakeTitle('PRODUCTION: ');
if cb3rd.Checked then AddTrend(xBar3,xLine3);
if cb1st.Checked then AddTrend(xBar1,xLine1);
if cb2nd.Checked then AddTrend(xBar2,xLine2);
chtPSR.BottomAxis.ExactDateTime:=true;
chtPSR.BottomAxis.DateTimeFormat:='m/d';
chtPSR.BottomAxis.Increment:= DateTimeStep[dtOneDay];
end;
Re: Overlapping bars
Hello,
Please arrange a simple example project we can run as-is to reproduce the problem here.
See the instructions in my signature.
This is not the full code. There is a table I don't know (fPSRTable), some unknown variables (v1, v2, v3, fScrap) and some unknown methods (CalcScrapPercent, AddTrend).Numinor wrote:Here's the full code-
Please arrange a simple example project we can run as-is to reproduce the problem here.
See the instructions in my signature.
Here you have the instructions to attach a file in phpbb forums. It's quite straightforward. While you are writting a reply or a new message, if you scroll down you'll find the "Upload attachment" tab. You click on the "Browse..." button, you select your file and you click the "Add the file" button.Numinor wrote:I will email you a screen shot of the overlapping bars if you want. I dont see how to upload images here.
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |