Search code examples
delphichartsseriesvclteechart

TeeChart VCL - Add Marks


I'm trying to create a aditional mark from TDonutSeries at runtime. I have used this source code below:

   with Series1.Marks.Children.Add do
   begin
      Shape.Font.Size:= 10;
      Shape.ShapeStyle:= fosRectangle;
      Shape.Style:= smsPercent;
   end;

In this line

Shape.Style = smsPercent;

I received this error: E2003 Undeclared identifier: 'style'

Is there any way to set the style for the specific mark item or I need to use a specific unit?


Solution

  • You can cast to TSeriesMarkShape to access the Style property. Ie:

      with Series1.Marks.Children.Add do
      begin
        Shape.Font.Size:= 10;
        Shape.ShapeStyle:= fosRectangle;
        TSeriesMarkShape(Shape).Style:= smsPercent;
      end;