Page 1 of 1

BarChart Side by Side

Posted: Wed May 31, 2017 7:05 pm
by 16880166
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.

Re: BarChart Side by Side

Posted: Thu Jun 01, 2017 9:22 am
by 10050769
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

Re: BarChart Side by Side

Posted: Thu Jun 01, 2017 2:39 pm
by 16880166
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?

Re: BarChart Side by Side

Posted: Fri Jun 02, 2017 6:21 am
by 16880166
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. ..

Re: BarChart Side by Side

Posted: Fri Jun 02, 2017 11:32 am
by 10050769
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

Re: BarChart Side by Side

Posted: Fri Jun 02, 2017 2:18 pm
by 16880166
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.

Re: BarChart Side by Side

Posted: Fri Jun 02, 2017 5:18 pm
by 16880166
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

Re: BarChart Side by Side

Posted: Wed Jun 07, 2017 11:27 am
by 10050769
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

Re: BarChart Side by Side

Posted: Wed Jun 07, 2017 3:41 pm
by 16880166
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?

Re: BarChart Side by Side

Posted: Thu Jun 08, 2017 7:30 am
by yeray
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

Re: BarChart Side by Side

Posted: Thu Jun 08, 2017 2:58 pm
by 16880166
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.

Re: BarChart Side by Side

Posted: Thu Jun 08, 2017 3:13 pm
by 16880166
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;

Re: BarChart Side by Side

Posted: Thu Jun 08, 2017 5:07 pm
by 16880166
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!

Re: BarChart Side by Side

Posted: Fri Jun 09, 2017 6:38 am
by yeray
Glad to hear it works fine now!