PivotGauge

29 May 201924 minutes to read

The PivotGauge control is ideal for highlighting business critical Key Performance Indicator (KPI) information in executive dashboards and report cards. The PivotGauge let you present values against goals in a very intuitive manner.

Syntax

  • JAVASCRIPT
  • $(element).ejPivotGauge()

    Example

  • HTML
  • <div id="PivotGauge1"></div> 
        
        <script>
        //Create PivotGauge
        $("#PivotGauge1").ejPivotGauge(...);       
        </script>

    Requires

    • module:jQuery-3.0.0.min.js
    • module:ej.core.js
    • module:ej.data.js
    • module:ej.waitingpopup.js
    • module:ej.circulargauge.js
    • module:ej.pivot.common.js
    • module:ej.olap.base.js
    • module:ej.pivotanalysis.base.js
    • module:ej.pivotgauge.js

    Members

    columnsCount number

    Sets the number of columns to arrange the Pivot Gauges.

    Default Value: 0

    Example:

  • JAVASCRIPT
  • $("#PivotGauge1").ejPivotGauge({ columnsCount: 1 });

    cssClass string

    Specifies the CSS class to PivotGauge to achieve custom theme.

    Default Value: “”

    Example:

  • JAVASCRIPT
  • $("#PivotGauge1").ejPivotGauge({ cssClass : "gradient-lime" });

    customObject object

    Object utilized to pass additional information between client-end and service-end on operating in server mode.

    Default Value: {}

    Example:

  • JAVASCRIPT
  • $("#PivotGauge1").ejPivotGauge({ customObject: { "key": "Hello World" } });

    dataSource object

    Initializes the data source for the PivotGauge widget, when it functions completely on client-side.

    Default Value: {}

    Example:

  • JAVASCRIPT
  • $("#PivotGauge1").ejPivotGauge( { dataSource: { data: value } });

    dataSource.cube string

    Contains the respective cube name from OLAP database as string type.

    Default Value: “”

    Example:

  • JAVASCRIPT
  • $("#PivotGauge1").ejPivotGauge({ dataSource: { cube: "Adventure Works" } });

    dataSource.sourceInfo string

    To set the data source name to fetch data from that.

    Note: This is applicable only for Mondrian connection.

    Default Value: “”

    Example:

  • JAVASCRIPT
  • $("#PivotGauge1").ejPivotGauge({ dataSource: { sourceInfo: "Provider Mondrian" } });

    dataSource.providerName string

    Set the provider name for PivotGauge to identify whether the provider is SSAS or Mondrian.

    Note: This is applicable only for client side OLAP data.

    Default Value: “ssas”

    Name Description
    ssas To bind an OLAP data source to PivotGauge through SSAS provider.
    mondrian To bind a relational data source to PivotGauge through Mondrian provider.

    Example:

  • JAVASCRIPT
  • $("#PivotGauge1").ejPivotGauge({ dataSource: { providerName: "mondrian" } });

    dataSource.data object

    Provides the raw data source for the PivotGauge.

    Default Value: null

    Example:

  • JAVASCRIPT
  • $("#PivotGauge1").ejPivotGauge({ dataSource: { data: value } });

    dataSource.catalog string

    In connection with an OLAP database, this property contains the database name as string to fetch the data from the given connection string.

    Default Value: “”

    Example:

  • JAVASCRIPT
  • $("#PivotGauge1").ejPivotGauge( { dataSource: { catalog: "databaseName" } } );

    dataSource.columns array

    Lists out the items to bind in columns section.

    Default Value: []

    Example:

  • JAVASCRIPT
  • $("#PivotGauge1").ejPivotGauge({ dataSource: { columns: itemsArray } });

    dataSource.columns.fieldName string

    Allows the user to bind the item by using its unique name as field name.

    Default Value: “”

    Example:

  • JAVASCRIPT
  • $("#PivotGauge1").ejPivotGauge({ dataSource: { columns: [{ fieldName : "MyFieldName" }] } });

    dataSource.columns.filterItems object

    Applies filter to the field members.

    Default Value: null

    Example:

  • JAVASCRIPT
  • $("#PivotGauge1").ejPivotGauge({ dataSource: { columns: [{ fieldName: "Country", filterItems : { filterType: ej.PivotAnalysis.FilterType.Exclude, values: ["Canada", "France"] } }] } });

    dataSource.columns.filterItems.filterType enum

    Sets the type of filter whether to include/exclude the mentioned values.

    Note: This is applicable for Relational datasource only.

    Default Value: ej.PivotAnalysis.FilterType.Exclude

    Name Description
    Exclude Excludes the specified values among the members of the field.
    Include Includes the specified values alone among the members of the field.

    Example:

  • JAVASCRIPT
  • $("#PivotGauge1").ejPivotGauge({ dataSource: { columns: [{ fieldName: "Country", filterItems : { filterType: ej.PivotAnalysis.FilterType.Include, values: valueArray } }] } });

    dataSource.columns.filterItems.values array

    Contains the collection of items to be included/excluded among the field members.

    Default Value: []

    Example:

  • JAVASCRIPT
  • $("#PivotGauge1").ejPivotGauge({ dataSource: { columns: [{ fieldName: "Country", filterItems : { filterType: ej.PivotAnalysis.FilterType.Exclude, values: ["Canada", "France"] } }] } });

    dataSource.rows array

    Lists out the items to bind in rows section.

    Default Value: []

    Example:

  • JAVASCRIPT
  • $("#PivotGauge1").ejPivotGauge({ dataSource: { rows: itemsArray } });

    dataSource.rows.fieldName string

    Allows the user to bind the item by using its unique name as field name.

    Default Value: “”

    Example:

  • JAVASCRIPT
  • $("#PivotGauge1").ejPivotGauge({ dataSource: { rows: [{ fieldName : "MyFieldName" }] } });

    dataSource.rows.filterItems object

    Applies filter to the field members.

    Default Value: null

    Example:

  • JAVASCRIPT
  • $("#PivotGauge1").ejPivotGauge({ dataSource: { rows: [{ fieldName: "Country", filterItems : { filterType: ej.PivotAnalysis.FilterType.Exclude, values: ["Canada", "France"] } }] } });

    dataSource.rows.filterItems.filterType enum

    Sets the type of filter whether to include/exclude the mentioned values.

    Note: This is applicable for Relational datasource only.

    Default Value: ej.PivotAnalysis.FilterType.Exclude

    Name Description
    Exclude Excludes the specified values among the members of the field.
    Include Includes the specified values alone among the members of the field.

    Example:

  • JAVASCRIPT
  • $("#PivotGauge1").ejPivotGauge({ dataSource: { rows: [{ fieldName: "Country", filterItems : { filterType: ej.PivotAnalysis.FilterType.Include, values: valueArray } }] } });

    dataSource.rows.filterItems.values array

    Contains the collection of items to be included/excluded among the field members.

    Default Value: []

    Example:

  • JAVASCRIPT
  • $("#PivotGauge1").ejPivotGauge({ dataSource: { rows: [{ fieldName: "Country", filterItems : { filterType: ej.PivotAnalysis.FilterType.Exclude, values: ["Canada", "France"] } }] } });

    dataSource.values array

    Lists out the items supports calculation in PivotGauge.

    Default Value: []

    Example:

  • JAVASCRIPT
  • $("#PivotGauge1").ejPivotGauge({ dataSource: { values: itemsArray } });

    dataSource.values.fieldName string

    Allows the user to bind the item by using its unique name as field name for Relational datasource.

    Default Value: “”

    Example:

  • JAVASCRIPT
  • $("#PivotGauge1").ejPivotGauge({ dataSource: { values: [{ fieldName : "MyFieldName" }] } });

    dataSource.values.fieldCaption string

    Allows the user to set the display caption for an item for Relational datasource.

    Default Value: “”

    Example:

  • JAVASCRIPT
  • $("#PivotGauge1").ejPivotGauge({ dataSource: { values: [{ fieldCaption : "MyFieldCaption" }] } });

    dataSource.values.measures array

    This holds the list of unique names of measures to bind them from the OLAP cube.

    Default Value: []

    Example:

  • JAVASCRIPT
  • $("#PivotGauge1").ejPivotGauge({ dataSource: { values: [{ measures : itemsArray }] } });

    dataSource.values.measures.fieldName string

    Allows the user to bind the measure from OLAP datasource by using its unique name as field name.

    Default Value: “”

    Example:

  • JAVASCRIPT
  • $("#PivotGauge1").ejPivotGauge({ dataSource: { values: [{ measures : [{ fieldName: "MeasureUniqueName" }] }] } });

    dataSource.values.axis string

    Allows to set the axis name to place the measures items.

    Note: This is applicable for OLAP datasource only.

    Default Value: “rows”

    Example:

  • JAVASCRIPT
  • $("#PivotGauge1").ejPivotGauge({ dataSource: { values: [{ axis : ej.olap.AxisName.Row }] } });

    dataSource.values.isCalculatedField boolean

    Indicates whether the field is a calculated field or not with Relational datasource.

    Default Value: false

    Example:

  • JAVASCRIPT
  • $("#PivotGauge1").ejPivotGauge({ dataSource: { values: [{ isCalculatedField : true }] } });

    dataSource.values.formula string

    Allows to set the formula for calculation of values for calculated members in Relational datasource.

    Default Value: “”

    Example:

  • JAVASCRIPT
  • $("#PivotGauge1").ejPivotGauge({ dataSource: { values: [{ formula : "Quantity*10" }] } });

    dataSource.filters array

    Lists out the items which supports filtering of values without displaying the members in UI in PivotGauge.

    Default Value: []

    Example:

  • JAVASCRIPT
  • $("#PivotGauge1").ejPivotGauge({ dataSource: { filters: itemsArray } });

    dataSource.filters.fieldName string

    Allows the user to bind the item by using its unique name as field name.

    Default Value: “”

    Example:

  • JAVASCRIPT
  • $("#PivotGauge1").ejPivotGauge({ dataSource: { filters: [{ fieldName : "MyFieldName" }] } });

    dataSource.filters.filterItems object

    Applies filter to the field members.

    Default Value: null

    Example:

  • JAVASCRIPT
  • $("#PivotGauge1").ejPivotGauge({ dataSource: { filters: [{ fieldName: "Country", filterItems : { filterType: ej.PivotAnalysis.FilterType.Exclude, values: ["Canada", "France"] } }] } });

    dataSource.filters.filterItems.filterType enum

    Sets the type of filter whether to include/exclude the mentioned values.

    Note: This is applicable for Relational datasource only.

    Default Value: ej.PivotAnalysis.FilterType.Exclude

    Name Description
    Exclude Excludes the specified values among the members of the field.
    Include Includes the specified values alone among the members of the field.

    Example:

  • JAVASCRIPT
  • $("#PivotGauge1").ejPivotGauge({ dataSource: { filters: [{ fieldName: "Country", filterItems : { filterType: ej.PivotAnalysis.FilterType.Include, values: valueArray } }] } });

    dataSource.filters.filterItems.values array

    Contains the collection of items to be included/excluded among the field members.

    Default Value: []

    Example:

  • JAVASCRIPT
  • $("#PivotGauge1").ejPivotGauge({ dataSource: { filters: [{ fieldName: "Country", filterItems : { filterType: ej.PivotAnalysis.FilterType.Exclude, values: ["Canada", "France"] } }] } });

    enableAnimation boolean

    Enables/disables the animation of pointer in PivotGauge.

    Default Value: false

    Example:

  • JAVASCRIPT
  • $("#PivotGauge1").ejPivotGauge({ enableAnimation: true });

    enableTooltip boolean

    Enables/disables tooltip visibility in PivotGauge.

    Default Value: false

    Example:

  • JAVASCRIPT
  • $("#PivotGauge1").ejPivotGauge({ enableTooltip: true });

    enableRTL boolean

    Allows the user to view PivotGauge from right to left.

    Default Value: false

    Example:

  • JAVASCRIPT
  • $("#PivotGauge1").ejPivotGauge({ enableRTL: true });

    frame object

    Specify the frame details of PivotGauge here.

    Default Value

    • Object

    Example

  • JAVASCRIPT
  • $("#PivotGauge1").ejPivotGauge({ frame:{frameType:"halfcircle", halfCircleFrameStartAngle:180, halfCircleFrameEndAngle:360} });

    frame.frameType string

    Specifies the frame type of PivotGauge.

    Name Type Description
    FullCircle string Specify the full circle frame
    HalfCircle string Specify the half circle frame

    Default Value

    • “fullcircle”

    Example

  • JAVASCRIPT
  • $("#PivotGauge1").ejPivotGauge({  frame:{frameType : "halfcircle"} });

    frame.halfCircleFrameEndAngle number

    Specifies the end angle for the half circular frame.

    Default Value

    • 360

    Example

  • JAVASCRIPT
  • $("#PivotGauge1").ejPivotGauge({ frame:{frameType : "halfcircle",halfCircleFrameEndAngle: 270}});

    frame.halfCircleFrameStartAngle number

    Specifies the start angle for the half circular frame.

    Default Value

    • 180

    Example

  • JAVASCRIPT
  • $("#PivotGauge1").ejPivotGauge({ frame:{frameType : "halfcircle",halfCircleFrameStartAngle: 0} });

    isResponsive boolean

    Allows the user to enable PivotGauge’s responsiveness in the browser layout.

    Default Value: false

    Example:

  • JAVASCRIPT
  • $("#PivotGauge1").ejPivotGauge({ isResponsive: true });

    labelFormatSettings object

    Allows the user to change the format of the label values in PivotGauge.

    Default Value: null

    Example:

  • JAVASCRIPT
  • $("#PivotGauge1").ejPivotGauge({ labelFormatSettings: value  });

    labelFormatSettings.numberFormat enum

    Allows the user to change the number format of the label values in PivotGauge.

    Default Value: ej.PivotGauge.NumberFormat.Default

    Name Description
    Default To set default format for label values.
    Currency To set currency format for label values.
    Percentage To set percentage format for label values.
    Fraction To set fraction format for label values.
    Scientific To set scientific format for label values.
    Text To set text format for label values.
    Notation To set notation format for label values.

    Example:

  • JAVASCRIPT
  • $("#PivotGauge1").ejPivotGauge({ labelFormatSettings: { numberFormat: ej.PivotGauge.NumberFormat.Default } });

    labelFormatSettings.decimalPlaces number

    Allows you to set the number of digits displayed after decimal point.

    Default Value: 5

    Example:

  • JAVASCRIPT
  • $("#PivotGauge1").ejPivotGauge({ labelFormatSettings: { decimalPlaces: 3 } });

    labelFormatSettings.prefixText string

    Allows you to add a text at the beginning of the label.

    Default Value: “ “

    Example:

  • JAVASCRIPT
  • $("#PivotGauge1").ejPivotGauge({ labelFormatSettings: { prefixText: "prefixTextValue" } });

    labelFormatSettings.suffixText string

    Allows you to add text at the end of the label.

    Default Value: “ “

    Example:

  • JAVASCRIPT
  • $("#PivotGauge1").ejPivotGauge({ labelFormatSettings: { suffixText: "suffixTextValue" } });

    locale string

    Allows the user to set the localized language for the widget.

    Default Value: “en-US”

    Example:

  • JAVASCRIPT
  • $("#PivotGauge1").ejPivotGauge({ locale: "fr-FR" });

    rowsCount number

    Sets the number of rows to arrange the Pivot Gauges.

    Default Value: 0

    Example:

  • JAVASCRIPT
  • $("#PivotGauge1").ejPivotGauge({ rowsCount: 1 });

    scales object

    Sets the scale values such as pointers, indicators, etc… for PivotGauge.

    Default Value: {}

    Example:

  • JAVASCRIPT
  • $("#PivotGauge1").ejPivotGauge({ scales: { showRanges: true, showIndicators: true } });

    serviceMethodSettings object

    Allows the user to set the custom name for the methods at service-end, communicated during AJAX post.

    Note: This is applicable only for server mode operation.

    Default Value: {}

    Example:

  • JAVASCRIPT
  • $("#PivotGauge1").ejPivotGauge({ serviceMethodSettings: { initialize: "MyMethod" } });

    serviceMethodSettings.initialize string

    Allows the user to set the custom name for the service method responsible for initializing PivotGauge.

    Default Value: “InitializeGauge”

    Example:

  • JAVASCRIPT
  • $("#PivotGauge1").ejPivotGauge({ serviceMethodSettings: { initialize: "InitializeGaugeMyMethod" } });

    showHeaderLabel boolean

    Enables/disables the header labels in PivotGauge.

    Default Value: true

    Example:

  • JAVASCRIPT
  • $("#PivotGauge1").ejPivotGauge({ showHeaderLabel: false });

    url string

    Connects the service using the specified URL for any server updates on server mode operation.

    Default Value: “”

    Example:

  • JAVASCRIPT
  • $("#PivotGauge1").ejPivotGauge({ url: "/PivotGaugeService" });

    analysisMode enum

    Sets the mode for the PivotGauge widget for binding either OLAP or Relational data source.

    Default Value: ej.Pivot.AnalysisMode.Pivot

    Name Description
    Pivot To bind Relational datasource to PivotGauge widget
    OLAP To bind OLAP datasource to PivotGauge widget

    Example:

  • JAVASCRIPT
  • $("#PivotGauge1").ejPivotGauge({ analysisMode: ej.Pivot.AnalysisMode.Olap });

    operationalMode enum

    Sets the mode for the PivotGauge widget for binding data source either in server-side or client-side.

    Name Description
    ClientMode To bind data source completely from client-side.
    ServerMode To bind data source completely from server-side.

    Default Value: ej.Pivot.OperationalMode.ClientMode

    Example:

  • JAVASCRIPT
  • $("#PivotGauge1").ejPivotGauge({ operationalMode: ej.Pivot.OperationalMode.ServerMode });

    enableXHRCredentials boolean

    Allows you to enable “withCredentials” property inside XMLHttpRequest object for CORS(Cross-Origin Resource Sharing) request.

    Default Value: false

    Example:

  • JAVASCRIPT
  • $("#PivotGauge").ejPivotGauge({ enableXHRCredentials: true });

    Methods

    doAjaxPost()

    Performs an asynchronous HTTP (AJAX) request.

    Example:

  • JAVASCRIPT
  • var gaugeObj = $("#PivotGauge1").data("ejPivotGauge");
        gaugeObj.doAjaxPost("POST", "/PivotService/Initialize", { "key", "Hello World" }, "renderControlSuccess", null);

    refresh()

    This function is used to refresh the PivotGauge at client-side itself.

    Example:

  • JAVASCRIPT
  • var gaugeObj = $("#PivotGauge1").data("ejPivotGauge");
        gaugeObj.refresh();

    removeImg()

    This function removes the KPI related images from PivotGauge on binding OLAP datasource.

    Example:

  • JAVASCRIPT
  • var gaugeObj = $("#PivotGauge1").data("ejPivotGauge");
        gaugeObj.removeImg();

    renderControlFromJSON()

    This function receives the JSON formatted datasource and renders the PivotGauge control.

    Example:

  • JAVASCRIPT
  • var gaugeObj = $("#PivotGauge1").data("ejPivotGauge");
        gaugeObj.renderControlFromJSON(this.getJSONRecords());

    destroy()

    This function Destroy the PivotGauge widget all events bound using this._on will be unbind automatically and bring the control to pre-init state.

    Example:

  • JAVASCRIPT
  • var gaugeObj = $("#PivotGauge1").data("ejPivotGauge");
        gaugeObj.destroy();

    getOlapReport()

    Returns the OlapReport string maintained along with the axis elements information.

    Returns:

    string

    Note: This method is applicable only on operating the control in server mode.

    Example:

  • JAVASCRIPT
  • var gaugeObj = $("#PivotGauge1").data("ejPivotGauge");
        var report = gaugeObj.getOlapReport();

    setOlapReport()

    Sets the OlapReport string along with the axis information and maintains it in a property.

    Note: This method is applicable only on operating the control in server mode.

    Example:

  • JAVASCRIPT
  • var gaugeObj = $("#PivotGauge1").data("ejPivotGauge");
        gaugeObj.setOlapReport(olapReportObj);

    getJSONRecords()

    Returns the JSON records formed to render the control.

    Returns:

    array

    Example:

  • JAVASCRIPT
  • var gaugeObj = $("#PivotGauge1").data("ejPivotGauge");
        var jsonRecords = gaugeObj.getJSONRecords();

    setJSONRecords()

    Sets the JSON records to render the control.

    Example:

  • JAVASCRIPT
  • var gaugeObj = $("#PivotGauge1").data("ejPivotGauge");
        gaugeObj.setJSONRecords(jsonRecords);

    getJSONData()

    Returns the JSON records required to render the PivotGauge on performing any action with OLAP data source.

    Example:

  • JAVASCRIPT
  • var gaugeObj = $("#PivotGauge1").data("ejPivotGauge");
        var args = { action : "initialize", activeObject : gaugeObj };
        var jsonData = gaugeObj.getJSONData(args, dataSource);

    Events

    afterServiceInvoke

    Triggers when it reaches client-side after any AJAX request.

    Event Parameters
    Name Type Description
    customObject object returns the custom object bound with PivotGauge control.
    element object returns the HTML element of PivotGauge control.

    Example:

  • JAVASCRIPT
  • $("#PivotGauge1").ejPivotGauge({
            afterServiceInvoke: function (args) {}
        });

    beforeServiceInvoke

    Triggers before any AJAX request is passed from PivotGauge to service methods.

    Event Parameters
    Name Type Description
    customObject object returns the custom object bound with PivotGauge control.
    element object returns the HTML element of PivotGauge control.

    Example:

  • JAVASCRIPT
  • $("#PivotGauge1").ejPivotGauge({
            beforeServiceInvoke: function (args) {}
        });

    beforePivotEnginePopulate

    Triggers before populating the pivot engine on operating in client mode.

    Event Parameters
    Name Type Description
    gaugeObject object returns the current instance of PivotGauge control.

    Example:

  • JAVASCRIPT
  • $("#PivotGauge1").ejPivotGauge({
            beforePivotEnginePopulate: function (args) {}
        });

    load

    Triggers when PivotGauge started loading at client-side.

    Event Parameters
    Name Type Description
    action string returns the current action of PivotGauge control.
    model object returns the model of PivotGauge control.
    element object returns the HTML element of the widget.
    customObject object returns the custom object bound to the control.

    Example:

  • JAVASCRIPT
  • $("#PivotGauge1").ejPivotGauge({
            load: function (args) {}
        });

    renderComplete

    Triggers when PivotGauge widget completes all operations at client-side after any AJAX request.

    Event Parameters
    Name Type Description
    customObject object returns the custom object bound with PivotGauge control.
    element object returns the HTML element of PivotGauge control.

    Example:

  • JAVASCRIPT
  • $("#PivotGauge1").ejPivotGauge({
            renderComplete: function (args) {}
        });

    renderFailure

    Triggers when any error occurred during AJAX request.

    Event Parameters
    Name Type Description
    element object returns the HTML element of PivotGauge control.
    customObject object returns the custom object bound with the control.
    message string returns the error message with error code.

    Example:

  • JAVASCRIPT
  • $("#PivotGauge1").ejPivotGauge({
            renderFailure: function (args) {}
        });

    renderSuccess

    Triggers when PivotGauge successfully reaches client-side after any AJAX request.

    Event Parameters
    Name Type Description
    element object returns the HTML element of PivotGauge control.
    customObject object returns the custom object bound with the control.

    Example:

  • JAVASCRIPT
  • $("#PivotGauge1").ejPivotGauge({
            renderSuccess: function (args) {}
        });