"linkAreas"

With the trend attribute "linkAreas" you can link two trend areas.

Synopsis

setValue(string shape,"linkAreas", string area1, string area2);

getValue(string shape,"linkAreas", string area1, string area2);

shape.linkAreas(string area1, string area2);

Parameter

Parameter Description
area1 The first trend area. The index starts at 0.
area2 The second trend area.

Description

With the trend attribute "linkAreas" you can link two trend areas by time.

The second trend area is set to the start time of the first area. Also the displayed time span is set to the time of the first area. If an area is stopped, also the second area is stopped. If you leave the stop mode of the first area, you also leave the stop mode of the second area.

Example

The second example shows how trend areas are fixed (see "areaFixed"), linked and unlinked (see "unlinkAreas").

main()
{
  int timeArea = TREND1.numTrendAreas - 1; //Number trend areas -1
  if ( this.toggleState ) //Status of a button (ON = enabled & OFF
  = disabled).
 {
   if ( !TREND1.areaFixed(timeArea) ) //If trend area is not fixed
  {
    TREND1.addTrendArea(); //Adds a new trend area to the trend
    timeArea++;
    TREND1.timeScaleVisibility(timeArea, true, SCALE_BOTTOM); 
    //Shows a time scale at the bottom of the trend
    TREND1.areaFixed(timeArea, true); 
    //The area is fixed
  }
   int num = TREND1.numTrendAreas;//Number of trend areas
   for (int i = 0; i < num; i++) //As long as i < number of trend areas
  {
    TREND1.linkAreas(0, i); //link areas
    if ( i != (num - 1) )
    TREND1.timeScaleVisibility(i, false, SCALE_BOTTOM);
  }
 }
   else
  {
    TREND1.removeTrendArea(timeArea); //Delete trend area
    int num = TREND1.numTrendAreas;
    for (int i = 0; i < num; i++)
   {
     TREND1.unlinkAreas(0, i); //unlink areas
     TREND1.timeScaleVisibility(i, true, SCALE_BOTTOM);
   }
  }
}
Figure 1. Linked Trend areas

Assignment

Trend