Help needed with setting up a TChart axes lazarus / 39-Graphics ---------------------------------------------------------------------- garymq · 2026-04-24 13:29 hello All I'm having trouble organizing the X-axis of a TChart plot. I'm plotting data from an array consisting of 1440 data points, one for each minute of the day (60 x 24). I can generate a straightforward plot, with the X axis going from 0 to 1440. The relevant chart parameter settings are below, and the plot is attached. But I want to have the X axis with marks at each every 60 point (and marked 0 - 23), one mark for each hour of the day. There are so many options. I'm having trouble to get it to work out. Could someone suggest what the settings would be for Marks parameters, or other parameters, to achieve this. Thanks Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i    Chrt_Tide: TChart;   ........   HorizScale := GetConfig('AquaView.cfg','HorizScale').ToInteger;  VerticalScale := GetConfig('AquaView.cfg','VerticalScale').ToInteger;  ComPort1 := GetConfig('AquaView.cfg', 'ComPort1');  SiteID := GetConfig('AquaView.cfg','SiteID');   // Set up the tide chart  Chrt_Tide.Title.Text.Clear;  Chrt_Tide.LeftAxis.Range.UseMin := True;Chrt_Tide.LeftAxis.Range.UseMax := True;  Chrt_Tide.LeftAxis.Range.Min := 0;  Chrt_Tide.LeftAxis.Range.Max := VerticalScale;  Chrt_Tide.BottomAxis.Range.UseMin := True;  Chrt_Tide.BottomAxis.Range.UseMax := True;  Chrt_Tide.BottomAxis.Range.Min := 0;  Chrt_Tide.BottomAxis.Range.Max := HorizScale;  //1440   Chrt_Tide.LeftAxis.AtDataOnly:=False;  Chrt_Tide.LeftAxis.Title.Caption := 'Tide (mm)';  Chrt_Tide.LeftAxis.Title.Visible := True;  Chrt_Tide.BottomAxis.Title.Caption := 'Time';  Chrt_Tide.BottomAxis.Grid.Visible:=True;  Chrt_Tide.LeftAxis.Grid.Visible:=True;  Chrt_Tide.BottomAxis.Title.LabelFont.Name:='Courier New'; ---------------------------------------------------------------------- wp · 2026-04-24 22:19 I think I'd use an auxiliary ListChartSource to define the exact positions where marks should appear because it gives you precise control over the position and text of the axis labels: Add a TListChartSource to the form, assign it to the Marks.Source property of the bottom axis - this disables the automatic labeling process. Set Marks.Style to smsLabel because we do no want the day- minute-numbers at the ticks but the hours in a format such as "1:00".Populate the ListSource by iterating over all hours (for hr := 0 to 24), calculating the corresponding minutes passed since midnight (daymin := hr*60) and adding them to the ListSource together with the corresponding label text (ChartListSource1.Add(daymin, 0, IntToStr(hr)+':00'). If there is any chance that you might use this labels also on the y axis you should replace the "0" by "daymin".That's all...In contrast to using a TDatetimeIntervalChartSource these labels do not change when you resize the chart or zoom in. In the attached project I am also adding a minor axis to provide intermediate ticks at 15-minute intervals. ---------------------------------------------------------------------- garymq · 2026-04-25 12:50 wp Absolutely perfect - just what I wanted - attached running version. You saved me a lot of time. Thank you so much. ---------------------------------------------------------------------- wp · 2026-04-25 15:47 You may want to increase the Chart.Margins.Right or Chart.MarginsExternal.Right a bit to avoid truncating the last label ("24:00" --> "24:0") ---------------------------------------------------------------------- garymq · 2026-04-27 02:45 wp, Excellent suggestion! That bothered me too, but I couldn't find the parameter to control the margin size. MarginsExternal.Right as you suggested did the trick: Chrt_Tide.MarginsExternal.Right := 10  makes the full scale visible. Thanks again!