PivotGridExtension.GetDataObject(PivotGridSettings, String, Boolean) Method
Generates a chart data source from OLAP data.
Namespace: DevExpress.Web.Mvc
Assembly: DevExpress.Web.Mvc5.v24.1.dll
NuGet Package: DevExpress.Web.Mvc5
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 another overload of the GetDataObject method that takes a dataSource parameter. To generate a chart data source from data when the Pivot Grid operates in server mode, use the PivotGridExtension.GetEFDataObject or PivotGridExtension.GetLINQDataObject methods, 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 this parameter is not specified, the client state will be ignored if a postback is performed.
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.