PivotGridExtension.GetDataObject(PivotGridSettings, String, Boolean) Method
Generates a chart data source from OLAP data.
Namespace: DevExpress.Web.Mvc
Assembly: DevExpress.Web.Mvc5.v26.1.dll
Declaration
public static object GetDataObject(
PivotGridSettings pivotGridSettings,
string olapConnectionString,
bool applyClientState
)
Parameters
| Name | Type | Description |
|---|---|---|
| pivotGridSettings | PivotGridSettings | A PivotGridSettings object that specifies pivot grid settings that define how to generate a chart data source. |
| olapConnectionString | String | A String that specifies the connection string to an OLAP cube. |
| applyClientState | Boolean | A Boolean value that specifies whether to apply the pivot grid’s client state to a chart data source. |
Returns
| Type | Description |
|---|---|
| Object | A chart data source. |
Remarks
Use the static GetDataObject method in the controller to create a model for a Chart extension and pass it to the corresponding view.
The GetDataObject method internally creates a PivotGrid extension based on the provided settings, binds it to the specified OLAP cube and returns a chart data source provided by the created PivotGrid.
A sample OLAP connection string is shown below:
Provider=msolap;Data Source=localhost;Initial Catalog=Adventure Works DW;Cube Name=Adventure Works;Query Timeout=100;
This connection string provides the following parameters:
- Provider - Identifies a data provider to be used. The “msolap” string identifies the latest version of Microsoft SQL Server Analysis Services (SSAS);
- Data Source - Specifies the name of the server that runs an instance of SSAS;
- Initial Catalog - Specifies a data catalog that contains cubes;
- Cube Name - Specifies the name of the cube that provides OLAP data;
- Query Timeout (optional) - the number of seconds to wait until a query to SSAS is completed. If this parameter is set to 0, each query can last indefinitely.
To create a chart data source from regular data, use a GetDataObject method overload that accepts a dataSource parameter. When the Pivot Grid uses server mode, use PivotGridExtension.GetEFDataObject or PivotGridExtension.GetLINQDataObject, depending on the data provider type.
Note
Use the applyClientState method parameter to apply the Pivot Grid’s client state to a chart data source. If you do not specify this parameter, the client state is ignored during a postback.
You can use the PivotGridSettings.BeforeGetDataObject property to apply custom settings to the PivotGrid before a Chart data source is generated but after the PivotGrid’s callback state is applied.