Issues with self stacked bar chart

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
Joschi
Newbie
Newbie
Posts: 26
Joined: Mon Oct 27, 2003 5:00 am
Location: Germany
Contact:

Issues with self stacked bar chart

Post by Joschi » Tue Jan 17, 2006 9:28 am

I just upgraded fom V6 to V7.06 and now experience several problems with a self stacked bar chart.

To reproduce them, please create a self stacked horizontal bar chart with "color Each" activated and a Bar Width of 100%.

Now change the "Points per Page" between 0, 1 and 2. The resulting charts look really strange and none of them as expected.

What I am trying to do is a self stacked bar chart with one bar that fills with a horizontal and vertical size of 100% of the chart. That was working quite OK with V6.

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Wed Jan 18, 2006 9:11 am

Hi Joschi,

Thanks for the report. This is a bug which I'm going to add to our defect list to be fixed for future releases.

In the meantime, you could try creating as many series as points has the original series and set them to stacked instead of self stack the original series.
Best Regards,
Narcís Calvet / 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

Joschi
Newbie
Newbie
Posts: 26
Joined: Mon Oct 27, 2003 5:00 am
Location: Germany
Contact:

Post by Joschi » Wed Jan 18, 2006 10:53 am

Hi Narcis.

When can we expect a version in that this bug is fixed?

Can you provide sample code how to create the series at runtime?

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Wed Jan 18, 2006 11:25 am

Hi Joschi,
When can we expect a version in that this bug is fixed?
We can't commit to a date for now as the bug (TV52011179) is still not fixed. However, it has a high priority on our defect list. I'd suggest you to be aware at the release notes at our Version Info page.
Can you provide sample code how to create the series at runtime?
Yes, you can do:

Code: Select all

procedure TForm1.FormCreate(Sender: TObject);
begin
  Chart1.AddSeries(THorizBarSeries.Create(self));
  Chart1[0].FillSampleValues();
end;
or

Code: Select all

procedure TForm1.FormCreate(Sender: TObject);
var
  HorizBar1: THorizBarSeries;
begin
  HorizBar1:=THorizBarSeries.Create(self);
  Chart1.AddSeries(HorizBar1);
  HorizBar1.FillSampleValues();
end;
Best Regards,
Narcís Calvet / 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

Joschi
Newbie
Newbie
Posts: 26
Joined: Mon Oct 27, 2003 5:00 am
Location: Germany
Contact:

Post by Joschi » Thu Jan 19, 2006 1:19 pm

Hi Narcis,

thanks for the code. I was able to add the BarSeries at runtime, but have some problems sorting them. Before I was using

Code: Select all

BarSeries.XValues.Order := loDescending
or

Code: Select all

BarSeries.SortByLabels;
How can achieve similar sorting when I have stacked series instead of a self stacked chart?

Joschi
Newbie
Newbie
Posts: 26
Joined: Mon Oct 27, 2003 5:00 am
Location: Germany
Contact:

Post by Joschi » Fri Jan 20, 2006 1:10 pm

I found one more issue with your approach to create stacked bar charts: With the self stacked charts, the marks were showing the appropriate percentage. Now all elements of the stacked chart show "100%". How can this be changed?

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Fri Jan 20, 2006 3:41 pm

Hi Joschi,

Yes, this is because each series only has one value and this value represents the 100% of this series. To get the behaviour you request you can do something like:

Code: Select all

procedure TForm1.FormCreate(Sender: TObject);
var
  i: Integer;
  val: Double;
begin
  Randomize;
  Total:=0;

  for i:=0 to Chart1.SeriesCount-1 do
  begin
    val:=random(100);
    Total:=Total+val;
    Chart1[i].Add(val);

    Chart1[i].OnGetMarkText:=Series1GetMarkText;
  end;
end;

procedure TForm1.Series1GetMarkText(Sender: TChartSeries;
  ValueIndex: Integer; var MarkText: String);
begin
  MarkText:=FloatToStr((Sender.YValue[0]/Total)*100)+'%';
end;
Best Regards,
Narcís Calvet / 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

Joschi
Newbie
Newbie
Posts: 26
Joined: Mon Oct 27, 2003 5:00 am
Location: Germany
Contact:

Post by Joschi » Fri Jan 20, 2006 4:24 pm

What is still missing is the answer to my question how to sort the Series similar to the values. Before I was using:

Code: Select all

BarSeries.XValues.Order := loDescending
or

Code: Select all

BarSeries.SortByLabels;
And is it possible that adding TBarSeries to a chart is much slower than adding values to a self stacked bar chart? I experienced that my applications is much slower when creating the chart for a lot of values now.

A lot of workarounds are now necessary to overcome this bug. With V6 I was able to create this chart with only a few lines of code. I just paid good money for the update to V7 and now have all these problems and loose a lot of time because of them. Please make sure that I get until the end of this month what I paid for: A fixed version of TeeChart7 that allows me to create this simple chart!

Pep
Site Admin
Site Admin
Posts: 3299
Joined: Fri Nov 14, 2003 5:00 am
Contact:

Post by Pep » Tue Jan 24, 2006 10:04 am

Hi Joschi,

about the order, you could use the following code :

Code: Select all

procedure TForm1.FormCreate(Sender: TObject);
var bar1,bar2,bar3 : THorizBarSeries;
  i: integer;
  procedure Sort();
  var i,j:integer;
  begin
     with Chart1 do
      for i:=0 to SeriesCount-1 do
        for j:= 0 to i-1 do
          if Chart1[j].Xvalues[0] < Chart1[i].Xvalues[0] then
          begin
            ExchangeSeries(j,i);
          end;
      Chart1.Invalidate;
  end;

begin
  Chart1.View3D:=false;
  with Chart1 do
  begin
    for i := 0 to 2 do
    begin
      AddSeries(THorizBarSeries.Create(Chart1));
      with Chart1[i] as THorizBarSeries  do
      begin
        Add(random(30));
        MultiBar:=mbStacked;
        BarWidthPercent:=100;
        SideMargins:=false;
      end;
    end;
  end;
Sort();
end;
And is it possible that adding TBarSeries to a chart is much slower than adding values to a self stacked bar chart?
Adding values to Series that are stacked or not should be the same.
A lot of workarounds are now necessary to overcome this bug. With V6 I was able to create this chart with only a few lines of code. I just paid good money for the update to V7 and now have all these problems and loose a lot of time because of them. Please make sure that I get until the end of this month what I paid for: A fixed version of TeeChart7 that allows me to create this simple chart!
Sorry for the inconvenience this could cause, we'll try to fix this problem as soon as possible, however I've tried witht he v6.01 and the same problem happens, which TeeChart version and maintenance release are you using ? Could you please post here the complete code you're using the with v6 so I can compare with the v7 ?

Joschi
Newbie
Newbie
Posts: 26
Joined: Mon Oct 27, 2003 5:00 am
Location: Germany
Contact:

Post by Joschi » Tue Jan 24, 2006 2:39 pm

Thank you for the sorting code. Unfortunately it further slows down the creation of the chart.
Adding values to Series that are stacked or not should be the same.
But according to you workaround I additionally need to create a TBarSeries for each value. And creating all these ChartSeries seems to take much more time that just adding these values to an existing series. Can you confirm this?

I also encountered that the application now uses 10-30 MB RAM for each chart that I create that way. This is absolutely unacceptable.
Sorry for the inconvenience this could cause, we'll try to fix this problem as soon as possible, however I've tried witht he v6.01 and the same problem happens, which TeeChart version and maintenance release are you using?
I am currently using TeeChart V7.06.
Could you please post here the complete code you're using the with v6 so I can compare with the v7 ?
The original code that was working with TeeeChart V6 is rahter straight forward and looks like this:

Code: Select all

for i:=0 to Count-1 do begin
  ChartSeries.Add(value[i], Caption[i]);
end;//for i
if SortType = stSize then
  ChartSeries.XValues.Order := loDescending
else
  ChartSeries.SortByLabels;
(Compare this amount of code to all your workarounds!)
To reproduce the bugs, you don't need to write any code, simply follow the inbstructions of my initial posting:

Please create a self stacked horizontal bar chart with "color Each" activated and a Bar Width of 100%. Now change the "Points per Page" between 0, 1 and 2. The resulting charts look really strange and none of them as expected.
we'll try to fix this problem as soon as possible
OK, when approximately can I expect a fix? Your workarounds are simply too slow and too memory consuming. Creating the chart now take about 4-5 seconds, previously it was about 0.5 seconds.

Regards,

Joachim

Joschi
Newbie
Newbie
Posts: 26
Joined: Mon Oct 27, 2003 5:00 am
Location: Germany
Contact:

Post by Joschi » Fri Jan 27, 2006 2:59 pm

Is there any news regarding these issues and the release date of a fixed version?

Pep
Site Admin
Site Admin
Posts: 3299
Joined: Fri Nov 14, 2003 5:00 am
Contact:

Post by Pep » Mon Jan 30, 2006 10:17 am

Hi Joschi,
But according to you workaround I additionally need to create a TBarSeries for each value. And creating all these ChartSeries seems to take much more time that just adding these values to an existing series. Can you confirm this?
Yes, of course, you're correct, I was thinking you was telling that it takes more time adding values to not stacked series than stacked ones.
The original code that was working with TeeeChart V6 is rahter straight forward and looks like this:
I've tried with the v6.01 and I'm getting the same results. Can you confirm it works with the v6.01 of just with v6. Also, would you be so kind to send me a simple example used in v6 directly to pep@steema.com so I can test it ?
OK, when approximately can I expect a fix? Your workarounds are simply too slow and too memory consuming. Creating the chart now take about 4-5 seconds, previously it was about 0.5 seconds.
We'll try to fix it for the next maintenance release v7.07 which will be out soon (before the end of Feb 2006).

Post Reply