THistogram

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
Philip Bairstow
Newbie
Newbie
Posts: 10
Joined: Fri Nov 15, 2002 12:00 am

THistogram

Post by Philip Bairstow » Mon Oct 17, 2005 10:30 am

I am using Delphi 7 Build 8.1 and TeeChart Pro 5.3

I am using a THistogram series to draw a transparent rectangle over a selected portion of a graph. The THistogram uses the left axis ( min = 61, max = 65, increment = 1) bottom axis ( min = 0, max = 387, increment = 15 ) of the chart.

I have plotted the following points:

AddXY( 0, 212 );
AddXY( 0, 253 );
AddXY( 387, 253 );
AddXY( 387, 212 );

But for some reason the X value of '0' seems to have a ‘offset’ added to it when it appears on the graph of about 98, as a result the graph extends over the right axis by about 98.

On my graph this is series 3 which is a THistogramSeries, series 1 and 2 are TLineSeries and they ploted correctly.

Has anyone else had similar problems or can anyone suggest what the problem could be ?
Kind Regards

Philip

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

Post by Narcís » Mon Oct 17, 2005 1:25 pm

Hi Philip,

I'm not able to reproduce what you report here using the code below:

Code: Select all

procedure TForm1.FormCreate(Sender: TObject);
var i,j: Integer;
begin
  With Chart1 do
  begin
    LeftAxis.SetMinMax(61,65);
    LeftAxis.Increment:=1;
    BottomAxis.SetMinMax(0,387);
    BottomAxis.Increment:=15;
  end;

  for i:=0 to 1 do
    for j:=0 to 387 do
      Chart1[i].Add(61+random(5));

  With Series3 do
  begin
    AddXY( 0, 212 );
    AddXY( 0, 253 );
    AddXY( 387, 253 );
    AddXY( 387, 212 );
  end;
end;
Can you please test if this works for you? Please feel free to modify it so that we can reproduce the problem here.

You could also try custom drawing on TChart's canvas in the OnAfterDraw event:

Code: Select all

procedure TForm1.Chart1AfterDraw(Sender: TObject);
begin
  With Chart1.Canvas do
  begin
    Brush.Color:=clYellow;
    Brush.Style:=bsClear;
    Pen.Color:=clBlue;
    Pen.Style:=psDot;
    Rectangle(Chart1.LeftAxis.PosAxis,Chart1.BottomAxis.PosAxis,
                Chart1.BottomAxis.IEndPos,Chart1.LeftAxis.IStartPos);
  end;
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

Philip Bairstow
Newbie
Newbie
Posts: 10
Joined: Fri Nov 15, 2002 12:00 am

THistogram

Post by Philip Bairstow » Mon Oct 17, 2005 2:12 pm

Hi narcis,

I have sent an email for your attension to support@steema.com with two screen shots, one is the screen shot of the graph produced with the sample code you provided, the other is the graph produced with my origional code. See what you think.

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

Post by Narcís » Mon Oct 17, 2005 2:32 pm

Hi Philip,

That e-mail address is no longer working. You can post your files at our public newsgroups ([url]news://www.steema.net/steema.public.attachments[/url]).
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

Philip Bairstow
Newbie
Newbie
Posts: 10
Joined: Fri Nov 15, 2002 12:00 am

THistogram

Post by Philip Bairstow » Tue Oct 18, 2005 8:32 am

Hi narcis,

I uploaded the pictures to news://www.steema.net/steema.public.attachments last night, have a look at them and see what you think. There does not seem to be a zero problem using your sample code but it is plotted beyond the right axis. You can see the zero problem I was having on the other bitmap.

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

Post by Narcís » Tue Oct 18, 2005 8:39 am

Hi Philip,

Thanks for the screen-shots. I can see the problem on them. Could you please send us an example we can run "as-is" to reproduce the problem here and try to help you finding a solution?

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

Philip Bairstow
Newbie
Newbie
Posts: 10
Joined: Fri Nov 15, 2002 12:00 am

THistogram

Post by Philip Bairstow » Tue Oct 18, 2005 9:16 am

Hi narcis,

I have posted a sample application that produces the problem on the news group.

Philip Bairstow
Newbie
Newbie
Posts: 10
Joined: Fri Nov 15, 2002 12:00 am

THistogram

Post by Philip Bairstow » Wed Oct 19, 2005 9:32 am

Hi Narcís,

I don't want to sound pushy but have you had chance to look at the code I posted on news://www.steema.net/steema.public.attachments

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 Oct 19, 2005 9:40 am

Hi Philip,

Yes, I had a look at it and have been able to reproduce the problem here but haven't found what is causing it. We'll have a closer look to see if we can find a solution or at least a workaround. I'll get back to you when I have some news.
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

Philip Bairstow
Newbie
Newbie
Posts: 10
Joined: Fri Nov 15, 2002 12:00 am

THistogram

Post by Philip Bairstow » Wed Oct 19, 2005 9:45 am

Hi Narcís,

It's good to hear that you have been able to reproduce the problem and that you are looking at it. I will probably start working on another job now while I await news from you. Thanks you for you help so far.

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

Post by Narcís » Thu Oct 20, 2005 2:46 pm

Hi Philip,

We have seen that there's a problem with transparency using THistogramSeries. However, in your example with v5 there's also something else which makes it worse. I'm going to add this problem to our defect list to be fixed for future releases.

In the meantime, we'd suggest you to use a TColorBandTool as done in the example at the attachments newsgroup. Please notice that this example is the one you sent but adapted to run here for us and using TeeChart Pro v7 (the problem is the same that in v5).
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

Philip Bairstow
Newbie
Newbie
Posts: 10
Joined: Fri Nov 15, 2002 12:00 am

THistogram

Post by Philip Bairstow » Fri Oct 21, 2005 3:39 pm

Hi Narcis,

I received the updated source that you posted on the attachments newsgroup. Using a Color Band seems to work however I have a slight problem. The reason for the color band or as I had done origionaly the histogram was to highlight a portion of readings. The portion of readings was indicated using the bottom axis or reading number.Using the Color Band I highlight the start and end value ( across the bottom axis ) but I can not control how far up the Y axis the Band sometimes extends to the top axis, sometimes it only extends half way up the Y axis and other times it does not appear at all. So the question is can I tell the Color Band how far up the Y axis to plot ? Thank you for all your help.

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

Post by Narcís » Mon Oct 24, 2005 7:33 am

Hi Philip,

Yes, you can associate the ColorBand to the left axis so that it covers all XValues and set its StartValue and EndValue for the YValues.
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

Post Reply