The SDL Component Suite is an industry leading collection of components supporting scientific and engineering computing. Please visit the SDL Web site for more information....



Upgrading RChart from Version 7.2 to Version 8.0


Question:

Which properties do I have to change and what do I have to account for when upgrading RChart from version 7.2 to version 8.0?

Answer:

RChart, Release 8.0, comes with an entirely different data structure and a new way of displaying data in up to 16 layers which can be scaled independently in x and y. This major extension of RChart requires some steps on your side to migrate your code to the new version. By default, the new RChart is set up in a way that its visual appearance as well as its function resembles the old version. However, due to the new system of independently scaled layers, you have to adjust various properties. The following description provides step by step instructions how to upgrade to version 8.0:

Step 1: Load the application into the Delphi IDE and open each form which contains an RChart. You will be prompted for missing properties, such as RangeHiX, RangeHiY, RangeLoX, RangeLoY, LogScaleX, LogScaleY, MinRangeX, MinRangeY, ShortTicksX, ShortTicksY, XLabelType, YLabelType, DTXFormat.xxxxxx, DTYFormat.xxxxxx, and perhaps a few more. Simply click on "Ignore".

Step 2: Adjust the new RChart properties (using the Object Inspector) to meet your requirements. The following table shows the old names and the replacement properties (shown with the TRChart instance RC):

Version 7.2
old property or method
Version 8.0
change to/replace by
RC.DecPlaceX RC.Scale1X.DecPlaces
RC.DecPlaceY RC.Scale1Y.DecPlaces
RC.RangeLoY RC.Scale1Y.RangeLow
RC.RangeLoX RC.Scale1X.RangeLow
RC.RangeHiX RC.Scale1X.RangeHigh
RC.RangeHiY RC.Scale1Y.RangeHigh
RC.IdAbscissa RC.Scale1X.Caption
RC.IdOrdinate RC.Scale1Y.Caption
RC.LogScaleX RC.Scale1X.Logarithmic
RC.LogScaleY RC.Scale1Y.Logarithmic
RC.MinRangeX RC.Scale1X.MinRange
RC.MinRangeY RC.Scale1Y.MinRange
RC.MinTickX RC.Scale1X.MinTicks
RC.MinTickY RC.Scale1Y.MinTicks
RC.ShortTicksX RC.Scale1X.ShortTicks
RC.ShortTicksY RC.Scale1Y.ShortTicks
RC.XAxisPos RC.Scale1X.ScalePos and RC.Scale1X.ScaleLocation
(this is no direct replacement, since the new properties "Scale1X.ScalePos" and "Scale1X.ScaleLocation" allow a more flexible adjustment of the position of the axis - you have to experiment with it)
RC.YAxisPos RC.Scale1Y.ScalePos and RC.Scale1Y.ScaleLocation
(see remark above)
RC.XLabelType RC.Scale1X.LabelType
if XLabelType is "ftNoScales", set RC.Scale1X.Visible := false
RC.YLabelType RC.Scale1Y.LabelType
if YLabelType is "ftNoScales", set RC.Scale1Y.Visible := false
RC.DTXFormat.xxxxxx RC.Scale1X.DateFormat.xxxxxx
RC.DTYFormat.xxxxxx RC.Scale1Y.DateFormat.xxxxxx
RC.ClassicLayout RC.StandardLayout
RC.ScaleColor RC.ChartFrameColor

Step 3: Change all explicit references to any RChart properties in the source code using the same replacement table as in step 2. In addition, adjust the following statements:

Version 7.2
old version
Version 8.0
change to/replace by
(changes are in red color)
Remarks
RC.CrossHairN RC.CrossHairN.Layer Each crosshair is assigned to a different layer by default. If the crosshair behaves weird after porting your application to the new RChart, this is most probably due to wrong layer assignments. Try to set the Layer property of all crosshairs to 1.
RC.AutoRange (xLo, yLo, xHi, yHi); RC.AutoRange (1, xLo, yLo, xHi, yHi); The first parameter is the layer number whose scaling is to be changed. By default, layer 1 behaves like the old RChart.
RC.SetRange (xLo, yLo, xHi, yHi); RC.SetRange (1, xLo, yLo, xHi, yHi); The first parameter is the layer number whose scaling is to be changed. By default, layer 1 behaves like the old RChart.
RC.R2M (xin, yin, xout, yout); RC.R2M (1, xin, yin, xout, yout); The first parameter is the number of the layer whose scaling is to be changed. By default, layer 1 behaves like the old RChart.
RC.M2R (xin, yin, xout, yout); RC.M2R (1, xin, yin, xout, yout); The first parameter is the number of the layer whose scaling is to be changed. By default, layer 1 behaves like the old RChart.
RC.ClassicLayout := true; RC.StandardLayout := rcl_X1Bottom_Y1Left;
see StandardLayout for details
The old classic and the old alternative layout cannot be mimicked automatically. The best approximation is the standard layout rcl_X1Bottom_Y1Left.
RC.LoadLinkedList RC.LoadData
see LoadData for details
The linked list has been replaced by a dynamic array. Thus the method LoadLinkedList has been discarded. A functional replacement is the method LoadData.
RC.SaveLinkedList
RC.SaveLinkedListASC
RC.SaveData
RC.SaveDataASC

see SaveData and SaveDataASC for details
The linked list has been replaced by a dynamic array. Thus the methods SaveLinkedList and SaveLinkedListASC have been discarded. Functional replacements are the methods SaveData and SaveDataASC.
RC.FirstItemOfLinkedList RC.DataContainer[0]
see DataContainer for details
The linked list has been replaced by a dynamic array. Thus the method FirstItemOfLinkedList has been discarded; use DataContainer[0] instead.
RC.LastItemOfLinkedList RC.DataContainer[NumItems-1]
see DataContainer for details
The linked list has been replaced by a dynamic array. Thus the method FirstItemOfLinkedList has been discarded; use DataContainer[NumItems-1] instead.
RC.FindNearestItemReal
RC.FindNearestItemScreen
Function result differs between release 7.2 and 8.0 Function returns the index into the data container (and not a pointer to the linked list)
RC.GetItemParams
RC.SetItemParams
RC.RemoveItem
Parameters differ between release 7.2 and 8.0 Pointer into linked list is replaced by index into the data container.
RC.DrawMarkOnCanvas use DrawMarkOnCanvas (unit sdlbase) the method DrawMarkOnCanvas has been discarded and replaced by the procedure DrawMarkOnCanvas.
RC.PrintItHires use RC.PrintIt The method PrintIt has been discarded; the former method PrintItHiRes has been renamed to PrintIt to unify printout handling throughout the chart components.
RC.CopyToOpenPrinterHiRes use RC.CopyToOpenPrinter The method CopyToOpenPrinter has been discarded; the former method CopyToOpenPrinterHiRes has been renamed to CopyToOpenPrinter to unify printout handling throughout the chart components.
PDrawCan, TDrawCan no longer supported
PDrawCan becomes an integer value, TDrawCan becomes TrcChartItem.
The pointer into a linked list is replaced by an index into the data container. The data container consists of elements of type TrcChartItem.
TDrawCan.Element TrcChartItem.ItemKind The field Element of TDrawCan has been renamed to ItemKind in TrcChartItem. All other fields of TDrawCan have equally named fields in TrcChartItem.
RcMaxDouble uc_MaxDouble The definition of RcMaxDouble has been renamed to uc_MaxDouble and moved to unit UnivConst of the package BasePack. Don't forget to add 'univconst' to the uses statement of your unit.

Step 4: If required insert the following 'uses' statement into the implementation section (this is required due to the fact that several common type declarations have been moved to the unit sdlbase):


   uses sdlbase;

Typically, an error message such as "Undeclared identifier 'maPan'" is displayed, if the reference of unit sdlbase is missing.

Step 5: Compile the new code and test it.


Last Update: 2023-Feb-06