5.10.1 View Grid

ViewGrid is used to arrange several charts in one “page”. This functionality can be easily accomplished by using several separate view container components, but using ViewGrid is easier. For instance, placing legend and footer at the same place.

Grid is constructed by specifying the number of rows and columns in the view. Each row and column can be given a weight, which by default is set to 1. Weight makes the column/row thinner or wider. A column/row of weight 2 is two times wider the column of a default weight 1.

ViewGrid has a subclass ViewGridIndexed, which allows to control where individual views are placed in the grid (using the addView method).

Using ViewGrid:

1
2
3
4
5
Legend legend = new Legend(chart);
ViewGrid vg = new Viewgrid(1,2);
vg.add(legend);
vg.add(footer);
m_chart.setBottom(vg); // m_chart is instance of LabeledChart

View Grid without borders

To hide black line borders in ViewGrid, use style :

 
ViewGrid c = new ViewGrid(2, 4);
c.addView(initChart1());
c.style.setForeground(null); // removes border