Recent

Author Topic: Visualizing an Integral  (Read 3098 times)

1660

  • New member
  • *
  • Posts: 9
Visualizing an Integral
« on: November 14, 2013, 08:49:34 pm »
Hello,

How to "draw" the Integral of a TFuncseries ? Or can anybody explain me how to draw Polygons on TCharts ? Or has another idea to visualize the Integral ? =)

Please have a look at the picture in the appendix.


wp

  • Hero Member
  • *****
  • Posts: 11916
Re: Visualizing an Integral
« Reply #1 on: November 14, 2013, 11:00:06 pm »
You mean how to draw the shaded area in the right figure in front of the other series?

For example add a TAreaSeries. Calculate the y values for some x points (i.e. duplicate the points from the FuncSeries) and add them to the AreaSeries (AreaSeries.AddXY(x, y). Put the AreaSeries in front of the bar series by giving its ZPosition a larger number that of the other series, and give its Transparency a value greater than zero (0 = opaque, 255 = fully transparent).

1660

  • New member
  • *
  • Posts: 9
Re: Visualizing an Integral
« Reply #2 on: November 15, 2013, 10:15:47 am »
Problem solved  =)

Code: [Select]

procedure TForm1.Button12Click(Sender: TObject);
var
  Area: TAreaSeries;
begin
  Area := TAreaSeries.Create(Chart1);

  Area.AddXY(1, 1, 'Point1', TColor($000000));
  Area.AddXY(2, 3, 'Point2', TColor($000000));
  Area.AddXY(4, 4, 'Point3', TColor($000000));
  Area.AddXY(5, 0, 'Point4', TColor($000000));

  Chart1.AddSeries(Area);

end; 



wp

  • Hero Member
  • *****
  • Posts: 11916
Re: Visualizing an Integral
« Reply #3 on: November 15, 2013, 10:32:03 am »
You can drop mentioning the colors in the AddXY call; the AreaSeries.SeriesColor will be used instead. And if you don't need the point labels you can also drop them. Labels and colors are optional parameters. The simplest version of your code, therefore, would be

Code: [Select]
procedure TForm1.Button12Click(Sender: TObject);
var
  Area: TAreaSeries;
begin
  Area := TAreaSeries.Create(Chart1);

  Area.AddXY(1, 1);
  Area.AddXY(2, 3);
  Area.AddXY(4, 4);
  Area.AddXY(5, 0);

  Chart1.AddSeries(Area);

end; 

 

TinyPortal © 2005-2018