plot discontinuous line? lazarus / 55-TAChart ---------------------------------------------------------------------- DMStevenson · 2025-06-04 15:11 Hi - I was wondering if anyone has had to plot a discontinuous line. That is, for example, plot points 1,2,3 as a line, then no line between points 3,4, then a line again between points 4,5,6. I have tried various combinations of ShowPoints, and LinePen.Styles, but cannot find a way to do this. I could, of course, use multiple lineSeries, but my data sets I am plotting are *very* large, so this seems unworkable. Has anyone else found a need for this? ---------------------------------------------------------------------- Thaddy · 2025-06-04 15:43 If I understand you correctly, you want to do a kind of collision detection? I.e. if a line crosses another then it should not progress drawing any further? ---------------------------------------------------------------------- 440bx · 2025-06-04 15:44 TTBOMK, there is no function (in Windows at least) that will output a number of disconnected line segments. OTH, even with a large dataset, it takes very little code to implement that.  for instance: Step 1. MoveTo(InitialPoint) Step 2. Draw line to end point Step 3. if there are more segments, advance to next segment, go to step 1. Either a "for" or "while" loop could implement that.  It looks like it would be less than 10 lines of code. HTH. ---------------------------------------------------------------------- wp · 2025-06-04 16:01 Add a NaN ("not a number", defined in math) as y value to the series at an intermediate x point (https://wiki.lazarus.freepascal.org/TAChar t_documentation#Skipping_source_items). 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 uses  math; procedure TForm1.FormCreate(Sender: TObject);var  i: Integer;begin  for i := 0 to 10 do    Chart1LineSeries1.AddXY(i, random);  Chart1Lineseries1.AddXY(10.5, NaN);  for i := 11 to 20 do  Chart1lineseries1.AddXY(i, random + 1);end; But be warned: It is not allowed to do any calculations with NaN, even "if x = NaN" will crash your application (use "if IsNaN(x)" instead). Usage of Nan is in TAChart for more than 10 years, and I hope that all such occurrencies now have been eliminated, but you never can tell... ---------------------------------------------------------------------- DMStevenson · 2025-06-04 16:47 Thank you wp! This will solve my problem exactly, and also thanks for the reference in the lit. (did not find that passage). I need this as data output from one of our instruments occasionally contains 'impossible' values (usually 0), and yet we need to graph the results - skipping the untenable values. This will work beautifully! ---------------------------------------------------------------------- VisualLab · 2025-06-05 12:25 Continuing the topic of discontinuity of functions - is it possible to draw graphs of functions (as one series) using TAChart: having a jump discontinuity,having a point of discontinuity,having asymptotes.I mean examples such as those presented in this presentation. ---------------------------------------------------------------------- wp · 2025-06-05 16:12 Yes, of course. Since a few version you can even do it in design mode: Add a TExpressionSeries to the chartDefine the ranges for the x and y axes: Chart.LeftAxis.Range.XMin = -10, .XMax = 10, .UseMin = true, .UseMax = 10. The same with the BottomAxis. (You can also enter this information in the Extent property of the ExpressionSeries, but this is more work when you want to add serveral series).Type the math expression into the property Expression, e.g. 1/x^2 --> You see the function in the chart!But at x = 0 there is a vertical line representing the discontinuity: In property Domain tell the parser where the function is not defined - enter "x <> 0" (without quotes) - the vertical line disappears. To see the formula in the legend, set Chart.Legend.Visible = true. Enter the function expression in the series' Title. You can get proper superscript for the exponent by using a HTML expression: "y = 1/x2" (no quotes). In order to activate HTML, set Chart.Legend.TextFormat to tfHTML.But be careful: save often. As I noticed while preparing this, the parser is not very tolerant regarding typos, and this will easily freeze the IDE when you do this at designtime. ---------------------------------------------------------------------- VisualLab · 2025-06-06 17:04 wp, thanks for the tips on creating expression-based function graphs. It's nice that there is a description of how to use the TAChart parser: How To Use TFPExpressionParser.