Recent

Author Topic: [Solved]TChart How to shade area under lineseries  (Read 302 times)

Wilko500

  • Full Member
  • ***
  • Posts: 146
[Solved]TChart How to shade area under lineseries
« on: June 17, 2025, 12:37:29 am »
MacOs Sequoia Laz 4.1 FPC 3.2.3
I am trying to shade the area under a TChart line series.  I have managed to draw the line series but cannot figure out how to shade the area under the line.  I have found some references to doing this with TChartStyles.  So I added the component added a chartstyle and added the ChartStyle to my lineseries. Running the program draws the line but does not shade. My line series is named Power and the key styling code is [I think]
Code: Pascal  [Select][+][-]
  1.    Power.clear;
  2.   tmpDt:=scandateTime('yyyy"-"mm"-"dd" "hh":"nn":"ss', '2025-06-16 00:00:00');
  3.   Chart1.BottomAxis.Range.Min:=tmpDt;        //was dtMin
  4.   Chart1.BottomAxis.Range.Max:=IncDay(tmpDt);  //was dt(min)
  5.   Power.Styles:=ChartStyles1;
  6.   ChartStyles1.Styles[0].Brush.Style:=bsSolid;
  7.   ChartStyles1.Styles[0].Brush.Color:=clYellow
Either I am missing something or this can't be done??? Help please
« Last Edit: June 17, 2025, 04:40:35 am by Wilko500 »
MacBook Pro mid 2015 with OS Monterey 12.7.6
FPC 3.2.3 Lazarus 3.7
FPC 3.2.2 Lazarus 3.4

wp

  • Hero Member
  • *****
  • Posts: 12927
Re: TChart How to shade area under lineseries
« Reply #1 on: June 17, 2025, 01:05:32 am »
I am trying to shade the area under a TChart line series.  I have managed to draw the line series but cannot figure out how to shade the area under the line.
What do you mean with "shade the area under a line series"? Draw a shadow of the line? Or do you mean an AreaSeries? For the latter, find an example in the attachment

Wilko500

  • Full Member
  • ***
  • Posts: 146
Re: TChart How to shade area under lineseries
« Reply #2 on: June 17, 2025, 04:39:38 am »
I did indeed mean AreaSeries. Just a couple of tweaks to style and now working as required thank you
Code: Pascal  [Select][+][-]
  1.   Chart1AreaSeries1.AreaBrush.Style:=bsSolid;
  2.   Chart1AreaSeries1.AreaBrush.Color:=$00A3E1E3;
  3.   Chart1AreaSeries1.AreaLinesPen.Color:=$00A3E1E3;
MacBook Pro mid 2015 with OS Monterey 12.7.6
FPC 3.2.3 Lazarus 3.7
FPC 3.2.2 Lazarus 3.4

 

TinyPortal © 2005-2018