Ready to get started?

Learn more about the CData ADO.NET Provider for DataRobot or download a free trial:

Download Now

DataBind DataRobot Data to the DevExpress Data Grid

Use the CData ADO.NET Provider for DataRobot with the DevExpress Windows Forms and Web controls to provide DataRobot data to a chart.

The CData ADO.NET Provider for DataRobot implements standard ADO.NET data access components that can be used with third-party controls. The standard ADO.NET process for databinding can be followed to enable bidirectional access to live data from UI controls. In this article we show how to use the CData components to databind to the DevExpress Windows Forms and Web controls; you will databind to a chart that displays current data.

To connect to DataRobot, the following connection properties are required: User, Password, and PredictionInstance. DataRobotKey may also be required depending on your type of DataRobot predictions instance. If using the Predictions API, DataFile is required. The CSV DataFile should include a header row as the first row of the datafile. APIKey is not required, but can be supplied. If not supplied, the driver will handle obtaining an APIKey.

User, DataRobotKey, and APIKey are the credentials for the DataRobot account.

ProjectID, DataFile, and ModelId are the parameters for the project, dataset, and model type.

Windows Forms Controls

The code below shows how to populate a DevExpress chart with DataRobot data. The DataRobotDataAdapter binds to the Series property of the chart control. The Diagram property of the control defines the x- and y-axes as the column names.

using (DataRobotConnection connection = new DataRobotConnection( "PredictionInstance=myinstance.orm.datarobot.com;DataFile=PATH\TO\input_file.csv;DataRobotKey=123-abc-456-def;User=username;Password=password;")) { DataRobotDataAdapter dataAdapter = new DataRobotDataAdapter( "SELECT Id, Prediction1Value FROM Predictions", connection); DataTable table = new DataTable(); dataAdapter.Fill(table); DevExpress.XtraCharts.Series series = new DevExpress.XtraCharts.Series(); chartControl1.Series.Add(series); series.DataSource = table; series.ValueDataMembers.AddRange(new string[] { "Prediction1Value" }); series.ArgumentScaleType = DevExpress.XtraCharts.ScaleType.Qualitative; series.ArgumentDataMember = "Id"; series.ValueScaleType = DevExpress.XtraCharts.ScaleType.Numerical; chartControl1.Legend.Visibility = DevExpress.Utils.DefaultBoolean.False; ((DevExpress.XtraCharts.SideBySideBarSeriesView)series.View).ColorEach = true; }

Web Controls

The code below shows how to populate a DevExpress Web control with DataRobot data. The DataRobotDataAdapter binds to the Series property of the chart; the Diagram property defines the x- and y-axes as the column names.

using DevExpress.XtraCharts; using (DataRobotConnection connection = new DataRobotConnection( "PredictionInstance=myinstance.orm.datarobot.com;DataFile=PATH\TO\input_file.csv;DataRobotKey=123-abc-456-def;User=username;Password=password;")) { DataRobotDataAdapter DataRobotDataAdapter1 = new DataRobotDataAdapter("SELECT Id, Prediction1Value FROM Predictions", connection); DataTable table = new DataTable(); DataRobotDataAdapter1.Fill(table); DevExpress.XtraCharts.Series series = new Series("Series1", ViewType.Bar); WebChartControl1.Series.Add(series); series.DataSource = table; series.ValueDataMembers.AddRange(new string[] { "Prediction1Value" }); series.ArgumentScaleType = ScaleType.Qualitative; series.ArgumentDataMember = "Id"; series.ValueScaleType = ScaleType.Numerical; ((DevExpress.XtraCharts.SideBySideBarSeriesView)series.View).ColorEach = true; }