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. Now only the DataEngine Web API is supported.
The service-url attribute should be set 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 show 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 set the service-url attribute in the tag.
Otherwise, please set the source-collection attribute or the read-action-url attribute in the tag used in the Index page and the RemoteBind page.

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

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.DemoOptions = engineModel;
            return View();
        }
    }
}
@{
    ClientSettingsModel optionsModel = ViewBag.DemoOptions;
}

<c1-pivot-engine id="dataEngine" service-url="~/api/dataengine/complex10">
    <c1-view-field-collection c1-property="RowFields" items="Country"></c1-view-field-collection>
    <c1-view-field-collection c1-property="ColumnFields" items="Product"></c1-view-field-collection>
    <c1-view-field-collection c1-property="ValueFields" items="Sales"></c1-view-field-collection>
</c1-pivot-engine>

<div class="row">
    <div class="col-sm-4 col-md-4">
        <c1-pivot-panel items-source-id="dataEngine"></c1-pivot-panel>
    </div>
    <div class="col-sm-8 col-md-8">
        <c1-pivot-grid id="indexGrid" items-source-id="dataEngine"></c1-pivot-grid>
    </div>
</div>
<c1-pivot-chart id="@(optionsModel.ControlId)" items-source-id="dataEngine"></c1-pivot-chart>

@section Settings{
    @Html.Partial("_OptionsMenu", optionsModel)
}

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

<p>@Html.Raw(OlapRes.DataEngine_Text1)</p>

<p>@Html.Raw(OlapRes.DataEngine_Text2)</p>

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

}