different bar-width after Upgrade from Vers. 8 to 2012

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
Steffen
Newbie
Newbie
Posts: 23
Joined: Mon Sep 07, 2009 12:00 am

different bar-width after Upgrade from Vers. 8 to 2012

Post by Steffen » Fri Jan 18, 2013 3:01 pm

Hi,

I consider an upgrade from Teechart VCL 8 to 2012 but am a little confused about the different "look" of one of my projects.

Here is how the chart looked like when compiled with 8.06 (Delphi 2007):
Image
http://www.swiftease.de/images/Screensh ... rt8.06.png

and here with the 2012 Trial Version (same Delphi installation, no change in code):
Image
http://www.swiftease.de/images/Screensh ... 012.07.png

The bars are much thinner. I played with the Series / % Bar width value already but with no effect.

How can I return to the old look with 2012?

Thanks for advice,
Steffen

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

Re: different bar-width after Upgrade from Vers. 8 to 2012

Post by Yeray » Fri Jan 18, 2013 3:37 pm

Hi Steffen,

The following example seems to look the same in v8 and in v2012 for me here. Could you please give it a try and tell us if you get the thin bars also with v8?

Code: Select all

uses Chart, Series;

procedure TForm1.FormCreate(Sender: TObject);
var Chart1: TChart;
begin
  Chart1:=TChart.Create(Self);
  Chart1.Parent:=Self;
  Chart1.Align:=alClient;

  Chart1.AddSeries(TBarSeries).FillSampleValues(50);

  Chart1.Axes.Bottom.SetMinMax(-0.5, 10.5);
end;
ThinBars.png
ThinBars.png (31.32 KiB) Viewed 15493 times
If you get thin Bars with your TeeChart v8 environment, could you please arrange a simple example project we can run as-is to reproduce the wide bars with v8 and thin bars with v2012 here?
Thanks in advance.
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

Steffen
Newbie
Newbie
Posts: 23
Joined: Mon Sep 07, 2009 12:00 am

Re: different bar-width after Upgrade from Vers. 8 to 2012

Post by Steffen » Fri Jan 18, 2013 3:56 pm

Hi Yeray,

... with your code I get thin bars with Ver. 2012 but thick bars with Vers. 8:

Image

?

Best regards,
Steffen

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

Re: different bar-width after Upgrade from Vers. 8 to 2012

Post by Yeray » Tue Jan 22, 2013 8:32 am

Hi Steffen,

Sorry, I was doing the tests with the latest v8 and I've just realized this behaviour actually changed from v8.06 to v8.07.
However, setting the TBarSeries' AutoBarSize property to true seems to work fine for me here. Could you please give it a try?
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

Steffen
Newbie
Newbie
Posts: 23
Joined: Mon Sep 07, 2009 12:00 am

Re: different bar-width after Upgrade from Vers. 8 to 2012

Post by Steffen » Tue Jan 22, 2013 8:54 am

Hi Yeray,

I can't use V8.07 or 8.08 because these version seem to contain a bug which lead to heavy flickering.

In V2012 I can't find an AutoBarSizeCheckbox, please state exakt location.

Best Regards,
Steffen

Steffen
Newbie
Newbie
Posts: 23
Joined: Mon Sep 07, 2009 12:00 am

Re: different bar-width after Upgrade from Vers. 8 to 2012

Post by Steffen » Tue Jan 22, 2013 11:26 am

... setting barseries.AutoBarSize := true in DBChart1BeforeDrawSeries had no effect in V2012, bars stay thin!

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

Re: different bar-width after Upgrade from Vers. 8 to 2012

Post by Yeray » Tue Jan 22, 2013 11:58 am

Hi Steffen,

Please, create a new application just with the following code:

Code: Select all

uses Chart, Series;

procedure TForm1.FormCreate(Sender: TObject);
var Chart1: TChart;
begin
  Chart1:=TChart.Create(Self);
  Chart1.Parent:=Self;
  Chart1.Align:=alClient;

  with Chart1.AddSeries(TBarSeries) as TBarSeries do
  begin
    FillSampleValues(50);
    AutoBarSize:=true;
  end;

  Chart1.Axes.Bottom.SetMinMax(-0.5, 10.5);
end;
Using TeeChart v2012.07, I get this:
2013-01-22_1257.png
2013-01-22_1257.png (21.17 KiB) Viewed 15343 times
Please, check the library and search paths.
Don't you get the same?
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

Steffen
Newbie
Newbie
Posts: 23
Joined: Mon Sep 07, 2009 12:00 am

Re: different bar-width after Upgrade from Vers. 8 to 2012

Post by Steffen » Tue Jan 22, 2013 12:25 pm

Hi Yeray,

out last two posts have crossed.

First of all: Yes, If I execute your above code with V2012 I get the same result as you.

I think I found the problem: It occurs when Crosstab data gets involved, which is the true in my case.

I seems like every sub-series of crosstab-data need to be set to AutoBarSize := true like in your last code but as it is a crosstab, there is no .AddSeries event.

Best regards,
Steffen

Steffen
Newbie
Newbie
Posts: 23
Joined: Mon Sep 07, 2009 12:00 am

Re: different bar-width after Upgrade from Vers. 8 to 2012

Post by Steffen » Tue Jan 22, 2013 12:39 pm

Dear Yeray,

the post that I announce to have crossed with yours has not been submitted by mistake.

I mentioned therein that I already posted a bug in crosstab bar width back in 2009: http://www.teechart.net/support/viewto ... 66#p44266

The "70%" workaround you recommended and that worked nicely in V8.06 is set out of practice by setting barseries.AutoBarSize := true in DBChart1BeforeDrawSeries, as shown here:

Image

Does it help to understand the nature of the problem?

Brgds,
Steffen

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

Re: different bar-width after Upgrade from Vers. 8 to 2012

Post by Yeray » Tue Jan 22, 2013 1:23 pm

Hi Steffen,

I see in that thread you posted an example but it uses a component we don't have here: Advantage Database client.
It would be helpful if you could arrange a simple example project we can run as-is to reproduce the problem here.

Thanks in advance.
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

Steffen
Newbie
Newbie
Posts: 23
Joined: Mon Sep 07, 2009 12:00 am

Re: different bar-width after Upgrade from Vers. 8 to 2012

Post by Steffen » Tue Jan 22, 2013 2:07 pm

Hi Yeray,

Advantage database client for Delphi is free: http://devzone.advantagedatabase.com/dz ... latform=11
It includes the local database server.

Can you run the sample now?

Brgds.
Steffen

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

Re: different bar-width after Upgrade from Vers. 8 to 2012

Post by Yeray » Tue Jan 22, 2013 4:26 pm

Hi Steffen,

Note it would be preferable if we could get projects which all the dependences were on TeeChart and the components shipped with the IDE.
Anyway, I've installed Advantage Database Components as indicated and made your project run with the actual TeeChart sources.
If I run your project as-is, when I select the first, and some other series, I see the first series is wider.
If I edit the dmf ("View as Text" option at the design view) I see Series1 was set to have BarWidthPercent=75. Then, if I remove this line, or I set the BarWidthPercent to 70 as said in the thread where this was initially reported, this seems to be solved.

Then, if I zoom the chart, showing only 2 bars, I see the bar sizes don't vary. And I understand this is the behaviour you'd like to change. But adding this at OnCreate seems to change the behaviour correctly:

Code: Select all

PROCEDURE TForm1.FormCreate(Sender: TObject);
var i: Integer;
BEGIN
   AdsConnection1.ConnectPath := ExtractFileDir(Application.ExeName);
   AdsConnection1.IsConnected := true;
   AdsQuery1.Open;
   dbchart1.SeriesList.AllActive := false;

  for i:=0 to DBChart1.SeriesCount-1 do
    (DBChart1[i] as TBarSeries).AutoBarSize:=true;

//  Series1.BarWidthPercent:=70; //use this or remove the BarWidthPercent=75 line on the dfm.
END;
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

Steffen
Newbie
Newbie
Posts: 23
Joined: Mon Sep 07, 2009 12:00 am

Re: different bar-width after Upgrade from Vers. 8 to 2012

Post by Steffen » Wed Jan 23, 2013 11:14 am

Hi Yeray,

stupid me - I could have thought of looping through crosstab series and setting AutoBarSize after opening database as well!

In order to avoid a runtime error for other series then TBarSeries, I used this code:

for i := 0 to DBChart1.SeriesCount - 1 do
if (DBChart1 is TBarSeries) then
(DBChart1 as TBarSeries).AutoBarSize := true;

Now everything works fine, Gracias Yeray :D

Saludos,
Steffen

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

Re: different bar-width after Upgrade from Vers. 8 to 2012

Post by Yeray » Wed Jan 23, 2013 3:23 pm

Hi Steffen,

Glad to be helpful!

De nada, Steffen! ;)
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