Recent

Author Topic: TChart vertical lines  (Read 3247 times)

swidi_

  • Newbie
  • Posts: 2
TChart vertical lines
« on: February 16, 2014, 12:30:46 pm »
Hello,

I'm looking for solution to place vertical lines in all points of the data series. The problem is, the lines must be visible even the point are under/over the visible area.

Now im using:

//on draw point
procedure TForm2.SeriesStateDrawPointer(ASender: TChartSeries;
  ACanvas: TCanvas; AIndex: Integer; ACenter: TPoint);
begin
//start
  ACanvas.Line(ACenter.x, ACanvas.Height, ACenter.x, 0);
end;     

Just the lines are not draw when the point isn't draw.

Have You any solution for me ?

« Last Edit: February 16, 2014, 12:56:55 pm by swidi_ »

wp

  • Hero Member
  • *****
  • Posts: 5831
Re: TChart vertical lines
« Reply #1 on: February 16, 2014, 05:50:22 pm »
You want to draw a line from the point down to the axis? Why not use a TBarSeries with BarWidthPercent = 1?
In the attached screenshot I used two series, a BarSeries and a LineSeries, linked to the same ChartSource. The BarSeries has BarWidthPercent=1, and the LineSeries has the interconnecting lines turned off and the symbols turned on. The y extent of the chart is restricted to cut off some data points.
« Last Edit: February 16, 2014, 11:28:28 pm by wp »
Lazarus trunk / fpc 3.0.4 / all 32-bit on Win-10

swidi_

  • Newbie
  • Posts: 2
Re: TChart vertical lines
« Reply #2 on: February 16, 2014, 11:28:23 pm »
Thanks for Your advice,

Vertical lines marks the events. When the vertical line crossing with others data series then we know about event in this point of data.
Examle: Temperature chart crossing with vertical line of events 'start fan'. We know when temperature reachd this value then fan was started.