Changing point of TPOINTSERIES

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
Friis
Newbie
Newbie
Posts: 23
Joined: Mon May 07, 2012 12:00 am

Changing point of TPOINTSERIES

Post by Friis » Mon Nov 05, 2012 8:41 am

Hi,

In the case of linepen I can just the BorderEditor to change the line - for instance to make it dashed etc... (see attached photo)

Is there any possibility to use a simlar dialog box to change the point of the TPointSeries?

I know I can use the the ChartEditor - but it is so complicated and contains too many details...

Isn't there a possibility to change just the point of the TPointSeries itself? (change it from a square to a circle to a triangle, start etc?) similar to the border editor?

Actually, what I'm looking for is a predefined combobox where you can choose between the appearance of the TPoint i.e., square, circle, triangle, star etc
Attachments
BorderEditor.JPG
BorderEditor.JPG (15.29 KiB) Viewed 7674 times

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

Re: Changing point of TPOINTSERIES

Post by Yeray » Mon Nov 05, 2012 4:25 pm

Hi,

I'm afraid there's not a component for this. However, you can always create your own combobox with the pointer styles:
Square
Circle
Triangle
Down Triangle
Cross
Diagonal Cross
Star
Diamond
Small Dot
Nothing
Left Triangle
Right Triangle
Hexagon
Visual
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

Friis
Newbie
Newbie
Posts: 23
Joined: Mon May 07, 2012 12:00 am

Re: Changing point of TPOINTSERIES

Post by Friis » Wed Nov 07, 2012 7:37 am

Can you give me a short example of how to put the actual images of the Square, Circle, triangle, Down Triangle etc. into the combobox?

Of course, I can put the text insie a combobox but how do I "take" the actual images from the TPointerSeries and put it into the combobox?

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

Re: Changing point of TPOINTSERIES

Post by Yeray » Wed Nov 07, 2012 11:08 am

Hi Friis,

As you'll see in the TeeChart sources if you have them, we basically call the TPointSeries Pointer.DrawPointer() method in the TComboFlat's OnDrawItem event to do so.
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

Friis
Newbie
Newbie
Posts: 23
Joined: Mon May 07, 2012 12:00 am

Re: Changing point of TPOINTSERIES

Post by Friis » Wed Nov 07, 2012 3:11 pm

Hi,

I have tried to use this method but it gives me a "Acces violation error"

Code: Select all

procedure TForm10.ComboBox1DrawItem(Control: TWinControl; Index: Integer;
  Rect: TRect; State: TOwnerDrawState);
begin

with Control as TComboBox do
    begin
      Series1.Pointer.DrawPointer(TCanvas3D(canvas),true,0,0,5,5,clred,PSCircle);
    end;

end;

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

Re: Changing point of TPOINTSERIES

Post by Yeray » Thu Nov 08, 2012 11:31 am

Hi Friis,

This seems to work fine for me here:

Code: Select all

uses Series, TeCanvas;

var Series1: TPointSeries;

procedure TForm1.FormCreate(Sender: TObject);
begin
  Chart1.View3D:=false;

  Series1:=Chart1.AddSeries(TPointSeries) as TPointSeries;
  Series1.FillSampleValues;

  ComboBox1.Items.Add('Square');
  ComboBox1.Items.Add('Circle');
  ComboBox1.Items.Add('Triangle');
  ComboBox1.Items.Add('Down Triangle');
  ComboBox1.Items.Add('Cross');
  ComboBox1.Items.Add('Diagonal Cross');
  ComboBox1.Items.Add('Star');
  ComboBox1.Items.Add('Diamond');
  ComboBox1.Items.Add('Small Dot');
  ComboBox1.Items.Add('Nothing');
  ComboBox1.Items.Add('Left Triangle');
  ComboBox1.Items.Add('Right Triangle');
  ComboBox1.Items.Add('Hexagon');
  ComboBox1.Items.Add('Visual');

  ComboBox1.ItemIndex:=0;
  ComboBox1.Style:=csOwnerDrawFixed;
end;

procedure TForm1.ComboBox1DrawItem(Control: TWinControl; Index: Integer;
  Rect: TRect; State: TOwnerDrawState);
var ACanvas: TTeeCanvas3D;
    tmp: TColor;
    tmpStyle: TSeriesPointerStyle;
begin
  ComboBox1.Canvas.FillRect(Rect);

  With Series1.Pointer do
  begin
    ACanvas:=TTeeCanvas3D.Create;
    ACanvas.ReferenceCanvas:=ComboBox1.Canvas;
    tmp:=ParentSeries.SeriesColor;
    tmpStyle:=TSeriesPointerStyle(Index);

    DrawPointer(ACanvas, false, Rect.Left+6, Rect.Top+6+2, 4, 4, tmp, tmpStyle);
  end;
  With ComboBox1, Canvas do
  begin
    Brush.Style:=bsClear;
    TextOut(Rect.Left+14,Rect.Top+2,Items[Index]);
  end;
end;

procedure TForm1.ComboBox1Change(Sender: TObject);
begin
  Series1.Pointer.Style:=TSeriesPointerStyle(ComboBox1.ItemIndex);
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

Post Reply