"setSeriesParent"

This function adds a parent to a series and thus defines the tree structure for the Treemap diagramm.

Synopsis

void shape.setSeriesParent(int series, int parentSeries)

Parameters

Parameter Description
series The child series.
parentSeries The series which will be set as parent.

Description

With the use of this function the parent series will add an item which then points to the child series. The value of this item will be automatically calculated to hold the sum of all item values in the child series.

Each of the nested rectangles uses data (color, brush, label, etc.) from the item it displays, if it represents a leaf item. If the item points to a sub-series, the data for display is taken from this sub-series. The label and value are only drawn if the shownValueText property is not "None".

The legend for the Treemap is used to display the path along the tree currently shown. The first entry is the label of the root series, while the last entry shown is from the series which is currently displayed as the root (first) level. Clicking on any legend item navigates to the clicked series and sets it as the currently displayed first level.

Double-clicking a rectangle in the Treemap, which represents an intermediate branch (not a leaf), will switch this series to being displayed as the current root (first) level. Right-clicking will navigate one level up, if this is possible.

Example

This example sets a Serie 0 as root level and then adds 3 further series below that.

main()
{
  dyn_int values;
  dyn_string labels;
  Chart1.addSeries(makeDynFloat( 3.5, 4.3), makeDynString( "Product1.1", "Product1.2"));
  Chart1.setSeriesName(0, "Serie 0");
  for (int serieN = 1; serieN <= 3; ++serieN)
  {
    if ( serieN >= 1 )
    {
      for (int i = 1; i <= 3; i++)
      {
        values[i] = 1 + i;
        labels[i] = "NewProduct" + i;
      }
    }
    this.setSeries(serieN, values, labels);
    this.setSeriesName(serieN, "Serie " + serieN);
    this.setSeriesParent(serieN, serieN - 1);
  }
}
Figure 1. Treemap chart

Assignment

Chart.ewo