I need to add an event line below a TBarSeries, showing events. The user can then see where events occur in the series.
Something like the red line with orange triangles shown in the image below:
(I don't really want to overwrite the axis title--I just wanted to mock something up).
How would I accomplish something like this using TChart?
Thank you,
Ed Dressel[/img]
Event line in a TBarSeries
-
- Advanced
- Posts: 228
- Joined: Tue Aug 28, 2007 12:00 am
- Location: Oregon, USA
Hi TestAlways,
I've achieved something really similar to your picture with the following code. In this example, Series1 is the BarSeries and Series2 is a LineSeries.
I've achieved something really similar to your picture with the following code. In this example, Series1 is the BarSeries and Series2 is a LineSeries.
Code: Select all
procedure TForm1.FormCreate(Sender: TObject);
var max: double;
begin
Chart1.View3D := False;
Series1.FillSampleValues(15);
Chart1.MarginBottom := 7;
Chart1.Axes.Left.AutomaticMinimum := False;
Chart1.ClipPoints := False;
max := Series1.YValues.MaxValue;
Series2.Pointer.Visible := True;
Series2.Pointer.Size := 7;
Series2.ShowInLegend := False;
with Series2 do
begin
AddXY(0, -max/10);
AddXY(7, -max/10);
AddXY(9, -max/10);
AddXY(10, -max/10);
AddXY(14, -max/10);
end;
end;
function TForm1.Series2GetPointerStyle(Sender: TChartSeries;
ValueIndex: Integer): TSeriesPointerStyle;
begin
if Sender = Series2 then
begin
if (ValueIndex = 0) or (ValueIndex = Series2.Count-1) then
Result := psNothing
else
Result := psTriangle;
end;
end;
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
-
- Advanced
- Posts: 228
- Joined: Tue Aug 28, 2007 12:00 am
- Location: Oregon, USA
Hi Ed,
As you can see in the method header, you have the ValueIndex.
As you can see in the method header, you have the ValueIndex.
Code: Select all
procedure Series1Click(Sender: TChartSeries; ValueIndex: Integer;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |