ScatterPlot_Matrix.rtf

(3 KB) Pobierz

Point Plot - Salary vs. Gender vs. Age

This sample application demonstrates a ChartControl with PointPlot defined series in a Multi-Chart setup.

In this example, we have 6 charts presented in a single ChartControl.  There is one chart for each of the following age groups - 20's, 30's, 40's, 50's, and 60's.  And one "All Ages" chart, which is the accumulation of each of the previous 5 individual age group charts.

Within each of the above 6 charts, there are 2 defined series - one for Males and one for Females (male series are colored blue, female series are colored red).

Things to note:

This is the first example of a multi-chart ChartControl.  The ChartControl always defines a ChartMatrix - but it normally only contains a 1x1 sized matrix containing a single chart element.  In this case the ChartControl has 6 defined charts that it is managing within the ChartMatrix.

By default, the ChartControl is setup to auto-size and auto-fill the ChartMatrix.  So, in this example when the "Auto Size Matrix" checkbox is checked at the bottom of the form, the ChartControl will auto-size the matrix and fill it based upon the available space vertically and horizontally.  The ChartMatrix can be set to fill vertically then horizontally - or reversed to that.

When the “Auto Size Matrix" checkbox is cleared, the application redefines the ChartMatrix to a 6x6 matrix and fills the upper left quadrant of it with the defined charts.  These charts could have been placed in any matrix cell - or any contiguous range of cells - overlapping or not.  The matrix can be scrolled and panned, and can have divider lines presented or not.

In this sample application, when the “Auto Size Matrix" checkbox is cleared, you can select one or more charts by clicking on them (ctrl-click to select multiple).  Once selected, you can either move the charts to another matrix cell, or resize the charts.  To move a chart (or charts), select them and then press the up or down arrow keys.  To resize a chart (or charts), select them and press the ctrl-up or ctrl-down arrow keys.

Note that charts can fully or partially overlap other charts. The ChartControl permits you to set the Z-Order of the chart elements, and you can do so in the application via the Bring-to-Front and Send-to-Back buttons at the bottom of the form. 

You can also right-click on a given chart and matrix cell, and use the presented context menu, to move/resize/order the selected item(s);

The moving and resizing is being completely handled by the application, and is only being presented as a demonstration of the underlying ChartMatrix layout possibilities.

Panning/scrolling is enabled for each individual chart as well as the defined ChartPanel/ChartMatrix. As normal, each presented Legend can be scrolled/panned if needed.

One final note, relates to the presented Legend.  In this example, each individual chart Legend is not displayed, but rather the parent ChartPanel Legend is displayed, and is set to include all legend items of its subordinate elements (in this case, all 6 defined charts in its ChartMatrix).  It is also set to combine "like named series" from each of these items.  As a result, when you toggle one of the checkbox items (for example, the "Age 20s Male"), you will see that the display of the Male series in the "Age 20s" chart is toggled - and - the Male "Age 20s" series in the "All Ages" chart is also toggled.

Zgłoś jeśli naruszono regulamin