How to add an unfilled bubble to a TBubbleSeries

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
David
Newbie
Newbie
Posts: 2
Joined: Thu Jan 23, 2014 12:00 am

How to add an unfilled bubble to a TBubbleSeries

Post by David » Mon Apr 28, 2014 9:18 pm

Hello,

When adding a bubble to a TBubbleSeries, you specify the color. How can I specify that I want a particular bubble to be unfilled. i.e. the border of of the bubble should be there, but there should be no fill. I want to use this to indicate the value the bubble is supposed to represent is undefined (i.e. NAN). All the rest of the bubbles should be colored like normal.

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

Re: How to add an unfilled bubble to a TBubbleSeries

Post by Yeray » Tue Apr 29, 2014 8:43 am

Hello David,

You can use null points (clNone color) in conjunction with OnGetPointerStyle as follows:

Code: Select all

uses BubbleCh, Series;

procedure TForm1.FormCreate(Sender: TObject);
var i: Integer;
    tmpColor: TColor;
begin
  Chart1.View3D:=false;

  with Chart1.AddSeries(TBubbleSeries) as TBubbleSeries do
  begin
    for i:=0 to 9 do
    begin
      if i=5 then
        tmpColor:=clNone
      else
        tmpColor:=clTeeColor;

      AddBubble(i, random*1000, (1000/15.0)+Round(1000/(10+random*15)), '', tmpColor);
    end;

    OnGetPointerStyle:=BubbleGetPointerStyle;
  end;
end;

function TForm1.BubbleGetPointerStyle(Sender:TChartSeries; ValueIndex:Integer):TSeriesPointerStyle;
begin
  if Sender is TBubbleSeries then
    with Sender as TBubbleSeries do
    begin
      if IsNull(ValueIndex) then
        Pointer.Brush.Style:=bsClear
      else
        Pointer.Brush.Color:=Sender.ValueColor[ValueIndex];

      Result:=Pointer.Style;
    end;
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

David
Newbie
Newbie
Posts: 2
Joined: Thu Jan 23, 2014 12:00 am

Re: How to add an unfilled bubble to a TBubbleSeries

Post by David » Tue Apr 29, 2014 3:59 pm

Hi Yeray,

Thank you. That should work.

Post Reply