Features

DataEngine Service(DataEngine)

DataEngine Service(DataEngine)

The PivotEngine component binds to DataEngine Web API and DataEngine data.

Features

Settings

Description

In this sample, the PivotEngine component binds to a service. Here, only the DataEngine Web API is supported,
which is responsibe for data aggregation.
The service url should be provided in this mode.
You can get the details about how to deploy the DataEngine service in the DataEngine Web API documentation.

In this sample, the PivotEngine component connects to the DataEngine data.
The PivotPanel control, the PivotGrid control and the PivotChart control are bound to the PivotEngine.
You can change the view definition in the PivotPanel control.
The aggregated data will be obtained from the service.
Then the PivotGrid control and the PivotChart control display the aggregated data.
You can find the detailed raw data shown in a grid by double-clicking a cell in the PivotGrid control.

When the data row count is greater than 10,000, in order to get good performance, we recommend you use BindService(url) mode.
Otherwise, please use Bind(data) or Bind(url).

using C1.Web.Mvc.Olap;
using OlapExplorer.Models;
using System.Collections.Generic;
using System.Web.Mvc;

namespace OlapExplorer.Controllers.Olap
{
    partial class OlapController : Controller
    {
        private static Dictionary<string, object[]> ChartSettings = new Dictionary<string, object[]>
        {
            {"ChartType", new object[] { PivotChartType.Column, PivotChartType.Area, PivotChartType.Bar, PivotChartType.Line, PivotChartType.Pie, PivotChartType.Scatter} }
        };

        // GET: PivotGrid
        public ActionResult DataEngine()
        {
            var engineModel = new ClientSettingsModel { Settings = new Dictionary<string, object[]>() };
            foreach (var item in OlapModel.Settings)
            {
                engineModel.Settings.Add(item);
            }
            foreach (var chartItem in ChartSettings)
            {
                engineModel.Settings.Add(chartItem);
            }
            engineModel.ControlId = "chart";
            ViewBag.DemoSettingsModel = engineModel;
            return View();
        }
    }
}
@{
    ClientSettingsModel optionsModel = ViewBag.DemoSettingsModel;
}

@(Html.C1().PivotEngine().Id("dataEngine")
        .BindService("~/api/dataengine/complex10")
        .RowFields(pfcb => pfcb.Items("Country"))
        .ColumnFields(cfcb => cfcb.Items("Product"))
        .ValueFields(vfcb => vfcb.Items("Sales")))

<div class="row">
    <div class="col-sm-4 col-md-4">
        @Html.C1().PivotPanel().ItemsSourceId("dataEngine")
    </div>
    <div class="col-sm-8 col-md-8">
        @Html.C1().PivotGrid().Id("indexGrid").ItemsSourceId("dataEngine")
    </div>
</div>
@Html.C1().PivotChart().Id(optionsModel.ControlId).ItemsSourceId("dataEngine")

@section Description{
<p>@Html.Raw(Resources.Olap.DataEngine_Text0)</p>

<p>@Html.Raw(Resources.Olap.DataEngine_Text1)</p>

<p>@Html.Raw(Resources.Olap.DataEngine_Text2)</p>

}
@section Summary{
<p>@Html.Raw(Resources.Olap.DataEngine_Text3)</p>

}