Hi,
I would like to share you how to display data in graphs and charts in AX 2012 Forms
for an example i have displayed the customer details whose invoice amount is greater than 10000 and less than 20000
step 1:
create a new form called CustomerInvoiceAmountGraph
step 2:
add custInvoicaJour table as datasource
step 3 :
override init() method and class declaration method
public class FormRun extends ObjectRun
{
Graphics graphics;
CustInvoiceJour custinvoiceJourGraphValues;
Microsoft.Dynamics.AX.Framework.Client.Controls.ChartToolBar chartToolbarControl;
}
public void init()
{
super();
// create an runtime reference to the toolbar control
chartToolbarControl = chartToolbarControlHost.control();
// bind the tool bar to the chart control by passing an instance of the chart control to it
chartToolbarControl.set_ChartControl(graphControl.control());
this.showchart();
}
step 4:
create a new method called showchart() where your logic is placed to display the customer data
whose invoice amount is greater than 10000 and less than 20000
void showchart()
{
// create an instance of the X++ to .NET abstraction class and bind it to the chart control
graphics = new Graphics();
graphics.ManagedHostToControl(graphControl);
// set your abstracted chart options
graphics.create();
graphics.parmTitle("@SYS95906");
graphics.parmTitleXAxis("CustAccount");
graphics.parmTitleYAxis("Amount");
// populate the chart with data
while select CustInvoiceJour where CustInvoiceJour.InvoiceAmount>=10000 && CustInvoiceJour.InvoiceAmount <=20000
{
graphics.loadData( CustInvoiceJour.InvoiceAccount, ' ' , CustInvoiceJour.InvoiceAmount);
}
graphics.showGraph();
}
step 5:
Right click Design->New control->ManagedHost
select Microsoft.Dynamics.AX.Framework.Client.Controls.ChartToolBar
step 6:
Right click Design->New control->ManagedHost
select System.Windows.Forms.DataVisualization.Charting.Chart and change the name of the control as GraphControl
output:
Happy Daxing.....
I would like to share you how to display data in graphs and charts in AX 2012 Forms
for an example i have displayed the customer details whose invoice amount is greater than 10000 and less than 20000
step 1:
create a new form called CustomerInvoiceAmountGraph
step 2:
add custInvoicaJour table as datasource
step 3 :
override init() method and class declaration method
public class FormRun extends ObjectRun
{
Graphics graphics;
CustInvoiceJour custinvoiceJourGraphValues;
Microsoft.Dynamics.AX.Framework.Client.Controls.ChartToolBar chartToolbarControl;
}
public void init()
{
super();
// create an runtime reference to the toolbar control
chartToolbarControl = chartToolbarControlHost.control();
// bind the tool bar to the chart control by passing an instance of the chart control to it
chartToolbarControl.set_ChartControl(graphControl.control());
this.showchart();
}
step 4:
create a new method called showchart() where your logic is placed to display the customer data
whose invoice amount is greater than 10000 and less than 20000
void showchart()
{
// create an instance of the X++ to .NET abstraction class and bind it to the chart control
graphics = new Graphics();
graphics.ManagedHostToControl(graphControl);
// set your abstracted chart options
graphics.create();
graphics.parmTitle("@SYS95906");
graphics.parmTitleXAxis("CustAccount");
graphics.parmTitleYAxis("Amount");
// populate the chart with data
while select CustInvoiceJour where CustInvoiceJour.InvoiceAmount>=10000 && CustInvoiceJour.InvoiceAmount <=20000
{
graphics.loadData( CustInvoiceJour.InvoiceAccount, ' ' , CustInvoiceJour.InvoiceAmount);
}
graphics.showGraph();
}
step 5:
Right click Design->New control->ManagedHost
select Microsoft.Dynamics.AX.Framework.Client.Controls.ChartToolBar
step 6:
Right click Design->New control->ManagedHost
select System.Windows.Forms.DataVisualization.Charting.Chart and change the name of the control as GraphControl
output:
Happy Daxing.....