Charts in AX 7 are new features, that gives great visual overview on records, and they are great improvement from the old way of creating charts on AX 2012. They are usually used as Parts forms to another forms mostly to Workspaces and they shows calculated information represented as graphs or charts.
For creating Form with chart is used “Hub Part Chart” pattern and this pattern is contained of HeaderGroup (optional) and Chart control.
Chart control contains 5 sub-nodes:
- Bindings –used for binding records to specific range or group of records as some names or items or orders.
- Series – used to specify series of data bind to specified Binding data as dates, calculated sums or quantities.
- Secondary Y-Axes – used to specify second series that will be bind to Binding data.
To be able to control Bindings in code you can use it the method from the chart DataSets(), same if we want to change the Series with code we can use method Measures()
List mdt = chartControlName.Measures();
ListEnumerator mdit = mdt.getEnumerator();
SysChartMeasure ms = mdit.current();
When you change the categories field in code to field that is from another type that defined one you must define the type of the categories.
Example we have chart with bindings (categories properties) to field TransDate from type date, and we try to change through code to field Name from type string we must use parmCategoriesType(SysChartCategoriesType::String) method.
When we change some parameters in the chart we need to use update() method for this changes to be refreshed to the current form.
There is possibility to do some action from menu item when you click on some part of the chart bars which is controlled with properties on the chart MenuItemType and MenuItemName or with override to a method DrillThrough() on the chart.
public void DrillThrough(str _contextObject)
Args args = new Args();
new MenuFunction(menuItemDisplayStr(PSOTSTimesheetLineOverview), MenuItemType::Display).run(args);