Articles in this section
Category / Section

How to display OLAP Chart and OLAP Grid on the same page?

1 min read

You can display OLAP Chart and OLAP Grid on the same page using the following code example at sample level.


<syncfusion:OlapGrid ID="OlapGrid1" runat="server"></syncfusion:OlapGrid>
<syncfusion:OlapChart ID="OlapChart1" runat="server"></syncfusion:OlapChart>


protected void Page_Load(object sender, EventArgs e)
            if (!IsPostBack)
                //Provide a valid connection string in the Data Source
                DataManager = new OlapDataManager("Data Source=D:\\cube\\Adventure_Works_Ext.cub;Provider=MSOLAP");
                this.OlapGrid1.OlapDataManager = DataManager;
                this.OlapGrid1.EnableViewState = true;
                this.OlapChart1.OlapDataManager = this.OlapGrid1.OlapDataManager;
        private OlapReport CreateOlapReport()
            OlapReport olapReport = new OlapReport();
            olapReport.CurrentCubeName = "Adventure Works";
            DimensionElement dimensionElementColumn = new DimensionElement();
            //Specifying the Name for the Dimension Element
            dimensionElementColumn.Name = "Customer";
            dimensionElementColumn.AddLevel("Customer Geography", "Country");
            MeasureElements measureElementColumn = new MeasureElements();
            //Specifying the Name for the Measure Element
            measureElementColumn.Elements.Add(new MeasureElement { Name = "Internet Sales Amount" });
            DimensionElement dimensionElementRow = new DimensionElement();
            //Specifying the Dimension Name
            dimensionElementRow.Name = "Date";
            dimensionElementRow.AddLevel("Fiscal", "Fiscal Year");
            return olapReport;


Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
If (Not IsPostBack) Then
                                                                'Provide a valid connection string in the Data Source
                DataManager = New OlapDataManager("Data Source=D:\cube\Adventure_Works_Ext.cub;Provider=MSOLAP")
                Me.OlapGrid1.OlapDataManager = DataManager
                Me.OlapGrid1.EnableViewState = True
                Me.OlapChart1.OlapDataManager = Me.OlapGrid1.OlapDataManager
End If
End Sub
Private Function CreateOlapReport() As OlapReport
                Dim olapReport As OlapReport = New OlapReport()
                olapReport.CurrentCubeName = "Adventure Works"
                Dim dimensionElementColumn As DimensionElement = New DimensionElement()
                'Specifying the Name for the Dimension Element
                dimensionElementColumn.Name = "Customer"
                dimensionElementColumn.AddLevel("Customer Geography", "Country")
                Dim measureElementColumn As MeasureElements = New MeasureElements()
                measureElementColumn.Elements.Add(New MeasureElement With {.Name = "Internet Sales Amount"})
                Dim dimensionElementRow As DimensionElement = New DimensionElement()
                'Specifying the Dimension Name
                dimensionElementRow.Name = "Date"
                dimensionElementRow.AddLevel("Fiscal", "Fiscal Year")
                Return olapReport
End Function


Did you find this information helpful?
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment