Changing Y Axies Scales in run time. lazarus / 31-LCL ---------------------------------------------------------------------- Hopestation · 2014-08-05 12:10 Hi. I am new to the TaChart component and am struggling to change chart scales from the program. I have added the chart to the form and created two TLineseries which are linked to the left and right axies. I have added Auto Scale TChartAxisTransformations for each Y axis and set the range for each to User values of 1100 and 550 respectively. My program compares the Y value added to the Lineseries at each Timer.Event with the current Max value for the range and doubles the Max value if the new Y value is larger than the Max value. This changes the chart, halving the height of the plot but the grid lines and scaling on the Y axis stop half way up the axis at the original values. I do the same thing with the X axis, but this does have associated transforms and it does exactly what I want. The initial Max value is 100 and when the added LineSeries X value exceeds it the scale changes to 200 and the grid line appear across the whole of the chart. I See attached picture. Here is a section of the program:- {*** Simulate temperature and Voltage readings ***}     Runtime := Runtime + Timer1.Interval;     M := Runtime div 1000;                                            //X Axis     EdtTgt2.text := FloatToStr(Chart.AxisList[0].Range.Max);     EdtRmp2.text := FloatToStr(Chart.AxisList[2].Range.Max);     if M >= Chart.AxisList[1].Range.Max then       Chart.AxisList[1].Range.Max := M * 2;     N := M * 10;                                                           //Temp     SeriesTemp.AddXY(M,N);                                          //LH Axis     if N >= Chart.AxisList[0].Range.Max then       Chart.AxisList[0].Range.Max := Chart.AxisList[0].Range.Max * 2;     P := N * 11 Div 10;                                               //Volts     SeriesVolts.AddXY(M,P);                                         //RH Axis     if P >= Chart.AxisList[2].Range.Max then       Chart.AxisList[2].Range.Max := Chart.AxisList[2].Range.Max * 2;     Memo1.lines.add(Format('%8S :  %4d°C :  %4dmV', [TimeToStr(Time2), N, P])); {*** End of Simulation ***} How do I get the axis scale and grid lines to change to the new axis.range.max value? Thanks ---------------------------------------------------------------------- wp · 2014-08-05 13:24 At first sight, your approach seems to be correct, but since you don't show the other properties it is difficult to say what's wrong. Have a look at attached demo which seems to behave in the way that you want. ---------------------------------------------------------------------- Hopestation · 2014-08-05 15:27 Thanks WP. It does exactly what I was hoping to do. I notice that you added to the series after changing the range. I will have to find the difference between our codes. Thanks ---------------------------------------------------------------------- Hopestation · 2014-08-05 15:57 Hi. I have possibly found the answer. There are 2 Range properties and I have only changed 1. The attached picture shows the Object inspector for the form. The upper Range is in the Marks property has a Maximum of 1600 The Lower Range is in the Axis property has a Maximum of 250. I have only changed the 250 value. Thanks ---------------------------------------------------------------------- wp · 2014-08-05 18:41 The upper Range property is a subproperty of Marks, i.e. it determines the range which is labelled by ticks and marks - you see that when you scroll up a bit. This feature is useful when you overlay several axes on the same line and offset them by means of AutoscaleTransformations (like in the tutorial http://wiki.lazarus.freepascal.org/TAChart_Tutor ial:_Multiple_Panes_in_one_Chart). The other Range property is a direct property of the axis and determines axis scaling, i.e. the value corresponding to the upper and lower end of the axis. In order to change the color of an axis you have to modify several properties: AxisPen.Color AND AxisPen.Visible for the axis line (yes - the axis line is hidden by default. The box that you see around the chart area is the "Frame"). Marks.LabelFont.Color for the axis labels TickColor for the axis ticks. If you have a minor axis, don't forget the Minors[].TickColor Title.LabelFont.Color for the axis caption. Again you have to turn on Title.Visible to show the caption. ---------------------------------------------------------------------- Hopestation · 2014-08-09 16:58 Thanks for your help. One further problem with scales. I always double the scale when the data reaches the top. The attached picture shows that the right axis changes from integers values to floating point on the 2000 scale, only. Te 500, 1000, 4000 and 8000 are all good, but I get values of 167.770419 and 2013.24503 on the 2000µV scale. I am using the Mark Format "%0:.9gµV" which is the same as your example, with "µV" added. I noticed that in your example you left the Mark range as 0,0 and both false, so I did the same, but it made no difference. Is there a reason for this anomaly? Is there somewhere that lists all the properties of the Chart component and their uses? I have looked at various WIKI examples and tutorials, but they only explain those properties that are relevant to the example. For example, how is Nice Steps used? Changing it to 0.25 on one axis worked, but 0.2 on the other axis gave rubbish. Thanks again. ---------------------------------------------------------------------- wp · 2014-12-16 09:16 Sorry I did not see this one, but I think it is not good to leave it without an answer... Having such irregular labels at the right axis is not normal. You probably fiddled around with the Intervals property and forgot something to set back to its original value. The default settings of Intervals are:Count = 5MaxLength = 50MinLength = 10NiceSteps = 0.2|0.5|1.0Options = [aipUseMaxLength,aipUseMinLength,aipUseNiceSteps]Tolerance = 0NiceSteps means that the label-finding algorithms tries to set the label marks at the values shown, i.e., 0.01, 0.02, 0.05, 0.1, 0.2, 0.5, 1, 2, 5, 10 etc. For this to work the corresponding option must be set. If you have aipUseCount in the Options the labeller will put priority on the label count which normally produces weird label values, like in your case. If labels overlap you may increase the MinLength and MaxLength values - these parameters (along with their corresponding options) control the density of labels along the axis. Tolerance helps in connection with rounding errors, I often get "nicer" labels when this property is increase moderately (such as 3 or 5). QuoteIs there somewhere that lists all the properties of the Chart component and their uses?In addition to the tutorials, there is the TAChart documentation and the TAChart User Guide. Moreover, don't forget the bunch of demo projects in the folder components/tachart/demo of your Lazarus installation (they are described in http://wiki.lazarus.freepascal.org/TAChart_Demos).