BarChart Side by Side

TeeChart FireMonkey (Windows,OSX,iOS & Android) for Embarcadero RAD Studio, Delphi and C++ Builder (XE5+)
Post Reply
realsol
Newbie
Newbie
Posts: 70
Joined: Mon Feb 27, 2017 12:00 am

BarChart Side by Side

Post by realsol » Wed May 31, 2017 7:05 pm

How can I keep this chart from overlapping each other? I have them set on the series to display side by side. See attached.

Thanks.
Attachments
2017-05-31_1149.png
2017-05-31_1149.png (21.74 KiB) Viewed 5198 times

Sandra
Site Admin
Site Admin
Posts: 3132
Joined: Fri Nov 07, 2008 12:00 am

Re: BarChart Side by Side

Post by Sandra » Thu Jun 01, 2017 9:22 am

Hello realsol,

To do as Series are drawn side by side, you need active the BarStack propierty Side by Side. The code below shows you how can do it:

Code: Select all

var Series1,Series2,Series3,Series4: TBarSeries;
procedure TForm1.FormCreate(Sender: TObject);
begin
     Series1 := TBarSeries.Create(Self);
     Series2 := TBarSeries.Create(Self);
     Series3 := TBarSeries.Create(Self);
     Series4 := TBarSeries.Create(Self);
     Chart1.AddSeries(Series1);
     Chart1.AddSeries(Series2);
     Chart1.AddSeries(Series3);
     Chart1.AddSeries(Series4);
     Series1.FillSampleValues(5);
     Series2.FillSampleValues(5);
     Series3.FillSampleValues(5);
     Series4.FillSampleValues(5);
     Series1.Marks.Visible := False;
     Series2.Marks.Visible := False;
     Series3.Marks.Visible := False;
     Series4.Marks.Visible := False;
     Series1.MultiBar := mbSide;
end;
Hoping this helps you, otherwise don't hesistate to contact us.
Thanks in advance
Best Regards,
Sandra Pazos / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

realsol
Newbie
Newbie
Posts: 70
Joined: Mon Feb 27, 2017 12:00 am

Re: BarChart Side by Side

Post by realsol » Thu Jun 01, 2017 2:39 pm

Sandra wrote:Hello realsol,

To do as Series are drawn side by side, you need active the BarStack propierty Side by Side. The code below shows you how can do it:

Code: Select all

var Series1,Series2,Series3,Series4: TBarSeries;
procedure TForm1.FormCreate(Sender: TObject);
begin
     Series1.MultiBar := mbSide;
end;
Hoping this helps you, otherwise don't hesistate to contact us.
Thanks in advance
I had that set for the Series already in the IDE but added it in my OnCreate procedure, but it still makes no difference. What other properties might cause this?

realsol
Newbie
Newbie
Posts: 70
Joined: Mon Feb 27, 2017 12:00 am

Re: BarChart Side by Side

Post by realsol » Fri Jun 02, 2017 6:21 am

Also, please see my earlier post where it was supposed to be addressed: http://www.teechart.net/support/viewtop ... 17&t=16485. In that post the did address the 'Other Slice' in the pie chart, but no word no the bar chart fix. ..

Sandra
Site Admin
Site Admin
Posts: 3132
Joined: Fri Nov 07, 2008 12:00 am

Re: BarChart Side by Side

Post by Sandra » Fri Jun 02, 2017 11:32 am

Hello realsol,

We are doing many test to verify if the bug is fixed or not for next maintenance release, so I can't reproduce it using our production TeeChart Pro/VCL source code.

Thanks in advance
Best Regards,
Sandra Pazos / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

realsol
Newbie
Newbie
Posts: 70
Joined: Mon Feb 27, 2017 12:00 am

Re: BarChart Side by Side

Post by realsol » Fri Jun 02, 2017 2:18 pm

Are there any settings I might have accidentally changed that would cause this? I think I used the basic bar chart settings but could have accidentally changed a setting that causes this. What is weird is some months print OK. Others don't.

realsol
Newbie
Newbie
Posts: 70
Joined: Mon Feb 27, 2017 12:00 am

Re: BarChart Side by Side

Post by realsol » Fri Jun 02, 2017 5:18 pm

If I set View3d to false, all the bars line up like they are suppose too. Here are 3 images.

1. Chart in 3d
2. Chart without 3d
3. My chart 3d settings
Attachments
2017-06-02_1017.png
2017-06-02_1017.png (20.91 KiB) Viewed 5157 times
2017-06-02_1016.png
2017-06-02_1016.png (19.45 KiB) Viewed 5161 times
2017-06-02_1015.png
2017-06-02_1015.png (28.97 KiB) Viewed 5160 times

Sandra
Site Admin
Site Admin
Posts: 3132
Joined: Fri Nov 07, 2008 12:00 am

Re: BarChart Side by Side

Post by Sandra » Wed Jun 07, 2017 11:27 am

Hello realsol,

Sorry for the delay.

I would like inform you that the problem occurs when is set the Xvalues property Order to Descending. Therefore, as a workaround, I would suggest you set the XValues order for each series to None. The code below shows you how:

Code: Select all

  Chart1[0].XValues.Order := loNone;
  Chart1[1].XValues.Order := loNone;
Hoping this helps you.
Thanks in advance
Best Regards,
Sandra Pazos / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

realsol
Newbie
Newbie
Posts: 70
Joined: Mon Feb 27, 2017 12:00 am

Re: BarChart Side by Side

Post by realsol » Wed Jun 07, 2017 3:41 pm

I have 'None' already set in the ide so I added to the MainForm.OnCreate. No difference.

Also, in this situation, X is a date. Late I change the 'X' value to an integer set to 'None' and still they overlap. I hate not using 3d on my first release using your product since it looks so nice and I have a 3d chart right below it.

Any other suggestions?

Yeray
Site Admin
Site Admin
Posts: 8705
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: BarChart Side by Side

Post by Yeray » Thu Jun 08, 2017 7:30 am

Hello,

Try setting the Order as loAscending instead of loNone. Ie:

Code: Select all

  Chart1[1].XValues.Order:=loAscending;
  Chart1[1].XValues.Sort;
  Chart1.Repaint;
This works in the test project in #1820
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

realsol
Newbie
Newbie
Posts: 70
Joined: Mon Feb 27, 2017 12:00 am

Re: BarChart Side by Side

Post by realsol » Thu Jun 08, 2017 2:58 pm

I tried to add that to the end of my OnCreate method:

Code: Select all

  DBChart2[1].XValues.Order:=loAscending;
  DBChart2[1].XValues.Sort;
  DBChart2.Repaint;
Same result as before. Again, only when printed in 3d.

realsol
Newbie
Newbie
Posts: 70
Joined: Mon Feb 27, 2017 12:00 am

Re: BarChart Side by Side

Post by realsol » Thu Jun 08, 2017 3:13 pm

After looking at the code again, I figure the 'sort' is a method, thus needs values to sort, so I moved the code right after I assign the series it's values, but they still overlap.

Code: Select all

TopQuery.Active := true;
          if DBChart2[1] <> nil then
          begin
            DBChart2[1].XValues.Order:=loAscending;
            DBChart2[1].XValues.Sort;
            DBChart2.Repaint;
          end;

realsol
Newbie
Newbie
Posts: 70
Joined: Mon Feb 27, 2017 12:00 am

Re: BarChart Side by Side

Post by realsol » Thu Jun 08, 2017 5:07 pm

Got it working. I needed to Sort each of the 1 to 4 Series that might be active in a for to loop.

Code: Select all

          TopQuery.Active := true;
          DBChart2[i].XValues.Order:=loAscending;
          DBChart2[i].XValues.Sort;
          DBChart2.Repaint;
Thanks for your help!

Yeray
Site Admin
Site Admin
Posts: 8705
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: BarChart Side by Side

Post by Yeray » Fri Jun 09, 2017 6:38 am

Glad to hear it works fine now!
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

Post Reply