When you add new items to the NLegendData object the legend may become too long to display in the control canvas. This is why you may wish to alter the legend layout strategy or in other words the way the legend expands when new items are added. The ExpandMode property of the NLegendData controls this. The following table list the possible strategies:
LegendExpandMode | Description |
---|---|
RowsOnly | The legend expands by adding new rows only and there is only one column. |
ColsOnly | The legend expands by adding new columns only and there is only one row. |
RowsFixed | The legend expands by adding new rows until it reaches the value RowCount (which is initially 10) and then adds a new column. In other words the row count is limited and the column count is unlimited. |
ColsFixed | The legend expands by adding new columns until it reaches the value ColCount (which is initially 10) and then adds a new row. In other words the column count is limited and the row count is unlimited. |
HorzWrap | The legend tries to fit in the assigned bounds by increasing the number of rows and then the number of columns. |
VertWrap | The legend tries to fit in the assigned bounds by increasing the number of columns and then the number of rows. |
The following example shows this:
C# |
Copy Code
|
---|---|
legend.Data.ExpandMode = LegendExpandMode.RowsFixed; legend.Data.RowCount = 4; |
Visual Basic |
Copy Code
|
---|---|
legend.Data.ExpandMode = LegendExpandMode.RowsFixed legend.Data.RowCount = 4 |
If you have 12 data items in the legend this layout will produce a legend similar to this one: