Rounded border and colored panel issue

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
JazzMan
Newbie
Newbie
Posts: 37
Joined: Fri Jun 18, 2004 4:00 am

Rounded border and colored panel issue

Post by JazzMan » Thu Nov 20, 2008 3:01 am

Folks,

If I set the back panel to some non-white color, and set borders visible and rounded:

Code: Select all

    Chart1.Border.Visible := TRUE;

    with Chart1 do begin
       BorderRound    := 100;
       BorderStyle  := bsSingle;

       Border.Width := 50;
       Border.Color := clRed;
    end
the back panel's square corners are clearly visible, sticking out on "the wrong side" of each rounded corner. Can they be, in effect, masked off or clipped?

I searched the forum, but came up empty-handed.

Thanks!
Regards,
richard diamond

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 Nov 20, 2008 8:48 am

Hi richard,

I think I don't get exactly what you reported. With both, v7 and v8, I get something this:

Image

Is this what you get? Anyway, I have added the issue to the defect list (TV52013579) to be fixed.
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

JazzMan
Newbie
Newbie
Posts: 37
Joined: Fri Jun 18, 2004 4:00 am

Post by JazzMan » Thu Nov 20, 2008 2:30 pm

Narcís,

Sorry I wasn't clear (at all). It's simple to recreate, it's just my description that sucked.

Chart1.Color. That's what I should have said. Set Chart1.Color to something like clRed . I think then you'll see the issue I'm describing immediately.

By the way, there's a faint, but visible, white (rounded border) line JUST on the inside of each rounded corner in your screen shot. I've seen that before. Can that be taken out of a generated chart by setting a property to match Chart1.Color?

richard diamond

JazzMan
Newbie
Newbie
Posts: 37
Joined: Fri Jun 18, 2004 4:00 am

Post by JazzMan » Thu Nov 20, 2008 2:43 pm

Narcís,

Uhhh.. I'm not awake yet.... NOT CLRED! (but you knew I didn't mean that!).

Please try setting Chart1.Color to anything BUT clRed. clBlue is a fine choice..;)

I need BrainChecker. For Christmas maybe, you'll get me that? Huh? Huh?


richard diamond

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

Post by Pep » Mon Nov 24, 2008 10:52 am

Hello,

to hide it change the BevelOuter to :

Chart1.BevelOuter := bvNone;

JazzMan
Newbie
Newbie
Posts: 37
Joined: Fri Jun 18, 2004 4:00 am

Post by JazzMan » Mon Nov 24, 2008 4:04 pm

Pep,

Thank you for your reply..:)

I must have described the problem wrong, so maybe the screenshot (I made it Christmassy..;) I just uploaded will help. The English language can be very slippery. Perhaps that's why no one programs in it???!!!

I do set bvInner and bvOuter to bvNone, yet you see the effect. So there's something I'm leaving out of my problem description.

Regards,
richard diamond

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 Nov 24, 2008 6:35 pm

Hi richard,

In v8 there's it works almost fine but there's also a little problem which I already added to the defect list (TV52013598).

However, to solve this problem you can do something like code below. Specially note code in OnAfterDraw event. Can you please check if this works fine at your end?

Code: Select all

procedure TForm1.FormCreate(Sender: TObject);
begin
  Series1.ExplodeBiggest:= 20;
  Series1.Marks.Transparent:=true;
  Series1.Shadow.Visible := false;

  Chart1.Border.Visible := True;
  Chart1.BevelOuter := bvNone;
  chart1.Color := clred;

    with Chart1 do begin
       BorderRound    := 50;
       BorderStyle  := bsSingle;

       Border.Width := 25;
       Border.Color := clgreen
    end
    end;

procedure TForm1.Chart1AfterDraw(Sender: TObject);
begin
  Chart1.Canvas.Brush.Style := bsClear;
  Chart1.Canvas.pen.Color := clgreen;
  Chart1.Canvas.pen.Width := 50;
  Chart1.canvas.RoundRect(Chart1.ChartBounds,50,50);
end;
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

JazzMan
Newbie
Newbie
Posts: 37
Joined: Fri Jun 18, 2004 4:00 am

Post by JazzMan » Mon Nov 24, 2008 8:32 pm

Narcís,

I'm just going to start calling you Magic Man..:) It worked fine!!!

With just a few variations to your sample OnAfteDrawEvent, it does exactly what was needed!! It now responds perfectly to the users' requested width, rounding, and color choices:

Code: Select all

with Chart1.Canvas do begin
  Brush.Style := bsClear;
  Pen.Color   := clrGetBackPanelBorder;
  Pen.Width   := iGetBackPanelBorderWidth;
  RoundRect( Chart1.ChartBounds, Pen.Width, Pen.Width  );
end;
Thank you so much..:)

richard diamond

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 Nov 25, 2008 11:09 am

Hi richard,

You're welcome! I'm glad to hear that worked
I'm just going to start calling you Magic Man.
Je je, you'd better use Magic Team as I needed Pep's help here :wink:.
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

JazzMan
Newbie
Newbie
Posts: 37
Joined: Fri Jun 18, 2004 4:00 am

Post by JazzMan » Tue Nov 25, 2008 4:06 pm

Narcís, okay, Dream Team it is...:)

I played with it a bit, and noticed a few things that might be of interest to others watching this thread, or reading it down the road in a search.

1) Your sample AfterDraw handler, which was great, had one small issue. The FormCreate border width of 25 in wasn't reflected in AfterChart's Pen.Width. Instead, it showed it at 50. I didn't notice that at first:

Code: Select all

procedure TForm1.Chart1AfterDraw(Sender: TObject);
begin
  Chart1.Canvas.Brush.Style := bsClear;
  Chart1.Canvas.pen.Color := clgreen;
  Chart1.Canvas.pen.Width := 25; // <=== (Border.Width)
  Chart1.canvas.RoundRect(Chart1.ChartBounds,50,50);
end;

Similarly, my code excerpt needed a parallel tweak:

Code: Select all

with Chart1.Canvas do begin
  Brush.Style := bsClear;
  Pen.Color   := clrGetBackPanelBorder;
  Pen.Width   := iGetBackPanelBorderWidth; // <=== (Border.Width)
  RoundRect( Chart1.ChartBounds, iRoundedAmt, iRoundedAmt ); //<== iRoundedAmt, *not* pen.width
end;
2) WHY do I bother pointing this out? This is the part that might be of interest to you. I found some value combinations of Pen.Width and the last two arguments to Chart1.Canvas.RoundedRect worked wonderfully. Others combinations not so hot, allowing the Chart's ChartBounds rect to peek out from each of the four corners, so they bled out of the rounded corners.

This general formula seems to work fine: Pen.Width < ( iRoundedAmt + 1 ) < Pen.Width * 2.5.

If, however, PenWidth was, say, 5, and the rounding amount passed as the last two parameters to RoundRect was 50 (both reasonable values), the back square peeks out of each corner.

So as long as the values used for Pen.Width and the rounding value are in a certain kind of relationship, this code works really well! Thank you AGAIN!

Regards,
richard diamond

p.s., I *was* surprised, and delighted, that Pep jumped in as well!

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 Nov 28, 2008 9:43 am

Hi richard,
Narcís, okay, Dream Team it is...
Thank you very much but honestly I think we really don't deserve this. A little bit exagerated :wink:.

I think only one Dream Team has existed. Well, for me 2 :wink: and we had the luck to enjoy both of them in Barcelona in the early 90's!

http://en.wikipedia.org/wiki/Dream_team
I played with it a bit, and noticed a few things that might be of interest to others watching this thread, or reading it down the road in a search.
Thank you very much for sharing your findings. I have added this information to the wish-list to be considered for inclusion in future releases too.
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