How to fix the size of the plot area? lazarus / 55-TAChart ---------------------------------------------------------------------- CM630 · 2012-08-13 08:43 Here is the problem: I use a chart with line series. When I zoom vertically the number of the characters in the Y axis scale varies (i.e 10, 100, 1000). As a result since the total width of the Chart stays the same the size of the plot area changes (it gets narrower when I have bigger Y values and wider, when the Y values are smaller). I tried Margins, MarginsExternal and Margins of the LeftScale itself, etc. In fact, I could not find the size of the plot area as separate property? Maybe I could ask another question in the same thread- how am I to force the cart to write the values for the beginning and the end of the scales (for example, if the values between -1 and +1 are shown, I need to have -1 written in the beginning of the scale and 1 in the end. ---------------------------------------------------------------------- wp · 2012-08-13 10:01 QuoteI could not find the size of the plot area as separate property? I'm not quite sure but I think there is none, you cannot fix the size of the plot area. But maybe we should wait until Ask is online. Quotehow am I to force the chart to write the values for the beginning and the end of the scales Chart.Extent allows to freeze axis scaling. If you want the y axis to go from -1 to +1 set Chart.Extent.YMin=-1, Chart.Extent.YMax=1, Chart.Extent.UseYMin and UseYMin = true. ---------------------------------------------------------------------- CM630 · 2012-08-13 10:16 Quote from: wp on August 13, 2012, 12:01:03 pmQuotehow am I to force the chart to write the values for the beginning and the end of the scales Chart.Extent allows to freeze axis scaling. If you want the y axis to go from -1 to +1 set Chart.Extent.YMin=-1, Chart.Extent.YMax=1, Chart.Extent.UseYMin and UseYMin = true. That's not what I mean. For example I have a chart with X values between 0 and 12, but on the scale it is written 2;6 and 10. I need to know how to have the first visible value displayed on the chart (i.e. 0) and the last one (i.e. 12) to be shown. ---------------------------------------------------------------------- wp · 2012-08-13 10:31 To get the labels correct you should play around with the BottomAxis.Intervals properties. Have a look at the documentation (htt p://wiki.lazarus.freepascal.org/TAChart_documentation#Axis_intervals) for a description of what the properties mean. Are the labels 2,6,12 the only labels that you see? Do you have a very small window? If the data are not too exotic and if you're not using weird transformations TChart normally does a nice job in label finding. If your data start at 0 the first label normally always is at 0. The last one may become 10 if the chart gets smaller, but you can correct that with the Intervals settings. Or maybe your first x value is slightly larger than 0, say, 0.001. Then the zero is skipped and the next interval is labeled. You can get the zero by forcing the axis extent to begin at 0, by setting Chart.Extent.XMin = 0 and Chart.Extent.UseXMin = true. If this still is not what you mean you should post a small project which demonstrates your question. ---------------------------------------------------------------------- Ask · 2012-08-13 11:50 Quotethe size of the plot area as separate propertySee http://wiki.lazarus.freepascal.org/TAChart_documentation#Extents and the "extent" demo. However, I feel I do not fully understand your request -- of "plot area change" is essentially a definition of zooming, so why do you want to zoom without changing the area? Quoteforce the chart to write the values for the beginning and the end of the scalesIf the scale is fixed (i.e. you allow no zooming or panning and your data has fixed range), you can manually set axis marks by using your own data source. If the scale is dynamic, however, then the question becomes very complex: what is the beginning and end of scales? Do you mean the bounds of the current chart extent? If so, they are very unlikely to be exactly +1 and -1. You can try to set BottomAxis.Intervals.Options=[aipUseCount], which should give what your want (first and last marks exactly at chart bounds, other marks equidistant between them). However, of course, the resulting labels will not be round unless you carefully select extent, margins and Intervals.Count. Additionally, I have encountered a tricky corner case of rounding error during the mark value calculations -- this is the reason I answer so late. It is hopefully fixed in r38233. I wonder whether this problem is common enough to merit back-porting. ---------------------------------------------------------------------- CM630 · 2012-08-13 12:42 A have attached two screenshots, I think they will make everything clear. On the first one there is nothing on the oscillogram, so you can see that they are exactly the same. On the second one there two processes- one with amplitude ±10 and the second one- with ±1000. As you can see, the plot area (the white field) on the lower one is narrower, I think I do not have to explain the negative aspects of that behaviour. Increasing Marginsexternal.Left makes enough space for the scale marks, but still the plot area is decreased when the number is bigger. Also, you can see, that on the ±10 chart the displayed values are ±8., it would be much better if the highest values were show, but anyway this is not such a big problem as the first one. ---------------------------------------------------------------------- wp · 2012-08-13 13:41 You could force the labels to the same widths and pad with spaces. This can be easily done by changing LeftAxis.Marks.Format in both charts to something like "%n.9g" where n is the number of characters of your longest label (the "9" is the maximum number of decimal places displayed, but is normally not used to its limits with reasonably selected labels). To be exact you should select a monospaced font, like Courier, for the Marks.LabelFont, but my Lazarus crashes when I do this... Of course, you must be aware that same empty space will appear between labels and axis title if you have short labels. ---------------------------------------------------------------------- Ask · 2012-08-13 13:45 QuoteAs you can see, the plot area (the white field) on the lower one is narrowerAh, yes, now I understand. QuoteI think I do not have to explain the negative aspects of that behaviour.Actually, please explain -- TAChart makes a serious effort to calculate axis sizes automatically, and I did not yet encounter any case where it is not desirable. I can implement some kind of manual override of the axis labels' size, but I need a good reason and design for that. Meanwhile, you can use fixed-size font and format to make your labels identical in size. Alternatively, rotate Y labels 90 degrees counterclockwise and set Marks.Clipped = true. Quoteon the ±10 chart the displayed values are ±8., it would be much better if the highest values were showThis looks very much like the problem I just fixed -- try r38233. ---------------------------------------------------------------------- marcov · 2012-08-13 13:56 Quote from: Ask on August 13, 2012, 03:45:32 pmQuoteAs you can see, the plot area (the white field) on the lower one is narrowerAh, yes, now I understand. QuoteI think I do not have to explain the negative aspects of that behaviour.Actually, please explain -- TAChart makes a serious effort to calculate axis sizes automatically, and I did not yet encounter any case where it is not desirable. I can imagine this very well:-)   The reason is if both charts depict the same events but with different units or timelines.  Different units can have slightly wider labels, but the X coordinates have meaning and should align. Think of action and result diagrams, signal transformation etc. ---------------------------------------------------------------------- Ask · 2012-08-13 14:28 Quote from: wp on August 13, 2012, 03:41:56 pmyou should select a monospaced font, like Courier, for the Marks.LabelFont, but my Lazarus crashes when I do this... Should be fixed in r38234. Note that you might have to fully recompile TAChart to see the effect (for example, by clearing "lib" directory). This is because FPC sometimes misses unit dependencies when generics are involved. Quote from: marcov on August 13, 2012, 03:56:49 pmThe reason is if both charts depict the same events but with different units or timelines.  Different units can have slightly wider labels, but the X coordinates have meaning and should align. Think of action and result diagrams, signal transformation etc. To display such such charts, TAChart supports multiple axises, axis groups and axis transformations. See http://wiki.lazarus.freepascal.org/TAChart_documentation#Coordinat es_and_axises for docs, "axis", "panes", "axistransf" demos and "Oscilloscope" page of the "line" demo for examples. Perhaps an additional feature to TChartExtentLink allowing to synchronize not only extents, but also drawing areas, may be useful. However, it will by quite tricky to implement. ---------------------------------------------------------------------- marcov · 2012-08-13 15:53 Quote from: Ask on August 13, 2012, 04:28:44 pmTo display such such charts, TAChart supports multiple axises, axis groups and axis transformations. Signal and response diagrams are generally plotted in different diagrams in literature. ---------------------------------------------------------------------- wp · 2012-08-13 20:27 Code: [Select][quote] Should be fixed in r38234 @Ask: Yes, I can change the font now - thank you. ---------------------------------------------------------------------- CM630 · 2012-08-14 05:24 QuoteI think I do not have to explain the negative aspects of that behaviour.Actually, please explain -- TAChart makes a serious effort to calculate axis sizes automatically, and I did not yet encounter any case where it is not desirable.[/quote] You have to trust me- I raised two threads about TAChart and you have two bugs down (the second one due to WP) Marcov explained it quite well, but as you said: Quote from: marcov on August 13, 2012, 05:53:27 pmTo display such such charts, TAChart supports multiple axises, axis groups and axis transformations. If I understand you properly, you mean to put all the items on a single chart? I have attached an example- just imagine how these would like on a single chart with eight scales. All these curves show processes that go simultaneously and you have to determine when each one starts and ends, compared with the others. I'll give you another real life example- you have an oscillogram on which a process starts on the 35ms and end on 47ms, which is easy to determine, since you have a thick on every millisecond. On another oscillogram there is a process, that starts on 32ms and ends on 44ms. How do people determine if both processes have the same duration? They print them on two separate pages, put the sheets one over another and watch them agaionst the light on a window pane. Don't laugh, that's life. I will try WP's solution when builds of r38234 are available for download - I have been using it with another development environment, but in it things kept messing, hopefully here it won't be this way. ---------------------------------------------------------------------- wp · 2012-08-14 07:04 @Ask: What about a third "Margins" property, like "MarginToPlot", which fixes the distances between chart border and plot rect? By default, it should be (-1,-1,-1,-1) saying that every distance is floating. If the user wants a specific margin it would be in his responsibility to select an appropriate value that does not truncate labels, overwrites the axis title, or truncates other axes. @paskal: Maybe I am too sensible, but I hear some kind of arrogance in your posting. You are not working with TeeChart which is a commercial product, but with software that is written and maintained volontarily by people in their spare time. ---------------------------------------------------------------------- Ask · 2012-08-14 08:20 QuoteI have attached an example- just imagine how these would like on a single chart with eight scales.I think these would like exactly the same -- try it QuoteYou have to trust me- I raised two threads about TAChart and you have two bugs downYes, thanks for your reports. I do trust you about the results you want, however, you should trust me about the method to get them. Quote from: wp on August 14, 2012, 09:04:19 am@Ask: What about a third "Margins" property, like "MarginToPlot", which fixes the distances between chart border and plot rect?This is one method. I was thinking about "FixedSize" property of axis. Your way is probably better because it can override things like first/last mark and arrow margins from orthogonal axises. As I said, IMO the best option would be to leave margins dynamic, but synchronize them automatically between linked charts. But this option is also hardest to implement. @paskal: What do you think? ---------------------------------------------------------------------- CM630 · 2012-08-14 08:29 @wp, that's it, you are too sensitive, I have no idea why you got such an impression. I  do not expect anyone to make any improvements, but I am very happy that they do. Indeed, I am impressed by the possibilities that Lazarus have and the progress that it have made in comparison with the previous release. In fact, that is the problem with commercial products- they might fix something, but you have to pay for the next release, being in the position, that you have already paid for something that you cannot use. Here it is simple- if you do not like something, and there is no one to do it- then you can try fixing it yourself. Well, half a year ago I had no idea how to declare vars in Pascal, so my time for that have not come yet. Still, I think that finding and which is more important- reporting bugs is a help. So, let's go to the point- I like your idea for Margins to plot, still I am not sure if having PlotHeight ; PlotWidth; PlotTop and PlotLeft are not more standard solutions? I do not understand why MarginsExternal calculates the distance between the scale values, instead from the plot, but anyway I do not ask, because I do not care, and there is a good reason why- changing it now will cause backward compatibility problems. Quote from: Ask on August 14, 2012, 10:20:04 am@paskal: What do you think? First I'll spend some time trying Quote from: Ask on August 14, 2012, 10:20:04 amQuote from: Ask on August 14, 2012, 10:20:04 amI think these would like exactly the same -- try it Then I'll think. As we say- I sat thinking, I sat things until I finally realized, that I was only sitting. You have posted, while I was writing this post, so there is something above. But I am quite confident about one thing- it is the user of the TAChart, who shall take care to have enough space for writing the scales values. BTW, maybe somethink like the attached image could be useful for the wiki. ---------------------------------------------------------------------- wp · 2012-08-14 09:21 Now that it is possible to modify the label font I tried my idea with the Marks.Format specifier a few postings above. Here is a screen shot. I used LeftAxis.Marks.Format = '%6.9g'. The Courier labels do look a bit outdated, though. The only requirement is that the x axis has the same labels in all charts. Quotewhen builds of r38234 are available for download It seems that snapshots have not been updated for a long time. You have to use svn or download the source.zip snapshot which is at r38235 today, and compile Lazarus. If you never did that before there is an item in the "Tools" menu. As Ask mentioned above delete the tachart\lib folder before you do that. ---------------------------------------------------------------------- CM630 · 2012-08-14 11:49 Screenshots look perfect. There is also a little trick- the namings (so far I could not find where you wrote y axis and what is the exact name of this element)  of the left axis of all the charts must have the same line length, because if you have QuotePhase A on one of the charts and QuotePhase B on the other, the plot areas will probably get different widths, again. Maybe that is what you meant by „The only requirement is that the x axis has the same labels in all charts.“? Probably this week I won't have more time for that, so meanwhile there shall be new snapshots. I noticed something else: the Y values of your first chart are between 0 and 1, but you do not have a 0 value written on the left axis. It is the same case with the Y scales of the other 2 charts. I would not pay attention, but ask said: Quote from: Ask on August 13, 2012, 03:45:32 pmQuoteon the ±10 chart the displayed values are ±8., it would be much better if the highest values were showThis looks very much like the problem I just fixed -- try r38233. Probably Ask meant something else? ---------------------------------------------------------------------- wp · 2012-08-14 12:34 Quote I could not find where you wrote y axis and what is the exact name of this element This is the title of the left axis (Chart1.LeftAxis.Title.Caption := 'y axis') - maybe you should have a look at my recent tutorial on getting started (http://wiki.lazarus.freepascal.org/TAChart_tutorial:_ Getting_started). QuoteQuote    Phase A on one of the charts and Quote    Phase     B on the other, I thinks that's not possible, the axis title can only be single-lined in TAChart. Quotethe Y values of your first chart are between 0 and 1, but you do not have a 0 value written on the left axis I am beginning to see what you mean: you have varying data, sometimes all greater than 0, sometimes some negative, and you always want to see the 0 at the axis. I think you will have to do some progamming to achieve this effect. You could try to call the following procedure whenever the data range changes: Code: [Select]procedure DisplayAxisZero(Chart:TChart); var   ex: TDoubleRect; begin   ex := Chart.GetFullExtent;   Chart.Extent.UseYMin := ex.a.y > 0; end; GetFullExtent returns the range in which the data vary; the point a is the left-bottom corner, b the top-right corner of the chart, i.e. a.y is the lowest y value. If that is > 0 then Chart.Extent.UseYMin is turned on, this will show the 0. If the y minimum < 0 UseYMin is turned off because the 0 is already shown and the negative values would be truncated. The condition that all y values are negative is not handled - I am leaving it for you as an exercise... You should also consider the case of zooming if your application allows that. The Extent is documented here: http://wiki.lazarus.freepascal.org/TAChart_documentation#Extents ---------------------------------------------------------------------- Ask · 2012-08-14 13:19 Quote from: wpaxis title can only be single-lined in TAChart.Not so, see http://wiki.lazarus.freepascal.org/TAChart_documentation#Multi- line_marks and "Multiline" page of the "labels" demo. Quote from: paskalProbably Ask meant something else?There is some subtlety here: when TAChart decides which marks to display, it takes into account the actual range of data values. There may be two reasons for the "boundary" marks to be invisible -- either they are outside of the clipping range, in which case it is as expected, or they are *exactly" on the edge, which is the case I fixed. The latter case is rare and is most easily triggered by the workaround I suggested in the previous posts. Quote from: wpyou have varying data, sometimes all greater than 0, sometimes some negative, and you always want to see the 0 at the axis. I think you will have to do some programming to achieve this effectHm, I was under the impression that the ranges are actually known beforehand, and can thus be simply pre-set. If the problem is indeed as you describe, then I can propose a couple of tricks: 1) If the actual ranges are always close to the desired ones, simply increase   Chart.ExpandPercentage property 2) Otherwise, add a point with X=NaN, Y=0 to the source of each series. ---------------------------------------------------------------------- wp · 2012-08-14 13:31 QuoteNot so, see http://wiki.lazarus.freepascal.org/TAChart_documentation#Multi- line_marks and "Multiline" page of the "labels" demo. Ah - never stop learning... My sentence was motivated by the fact that the Axis.Text.Caption does not have the same property editor as the Chart.Title.Text. Quoteadd a point with X=NaN, Y=0 to the source of each series. That's nice! ---------------------------------------------------------------------- CM630 · 2012-08-15 05:02 Quote from: Ask on August 14, 2012, 10:20:04 amAs I said, IMO the best option would be to leave margins dynamic, but synchronize them automatically between linked charts. But this option is also hardest to implement. @paskal: What do you think? If I understand you correctly, you mean, that there might be for example 5 separate charts, and that they might have a common property, which will set the size of each of them simultaneously? I think that will be both hard to implement and probably hard to use. If someone wants to make such a synchronization,  this one could probably do it by calculating the numbers of the digits in the longest axis values. In fact, for myself, if I have tens or hundreds of sets oscillograms, I would like all of them to look all the same (with the same plot area size). I think that MarginToPlot is a good solution, with only one proposal- instead of using -1 values to disable, UseLeft/UseTo... etc could be used, like it is in the Extents. This will make it more consistent with the overall style of TACharts. Quote from: wp on August 14, 2012, 02:34:57 pmQuotethe Y values of your first chart are between 0 and 1, but you do not have a 0 value written on the left axis I am beginning to see what you mean: you have varying data, sometimes all greater than 0, sometimes some negative, and you always want to see the 0 at the axis. I think you will have to do some progamming to achieve this effect. You could try to call the following procedure whenever the data range changes: No, I do not always want to see the 0 (though when you said it, I do want, it would be useful to find DC components). What I wanted is shown on the picture- I have added the values that I miss on your screenshot with red colour. Maybe some of you already explained how to do it, still I have to reread all the posts. Quote from: wp on August 14, 2012, 02:34:57 pmQuote I could not find where you wrote y axis and what is the exact name of this element This is the title of the left axis (Chart1.LeftAxis.Title.Caption := 'y axis') - maybe you should have a look at my recent tutorial on getting started (http://wiki.lazarus.freepascal.org/TAChart_tutorial:_ Getting_started). That was close but as you've said in your tutorial- Don't forget to set Visible to true.. BTW, I'had read it at least once. ---------------------------------------------------------------------- wp · 2012-08-15 08:09 QuoteWhat I wanted is shown on the picture In other words, you want some kind of "AutoExpandToLabel" feature which expands the axis such that it always begins and ends with a label? That would be nice, I agree. ---------------------------------------------------------------------- wp · 2012-08-17 21:29 QuoteI do not always want to see the 0 (though when you said it, I do want, it would be useful to find DC components) Another way to force the 0 on the y axis is to add a TConstantLineSeries with LineStyle lsHorizontal and Position 0. This also draws a line at y=0 even you have grid turned off. ---------------------------------------------------------------------- CM630 · 2012-08-21 08:57 Quote from: Ask on August 14, 2012, 10:20:04 amQuoteI have attached an example- just imagine how these would like on a single chart with eight scales.I think these would like exactly the same -- try it *Ask, do you mean that I can have several vertically shifted Y axises, like on the image, attached to the post? I made the image with an image editor, the line example does not have such a thing, at least I did not find it. BTW, in the line example, what should checking Sorted do? It does nothing for me. ---------------------------------------------------------------------- Ask · 2012-08-21 09:35 Quote from: Ask on August 13, 2012, 04:28:44 pm"axis", "panes", "axistransf" demos and "Oscilloscope" page of the "line" demo for examples. Quote from: paskal on August 21, 2012, 10:57:23 am*Ask, do you mean that I can have several vertically shifted Y axises, like on the image, attached to the post? I made the image with an image editor, the line example does not have such a thing, at least I did not find it. Yes. Note that I suggested several demo programs, exhibiting various aspects. In particular, see "Axis groups" page of the "axis" demo and "Transform" page of the "panes" demo. Quote from: paskal on August 21, 2012, 10:57:23 amBTW, in the line example, what should checking Sorted do? It does nothing for me. The "Fast drawing" page of the "line" demo is dedicated to measuring speed of drawing line series with extremely many points. Line series has many optimizations for this case, which are partially documented here: http://wiki.lazarus.freepascal.org/TAChart_documentation#Fast_lines. To see the effect of "Sorted" toggle, do the following: 1) Press "Add" button several times 2) Zoom to a relatively small part of series by drawing tall but narrow rectangle while holding "Shift". 3) Press "Timed refresh" 4) Toggle "Sorted" 5) Press "Timed refresh" again ---------------------------------------------------------------------- CM630 · 2012-08-21 11:09 Quote from: Ask on August 21, 2012, 11:35:58 amQuote from: Ask on August 13, 2012, 04:28:44 pm"axis", "panes", "axistransf" demos and "Oscilloscope" page of the "line" demo for examples. Quote from: paskal on August 21, 2012, 10:57:23 am*Ask, do you mean that I can have several vertically shifted Y axises, like on the image, attached to the post? I made the image with an image editor, the line example does not have such a thing, at least I did not find it. Yes. Note that I suggested several demo programs, exhibiting various aspects. In particular, see "Axis groups" page of the "axis" demo and "Transform" page of the "panes" demo. Yes, on the first sight axis group seems really so fine. Here is another question, maybe not so much related with the topic. Here is what is needed: when clicking on the highest/lowest  value of a scale (or one of the many on a chart) a edit field to appear, so I can edit the maximum/ minimum values. For example, I have a scale with from -10 to +10. I want to make it from -10 to +20. My idea is to click on +10 and to change the value to +20. So probably TAChart doe not have this as an inbuilt feature, but it is not necessary. The question is what is the best way to detect a mouse click on the scales. Shall I watch the mouse position and calculate if the click is over a scale or there is some other solution? P.S. I just found out that if AllowZoom= true then mouse down works only on the scales, but not on the plot area. Anyway, dealing with the mouse location seems simple enough. ---------------------------------------------------------------------- Ask · 2012-08-21 13:59 Quote Shall I watch the mouse position and calculate if the click is over a scale or there is some other solution?For now -- yes, you have to do it yourself. It would be a useful addition to TAChart, but not easy to implement. Quoteif AllowZoom= true then mouse down works only on the scales, but not on the plot areaThis is by design, see event processing order at http://wiki.lazarus.freepascal.org/TAChart_documentation#Tools ---------------------------------------------------------------------- CM630 · 2012-08-23 06:43 So, how am I to find the real minimum and maximum values dispayed for a series of graphics? I crated a chart. In left axis I set range.min=-10 and range.min= +10. UseMax and UsdeMin stay False. I run this code: Code: [Select]procedure TForm1.Chart1Click(Sender: TObject); begin  ShowMessage (FloatToStr(Chart1.LeftAxis.Range.Min) +'   '+ FloatToStr(Chart1.LeftAxis.Range.max) + #13 + #10+ FloatToStr(chart1.Extent.Ymin) +'  '+ FloatToStr(chart1.Extent.YMax)); end;It shows Quote-10  10 0 0, but in fact the displayed values on the left scale are from -1 to +1. How am I go get them? I looked in the series properties, but I did not find a property for the +- values, displayed on the chart. Or should I make some tricks with the tools + zoom? Maybe I am not explaining the question clearly? ---------------------------------------------------------------------- Ask · 2012-08-23 07:48 QuoteI set range.min=-10 and range.min= +10. UseMax and UseMin stay False.Range and Extent, like most published properties, are declarative -- that is, it indicates the developer's intent as opposed to the actual state. Besides that, when UseMax = UseMin = False, Range.Min and Range.Max are ignored. To get the chart extent in graph coordinates, use CurrentExtent or LogicalExtent. See http://wiki.lazarus.freepascal.org/TAChart_documentation#Extents To Convert those into axis coordinates, use GraphToAxis functions of the appropriate axis. Edit: Since r38349, you can use TChartAxis.IsPointInside function to determine if the mouse position falls inside of marks area of the given axis. ---------------------------------------------------------------------- CM630 · 2012-09-12 07:17 Here is a problem when using multiple series on the same chart (like in TAChart axis demo)- when zooming, I usually need to zoom only horizontally- i.e. to see only a part of the duration of the process (i.e. between 3,450 secs to 3,65 secs). I think that this case will not be a problem. Anyway, sometimes I have to zoom vertically only one of the series, and the rest to become unchanged. In fact, when I zoom (with the mouse) only the area is the mouse dragged area is show, which means, that only pieces of one of the series are shown. Do you think that what I want is doable, or I shall use separate charts for each series? Still I wonder which of the two is the better solution... I have attached an image, to explain things better. BTW, I have the same problem for all the graphics demo- controls (usually TACHARTS) keep resizing with the form window. I could not find which property is responsible for that? ---------------------------------------------------------------------- User137 · 2012-09-12 08:16 Quote from: paskal on September 12, 2012, 09:17:12 am... controls (usually TACHARTS) keep resizing with the form window. I could not find which property is responsible for that?Usually that is Align or Anchors property. If you want graph to not scale when resizing, you can modify the max visible range be linearly relative to window size. You can do that in some onResize event, or there might be some other property in chart that already does that (i've never used it). ---------------------------------------------------------------------- Ask · 2012-09-12 08:58 Quotezoom only horizontallyYes, that is easy. See e.g. http://wiki.lazarus.freepascal.org/TAChart_documentation#Zoom_click_to ol and http://wiki.lazarus.freepascal.org/TAChart_documentation#Extent_limits Quotezoom vertically only one of the series, and the rest to become unchangedThis is also not too hard, but need more precise definition: Should the zoomed-in series expand above and below its usual range and overlap neighbor series? If so, should the corresponding axis marks also expand? Alternatively, maybe other series should shrink to make room for the zoomed one? In any case, while there is no pre-defined tool for this, you can either use user-defined tool or your own descendant to capture key/mouse combinations, and either direct manipulation of axis transformation coefficients or auto-scaling transformation for the actual zoomig. See "axistransf"  demo for various examples, especially "Independent scale" page. A nave also noticed that marks on the left axis are quite cramped. There are properties in Axis.Marks to control axis intervals -- the may be useful. ---------------------------------------------------------------------- CM630 · 2012-09-12 10:06 Quote from: Ask on September 12, 2012, 10:58:51 amQuotezoom only horizontallyYes, that is easy. See e.g. http://wiki.lazarus.freepascal.org/TAChart_documentation#Zoom_click_to ol and http://wiki.lazarus.freepascal.org/TAChart_documentation#Extent_limits I rather used that as a part of the explanation, since I think that I've done it before. In case I have not- it will be useful to have a hint. QuoteShould the zoomed-in series expand above and below its usual range and overlap neighbor series? If so, should the corresponding axis marks also expand? No, I do not want the chart to overlap the other, I want what is visible to be displayed in the same rectangle as before zooming. QuoteAlternatively, maybe other series should shrink to make room for the zoomed one?I prefer to have all the graphics with the equal height, so I do not want any of them to change. QuoteIn any case, while there is no pre-defined tool for this, you can either use user-defined tool or your own descendant to capture key/mouse combinations, and either direct manipulation of axis transformation coefficients or auto-scaling transformation for the actual zoomig. See "axistransf"  demo for various examples, especially "Independent scale" page. Well I already tend to use separate charts. QuoteA nave also noticed that marks on the left axis are quite cramped. There are properties in Axis.Marks to control axis intervals -- the may be useful. That is why because I changed a line in the example: Code: [Select]for j := 1 to 20 do ls.AddXY(j, random*8); became Code: [Select]for j := 1 to 20 do ls.AddXY(j, i*(4-random*8);IMHO, it looks much better- all series have different amplitudes, + they have negative and positive values. Since, I have no idea how to get around this: QuoteBTW, I have the same problem for all the graphics demo- controls (usually TACHARTS) keep resizing with the form window. I could not find which property is responsible for that? ---------------------------------------------------------------------- Ask · 2012-09-12 14:29 Quote, I do not want the chart to overlap the other, I want what is visible to be displayed in the same rectangle as before zoomingSo you want to cut the selected series to some specific extent? Indeed, there is no such feature currently, so try many charts. You may find TChartExtentLink component useful in that case. Quote it looks much better- all series have different amplitudesI was talking about the features of the axis itself, not the data: http://wiki.lazarus.freepascal.org/TAChart_documentation#Axis_interval s Quote from: User137 on September 12, 2012, 10:16:30 amQuote from: paskal on September 12, 2012, 09:17:12 am... controls (usually TACHARTS) keep resizing with the form window. I could not find which property is responsible for that?Usually that is Align or Anchors property. Did you try that? ---------------------------------------------------------------------- CM630 · 2012-09-13 05:43 Oops, that's it "align". ---------------------------------------------------------------------- CM630 · 2012-11-05 12:35 Quote from: Ask on August 14, 2012, 03:19:20 pmQuote from: wpaxis title can only be single-lined in TAChart.Not so, see http://wiki.lazarus.freepascal.org/TAChart_documentation#Multi- line_marks and "Multiline" page of the "labels" demo. I did Code: [Select]Chart1.LeftAxis.Title.Visible:=True; Chart1.LeftAxis.Title.Caption:=Line1 + #10#13 + Line2 + #10#13 + Line3; I got Line1□□Line2□□Line3. Since wiki says „Multi-line marks If the mark text contains LineEnding character sequence, it is split into several lines. Lines of different length are aligned according to Alignment property.“ and „const LineEnding = #10;“ I tried Code: [Select]Chart1.LeftAxis.Title.Visible:=True; Chart1.LeftAxis.Title.Caption:=Line1 + #10 + Line2 + #10 + Line3; Then I got Line1□Line2□Line3. Both wiki and labelsdemo are about mark text, not about axis title. So either @wp is right or I cannot understand how to do things properly? ---------------------------------------------------------------------- wp · 2012-11-05 15:17 Try #13#10 ---------------------------------------------------------------------- Ask · 2012-11-05 16:56 Quoteconst LineEnding = #10;Where did you see that? What platform are you on? ---------------------------------------------------------------------- CM630 · 2012-11-06 06:52 Quote from: wp on November 05, 2012, 04:17:29 pmTry #13#10 Silly me, of course #10#13 should not work, since it is LfCr, and the right combination is CrLf. I've been mislead, that both values are reverse, because in fact LfCr works in showmessage('something'+#10#13+'else') (whether it should is another question). Quote from: Ask on November 05, 2012, 05:56:17 pmQuoteconst LineEnding = #10;Where did you see that? What platform are you on? First you go there: http://wiki.lazarus.freepascal.org/TAChart_documentation#Multi- line_marks and when you click on LineEnding you get to http://www.freepascal.org/docs-html/rtl/system/lineending.html. It says: QuoteLineEnding Constant describing the current line ending character. Declaration Source position: sysunixh.inc line 28 const LineEnding = #10;...In the labels demo I changed AText += Format(#13#10'%.9g', [AMark * 2]);   to AText += Format(#10'%.9g', [AMark * 2]);   and the lines do not get broken. I see two proper options: 1. Wiki shall be fixed if LineEnding = #10 (Lf) it shall point to something else. 2. TChart shall be changed to fit the Wiki. I do not know which line break is more consistent with Pascal, but I tried ShowMessage ('Line1'+#10+'Line2')' and the line got properly broken. Otherwise, considering the origin of LineFeed and CarriageReturn, only CrLf (and LfCr, but it is not a standard combination anywhere) makes sense. ---------------------------------------------------------------------- Ask · 2012-11-06 07:34 LineEnding is a cross-platform constant, which is #13#10 on Windows, #10 on Linux and some other platforms. This fact is unfortunately not reflected in the wiki docs. ---------------------------------------------------------------------- CM630 · 2012-11-06 07:51 Does it mean that AText += Format(#10'%.9g', [AMark * 2]); shall work in Linux? I thought that #10 (Lf) and #13#10 (CrLf) are OS specific only for the (bundled) text editors. Edit: In Linux it works both ways (#13#10 and #10). I wonder if #13#10 shall be recommended in wiki, in order to overcome system dependency, but who knows how will it behave on Mac. ---------------------------------------------------------------------- CM630 · 2013-04-20 13:03 IMHO there is something wrong with the titles of the right border. Here is the source: Code: [Select]procedure TForm1.Button1Click(Sender: TObject); const   CrLf = #13 + #10; begin   chart1.LeftAxis.Title.Font.Name:= 'Courier New';   chart1.LeftAxis.Title.Visible:=True;   chart1.LeftAxis.Title.Caption:= '1'+crlf+'2'+crlf+'3';   chart2.LeftAxis.Title.Font.Name:= 'Courier New';   chart2.LeftAxis.Title.Visible:=True;   chart2.LeftAxis.Title.Caption:= ' '+crlf+' '+crlf+'3'; //The is a space between the quotes in ' '   chart3.LeftAxis.Title.Font.Name:= 'Courier New';   chart3.LeftAxis.Title.Visible:=True;   chart3.LeftAxis.Title.Caption:= crlf+crlf+'3';   chart4.LeftAxis.Title.Font.Name:= 'Courier New';   chart4.LeftAxis.Title.Visible:=True;   chart4.LeftAxis.Title.Caption:= crlf+crlf+crlf+crlf+crlf+crlf+crlf+c rlf+crlf+crlf+crlf+crlf+crlf+crlf+crlf+crlf+crlf+crlf+'3'; end;      As you can see, CrLF has a different height in comparison with other characters, which is wrong. On the other side, as it seen from Chart4, the height of CrLf is not 0, but something else.