Page 1 of 1
THistogram
Posted: Mon Oct 17, 2005 10:30 am
by 5885221
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 ?
Posted: Mon Oct 17, 2005 1:25 pm
by narcis
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;
THistogram
Posted: Mon Oct 17, 2005 2:12 pm
by 5885221
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.
Posted: Mon Oct 17, 2005 2:32 pm
by narcis
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]).
THistogram
Posted: Tue Oct 18, 2005 8:32 am
by 5885221
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.
Posted: Tue Oct 18, 2005 8:39 am
by narcis
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.
THistogram
Posted: Tue Oct 18, 2005 9:16 am
by 5885221
Hi narcis,
I have posted a sample application that produces the problem on the news group.
THistogram
Posted: Wed Oct 19, 2005 9:32 am
by 5885221
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
Posted: Wed Oct 19, 2005 9:40 am
by narcis
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.
THistogram
Posted: Wed Oct 19, 2005 9:45 am
by 5885221
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.
Posted: Thu Oct 20, 2005 2:46 pm
by narcis
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).
THistogram
Posted: Fri Oct 21, 2005 3:39 pm
by 5885221
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.
Posted: Mon Oct 24, 2005 7:33 am
by narcis
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.