> For the complete documentation index, see [llms.txt](https://docs.pentaho.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.pentaho.com/pdia-admin/customize-pentaho-products-cp/customize-pentaho-analyzer.md).

# Customize Pentaho Analyzer

For information on customization Pentaho Analyzer, see the following topics:

* [Properties file](#properties-file)
* [Set discrete axis for line, area, and scatter charts](#set-discrete-axis-for-line-area-and-scatter-charts)
* [Removing headers, filters, and actions for reports in dashboards](#removing-headers-filters-and-actions-for-reports-in-dashboards)
* [Control empty rows in reports](#control-empty-rows-in-reports)
* [Localization](#localization)
* [Assign Analyzer chart colors](#assign-analyzer-chart-colors)
* [Custom Analyzer action links to JavaScript functions](#custom-analyzer-action-links-to-javascript-functions)
* [PDF and Excel export customizations](#pdf-and-excel-export-customizations)

{% hint style="info" %}
**Note:** You can integrate third-party visualization into the Pentaho Analyzer. See the Visualization API calls in the PDF for Platform JavaScript API for details.
{% endhint %}

## Properties file

Giving Analyzer reports a configuration that fits your needs involves editing the `analyzer.properties` file. The following actions are examples some of the settings you can change:

* Enabling your logo to appear in PDF output.
* Specifying the placement of totals for columns and rows.
* Specifying the maximum number of rows when drilling-down in a report.
* Defining a specific value for blank cells.
* Changing the default chart options.

The complete list of properties that you can change are in the file comments, and you can find the file here: `server/pentaho-server/pentaho-solutions/system/analyzer/analyzer.properties`.

You can test your customizations to `analyzer.properties` in real time by refreshing the cache for the Analyzer report you are modifying using the **More actions and options** > **Administration** > **Clear Cache** menu action.

### Setting the default placement of column and row totals

Typically in Analyzer reports, the column totals are at the bottom and row totals are on the right. This is the default setting, but users can change it in Analyzer with the **Report Options** dialogue box by selecting **Totals on top/left**. If you prefer the default to be column totals at the top and row totals on the left, set the **report.options.totalsOnTopLeft** parameter to `true` in the `analyzer.properties` file.

### Collapse business group folders in the Available Fields list

By default, all the business group folders in the **Available Fields** list are expanded. You can change this setting to a collapsed view by editing the `analyzer.properties` file.

1. Stop the Pentaho Server.
2. Navigate to the `analyzer.properties` file, located at: `server/pentaho-server/pentaho-solutions/system/analyzer/analyzer.properties`.
3. Open the file with any text editor and locate the following lines in the file:

   ```
   # On opening the field list, collapse the business groups/folder
   # by default. Default: false
   Report.field.list.collapse=false
   ```
4. Change the **Report.field.list.collapse** value to `true` as follows:

   ```
   # On opening the field list, collapse the business groups/folder
   # by default. Default: false
   Report.field.list.collapse=true
   ```
5. Save and close the `analyzer.properties` file.
6. Restart the Pentaho Server.
7. Restart Analyzer.

   The list of available business group folders is collapsed, as shown in the example above.

See the **Install Pentaho Data Integration and Analytics** document for instructions on starting and stopping the Pentaho Server.

### Sort options in the Available Fields list

The **Available fields** list in Analyzer can be sorted using the **View** toggle with the following sorting options:

| UI Label                   | Description                                                           | Sort Option       |
| -------------------------- | --------------------------------------------------------------------- | ----------------- |
| **By Category**            | Sorts by folder names.                                                | `cmdViewCategory` |
| **Measure - Level - Time** | Sorts by the type of field.                                           | `cmdViewType`     |
| **A > Z**                  | Sorts by field names without any folders.                             | `cmdViewName`     |
| **Schema**                 | Sorts in the same order thant is defined in the Mondrian schema file. | `cmdViewSchema`   |

#### Default sort option priorities

The default sort used in an Analyzer report is based on the following priority:

1. A sort specified in an URL takes the highest priority.
2. The last sort option is automatically remembered when a report is reopened.
3. Next comes the annotation value specified on the report's cube in the Mondrian schema file.
4. A system wide setting in `analyzer.properties` file.
5. Last, the default value of **cmdViewCategory**.

#### Specify with an URL

The sort option can be set in the URL by adding a **fieldListView** query parameter at the end of the URL. For example, you can do something like this in a codeblock in HTML or XML.

{% code overflow="wrap" %}

```
http://localhost:8080/pentaho/api/repos/xanalyzer/editor?&amp;showFieldList=true&amp;showFieldLayout=true&amp;catalog=SampleData&amp;cube=Quadrant%20Analysis&amp;autoRefresh=true&amp;debug=true&amp;
```

{% endcode %}

#### Specify with annotation

To specify the sort option using an annotation, add a Cube-level annotation called **AnalyzerFieldListView** in your Mondrian schema file. This annotation must be the first child element under a cube as shown here.

{% code overflow="wrap" %}

```
<Cube name="Quadrant Analysis">
    <Annotations>
              <Annotation name="AnalyzerFieldListView">cmdViewName</Annotation>
    </Annotations>
    <Table name="Quadrant_Acuals" />
    <DimensionUsage name="Region" source="Region" />
    <DimensionUsage name="Department" source="Department" />
    <DimensionUsage name="Positions" source="Positions" />
```

{% endcode %}

#### Specify through the properties file

This sort option is specified by setting the `cmdViewType` for the **report.field.list.view** property.

{% code overflow="wrap" %}

```
# Default field list view mode used to sort the available field
# list in the editor.  Possible values include: cmdViewCategory,
# cmdViewType, cmdViewSchema and cmdViewName
# This can also be overriden on a cube level with the annotation
# AnalyzerFieldListView
report.field.list.view=cmdViewType
```

{% endcode %}

### Specify CSV separator for Analyzer reports

Specify the CSV separator used in Analyzer reports that are exported as CSV output.

Complete the following steps to specify the CSV separator.

1. Stop the Pentaho Server.

   For instructions on stopping and starting the Pentaho Server, see the **Install Pentaho Data Integration and Analytics** document.
2. Navigate to the `analyzer.properties` file, located at: `server/pentaho-server/pentaho-solutions/system/analyzer/analyzer.properties`.
3. Open the `analyzer.properties` file with a text editor and locate the following line:

   `report.output.csv.separator`
4. Change the **report.output.csv.separator** property value to the value that you want to use as a CSV separator.

   For example, to use a colon (:) as the CSV separator, update the property value to match the following example:

   `report.output.csv.separator = :`

   The default CSV separator value is a comma (,).
5. Save and close the `analyzer.properties` file.
6. Restart the Pentaho Server.
7. Restart Analyzer.

## Set discrete axis for line, area, and scatter charts

Line, Area, and Scatter charts in Analyzer and custom charts in VizAPI 3.0 provide Time and Number dimensions and associated hierarchic members on a continuous scale axis. However, if you prefer the Time and Number dimensions in Line and Area visualizations on a discrete axis, and to disable the Time and Number dimensions in Scatter visualizations, perform either or both of the following procedures to edit the global mapping configurations:

### Set time dimensions to discrete axes in Analyzer

1. Navigate to the `pentaho/server/pentaho-server/pentaho-solutions/system/karaf/config/web-client` system directory and open the `config.js` file with any text editor.
2. Locate the `Example Rule 9 - Disable hierarchical dates strategy` code block, as shown in this example:

   ```
   // Example Rule 9 - Disable the continuous date strategy, to revert
   // to the old behavior (Before 8.1) that represents Time dimensions in a discrete axis.
   /*
   {
     select: { module: "pentaho/visual/role/adaptation/EntityWithTimeIntervalKeyStrategy" },
     apply: { isBrowsable: false }
   },
   */ 
   ```
3. Remove the `/*` marker and the `*/` marker to uncomment the`EntityWithTimeIntervalKeyStrategy` command.
4. Save and close the file, then refresh the browser.

Your line and area visualizations will display Time dimensions on a discrete axis and the scatter visualization will not be able to provide Time dimensions.

### Set number dimensions to discrete axes in Analyzer

1. Navigate to the `pentaho/server/pentaho-server/pentaho-solutions/system/karaf/config/web-client` system directory and open the `config.js` file with any text editor.
2. Locate the `Example Rule 10 - Disable the continuous number strategy` code block, as shown in this example:

   ```
   // Example Rule 10 - Disable the continuous number strategy, to revert
   // to the old behavior (Before 8.2) that represents Number dimensions in a discrete axis.
   /*
   {
     select: { module: "pentaho/visual/role/adaptation/EntityWithNumberKeyStrategy" },
     apply: { isBrowsable: false }
   },
   */
   ```
3. Remove the `/*` marker and the `*/` marker to uncomment the `EntityWithNumberKeyStrategy` command.
4. Save and close the file, then refresh the browser.

Your line and area visualizations will display Number dimensions on a discrete axis and the scatter visualization will not be able to provide Number dimensions.

## Removing headers, filters, and actions for reports in dashboards

You can control the header, filters, and actions available to users viewing an Analyzer report displayed in a dashboard or a standalone report. Independent property settings allow you to disable selected interactive elements of the displayed report, while maintaining the drill-down and keep or exclude capabilities within its charts.

The following table identifies the elements available for controlling viewer access and information in a displayed Analyzer report.

| Item | Name               | Description                                                                                                            |
| ---- | ------------------ | ---------------------------------------------------------------------------------------------------------------------- |
| 1    | Header bar         | Contains the report title, **Filters** panel and **Actions** menu.                                                     |
| 2    | **Filters** panel  | Displays a filter count and contains a drop-down panel that lists the applied filters.                                 |
| 3    | **Actions** button | Contains a drop-down menu of available user actions, such as exporting the report and changing the visualization type. |
| 4    | Undo/Redo button   | Click to undo or redo a chart drill-down.                                                                              |

You can control Analyzer report elements at the global level using the `analyzer.properties` file, or at the individual dashboard or report level using Javascript APIs or URL parameters.

For global-level control of the header bar, filters, and actions, use the following settings in the `analyzer.properties` file in the `server/pentaho-server/pentaho-solutions/system/analyzer` directory.

| Property                                   | Description                                                                                                                                                                                                                                                                                                                                              |
| ------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **report.viewer.edit.disable**             | Disables all filter and field editing operations, such as removing a filter or field. The default value is false.                                                                                                                                                                                                                                        |
| **cv.api.ui.removeHeaderBar.viewer**       | Removes the **header** bar. The refresh indicator continues to appear when the report is refreshed. The default value is false.                                                                                                                                                                                                                          |
| **cv.api.ui.disableFilterPanel.viewer**    | Disables the **Filters** panel. The user will be unable to access the **Filters** drop-down panel and see the applied filters. For example, you may want to disable the **Filters** panel when the dashboard has used prompts to apply filters, so repeating the prompt filters in the **Filters** panel would be redundant. The default value is false. |
| **cv.api.ui.removeReportActions**          | Removes the **Actions** button, and access to the **Actions** menu. The default value is false.                                                                                                                                                                                                                                                          |
| **cv.api.ui.removeUndoButton.viewer=true** | Removes the **Undo** button for the report.                                                                                                                                                                                                                                                                                                              |
| **cv.api.ui.removeRedoButton.viewer=true** | Removes the **Redo** button for the report.                                                                                                                                                                                                                                                                                                              |

{% hint style="info" %}
**Note:** When you turn off these elements at the global level, setting the URL parameters to `true` does not return them.
{% endhint %}

For embedded Analyzer, you can remove the header bar, filters, actions, and undo/redo buttons from individual reports using the following Javascript user interface APIs:

* removeHeaderBar(removeFlag)
* removeReportActions(removeFlag)
* disableFilterPanel(removeFlag)
* removeUndoButton(removeFlag)
* removeRedoButton(removeFlag)

{% hint style="info" %}
**Note:** If you are using 3.0 Viz API, you can remove specific chart types from the **Actions** menu by editing the `pentaho-server/pentaho-solutions/system/karaf/config/web-client/config.js` file. If you are using 2.0 Viz API and earlier, see the article, "How to hide/disable certain chart types in the Analyzer UI" in the [Customer Support](https://support.pentaho.com/hc/en-us/articles/205790979-How-to-hide-disable-certain-chart-types-in-the-Analyzer-UI).
{% endhint %}

For Analyzer reports produced in a dashboard, you can apply the following URL parameters on the dashboard URL or an individual report URL to control the header bar, filters, and actions.

{% hint style="info" %}
**Note:** The following URL parameters are only effective when the settings have not been removed or disabled using the `analyzer.properties` file.
{% endhint %}

* **<http://localhost:8080/pentaho/api/repos/%3Apublic%3ASteel%20Wheels%3ASales%20Performance%20(dashboard).xdash/viewer?removeHeaderBar=true>**

  Removes the **header** bar, **Filters** panel, and **Actions** button.
* **<http://localhost:8080/pentaho/api/repos/%3Apublic%3ASteel%20Wheels%3ASales%20Performance%20(dashboard).xdash/viewer?removeReportActions=true>**

  Removes the **Actions** button and menu.
* **<http://localhost:8080/pentaho/api/repos/%3Apublic%3ASteel%20Wheels%3ASales%20Performance%20(dashboard).xdash/viewer?disableFilterPanel=true>**

  Disables the **Filters** panel and drop-down.
* **<http://localhost:8080/pentaho/api/repos/%3Apublic%3ASteel%20Wheels%3AWidget%20Library%3AAnalysis%20Views%3AGeomap.xanalyzer/viewer?frameless=true>**

  Removes the report title when the report is opened directly in a browser.

  **Note:** When Analyzer reports are used in Pentaho dashboards, the report titles are automatically hidden because Pentaho dashboard content items include their own titles. However, if you use an Analyzer report in your custom dashboard or as a standalone report, then setting this URL parameter may be useful.

## Control empty rows in reports

As an administrator, you can enable or disable the **Show empty rows** property at the Pentaho Server level. You can use this property to prevent a cross-join that is resource-intensive on the server. The values for the **Show empty rows** property are:

* **enable**

  All users have access (default).
* **Disable**

  No users have access.
* **adminOnly**

  Only admin users have access.

To control the report option, perform the following steps:

1. Navigate to the `pentaho-server/pentaho-solutions/system/analyzer/` directory and open the `analyzer.properties` file with any text editor.
2. Set the report options **showEmpty** property to **enable**.

   The **Show rows or columns with** drop-down menu displays in the **Report Options**dialog box, as shown in the following example:
3. Choose one of the following options:
   * **Measure Data.**
   * **Measure and Calculated Measure data**
   * **Show all even blank measures**
4. Restart the Pentaho Server.

## Localization

Perform the following steps to create localized message bundles for Pentaho Analyzer:

1. If the Pentaho Server is currently running, shut it down.
2. Make a copy of the `messages.properties` file in `pentaho-solutions/system/analyzer/resources/`.

   Name the copy according to the standard locale naming scheme defined earlier in this section.

   ```
   cp messages.properties messages_fr.properties
   ```
3. Translate the content of the new message bundle into the locale defined in its file name.
4. Edit the `messages_supported_languages.properties` file in `pentaho-solutions/system/analyzer/resources/` and add the new locale.

   ```
   fr=Francais
   ```

You now have a translated Analyzer message bundle for the Analyzer interface, not the OLAP data sources you use with Analyzer. For schema localization, refer to **Localization and internationalization of analysis schemas** in the **Pentaho Schema Workbench** document. To localize all web-based components on the Pentaho Server, refer to [Localize the Pentaho Server](broken://pages/nOzqk9dVnCG4EkWDpRj0).

## Assign Analyzer chart colors

Sometimes visualizations are more clear if you assign specific chart colors to data objects. For instance, you might want to assign colors to sales volume in different regions: red for the Northern region and blue for the Southern region. You can define colors like this using a member property in the Mondrian schema or using a text-based file inside the resources folder.

The color property works differently in various situations.

* **If a series contains one level and one measure,**

  then the color depends on the level member.
* **If a series contains multiple levels and one measure,**

  then the color depends on the level member that is farthest to the right.
* **If a series contains zero or more levels, or multiple measures,**

  then the color depends on the measure member. If there are multiple measures, each measure has a unique color.

If a member has a color mapping defined in both the text-based JSON file and in the Mondrian schema using the CHART\_SERIES\_COLOR property, the JSON file takes precedence over the CHART\_SERIES\_COLOR property.

### Assigning colors using a text-based file

You can create member-to-color mappings in a text-based JSON file if you do not want to define colors in the database or do not want to change the data structure. The file is located in `system/common-ui/resources/chartseriescolor/`. You must edit the `mdx.json` file to define color information for OLAP models such as Mondrian. Analyzer then uses this information to define colors. Define the color information using a web API such as [Json Parser Online](http://json.parser.online.fr/) to ensure you are using the correct JSON syntax.

When running a report, color mapping runs for all members in the report. If the JSON file has an invalid syntax, an error posts in the log file and no color information applies.

1. Using a JSON editor, open `pentaho-server\pentaho-solutions\system\common-ui\resources\chartseriescolor\mdx.json`.
2. Edit the sample so that the elements and colors are defined appropriately. The format is *\[Hierarchy Level].\[Member].\[Color]*. Specify color using hexadecimal or decimal values.

   In this example, the colors are set for the regions, which are `Central`, `Eastern`, `Southern`, and `Western`. The colors are then set for the measures, which are `Actual`, `Budget`, and `Variance`.

   <pre data-overflow="wrap"><code>"SampleData" : {
       "[Region].[Region]": {
           "[Region].[Central]": "#0000cc",
           "[Region].[Eastern]": "#0d8ecf",
           "[Region].[Southern]": "#b0de09",
           "[Region].[Western]": "#fcd202"
       },
        "[Measures].[MeasuresLevel]": {
            "[Measures].[Actual]": "#0000cc",
            "[Measures].[Budget]": "#0d8ecf",
            "[Measures].[Variance]": "#b0de09"        
         }
       }
   }
   </code></pre>
3. Save and close the JSON file.

### Assigning colors using a member property

You can change the colors of the members in an Analyzer report by defining a member property in the Mondrian schema. There are two different methods for assigning colors to levels or assigning colors to measures. The database column that stores color information is TERRITORY\_COLOR. This column is mapped to the CHART\_SERIES\_COLOR.

#### Assigning colors to levels

1. Find the level for which you want to specify colors.

   In this example, the level name is "Territory," coming from a column named TERRITORY.
2. Define the member property name as CHART\_SERIES\_COLOR, the mapping to the database column as TERRITORY\_COLOR, and the data type for the color values as Integer.

   <pre data-overflow="wrap"><code>&#x3C;Level name="Territory" column="TERRITORY" type="String" uniqueMembers="true" 
   levelType="Regular" hideMemberIf="Never"
   &#x3C;Property name="CHART_SERIES_COLOR" column="TERRITORY_COLOR" type=Integer>&#x3C;/Property>
   </code></pre>

#### Assigning colors to measures

1. Find the measure for which you want to specify colors.
2. Define the **CalculatedMemberProperty** name as `CHART_SERIES_COLOR`.
3. Assign the color value using either a hexidecimal or decimal value.

   <pre data-overflow="wrap"><code>Measure name="Quantity" column="QUANTITYORDERED" formatString="#,###" aggregator="sum"
   &#x3C;CalculatedMemberProperty name="CHART_SERIES_COLOR" value="13369344"/>
   &#x3C;/Measure>
   </code></pre>

## Custom Analyzer action links to JavaScript functions

Analyzer can be configured with custom action links that call out to JavaScript functions. These action links are available in a context menu by right-clicking on level members or measure cells.

### Define custom actions in Mondrian

Action links can be defined in your Mondrian schema as annotations. These can be defined under a Level or a Measure. There is no limit to the number of custom action links that you can define, but they need to be named in ascending order, such as `AnalyzerCustomAction`, `AnalyzerCustomAction2`, `AnalyzerCustomAction3`.

The annotation value is just a link-label and JavaScript function, separated by a comma. Analyzer will automatically try to add custom action links on a **Type** level or a **Sales** measure whenever they are used in a report.

Annotation defined on a **Type** level:

{% code overflow="wrap" %}

```
<Dimension foreignKey="STATUS" name="Order Status">
     <Hierarchy hasAll="true" allMemberName="All Status Types" primaryKey="STATUS">
        <Level name="Type" column="STATUS" type="String" uniqueMembers="true" levelType="Regular" hideMemberIf="Never">
                <Annotations>
                    <Annotation name="AnalyzerCustomAction">Custom action 3,customHandlerThree</Annotation>
                    <Annotation name="AnalyzerCustomAction2">Custom action 4,customHandlerFour</Annotation>
                </Annotations>
        </Level>
    </Hierarchy>
</Dimension>
```

{% endcode %}

Annotation defined on a **Sales** measure:

{% code overflow="wrap" %}

```
<Measure name="Sales" column="TOTALPRICE" formatString="#,###" aggregator="sum" description="Foo">
    <Annotations>
        <Annotation name="AnalyzerBusinessGroup">Measures</Annotation>
        <Annotation name="AnalyzerCustomAction">Custom action 1,customHandlerOne</Annotation>
        <Annotation name="AnalyzerCustomAction2">Custom action 2,customHandlerTwo</Annotation>    </Annotations>
    <CalculatedMemberProperty name="CHART_SERIES_COLOR" value="#0d8ecf" />
</Measure>
```

{% endcode %}

### Implement a custom action JavaScript function

In order to implement the JavaScript function, you need to create a new Pentaho plugin that injects your JavaScript functions into Analyzer. Here is an example of an `analyzer_extension_plugin.xml`:

{% code overflow="wrap" %}

```xml
<?xml version="1.0" encoding="UTF-8"?>
<plugin title="analyzer-extension">
   <static-paths>
        <static-path url="/analyzer-extension/resources" localFolder="resources"/>
   </static-paths>
   <external-resources>
         <file context="analyzer">content/analyzer-extension/resources/analyzer_extension_plugin.js</file>
   </external-resources>
</plugin>
```

{% endcode %}

This basically tells the Pentaho Server to inject the `analyzer_extension_plugin.js` file into Analyzer so that those functions are now available to Analyzer to call when a user clicks on a custom action link.

Here is an example `analyzer_extension_plugin.js`.

{% code overflow="wrap" %}

```javascript
cv.extension = cv.extension || {};

/** 
 * report - Analyzer report definition.
 * formula - The level or measure that was clicked on.
 * ctx - All levels that intersect on the clicked on level or cell.
 * filter - Filters applied on the report. Only includes filters which includes members.
 */
 
cv.extension.customHandlerOne = function (report, formula, ctx, filter) {
    var year = ctx['[Time].[Years]']; // Returns the member unique name
    if (year) 
        year = cv.util.parseMDXExpression(year); // Extract the name of the member
    var url = window.CONTEXT_PATH + "api/repos/:public:Steel%20Wheels:Country%20Performance%20(heat%20grid).xanalyzer/viewer?yearParameter=" + year;
    if (window.parent && window.parent.parent && window.parent.parent.mantle_openTab) {
        window.parent.parent.mantle_openTab("Custom One", "Custom One", url);
    }
    window.open(url);
}

cv.extension.customHandlerOne_validate = function (report, formula, ctx, filter) {
    var territory = ctx['[Markets].[Territory]'];
    if (territory == "[Markets].[Japan]")
        return false;
    return true;
}    
```

{% endcode %}

You must define your custom action JavaScript function under the `cv.extension` namespace. The name of the JavaScript function must exactly match the name you used in the *AnalyzerCustomAction* annotation. The function takes four parameters:

* **report**

  This is the Analyzer report object. You normally will not use this, but if you want to access the report XML definition to inspect the state of the current report definition, you can access `report.reportDoc`.
* **formula**

  This is either the level MDX unique name or the measure unique name, depending on what the user clicked on.
* **ctx**

  This is a map of all the levels on the row or column zone and their corresponding MDX members. When clicking on a cell, this map will contain all row and column levels on the report. When clicking on a level member, this map will only contain outer levels which are usually to the left or above the clicked-on level.
* **filter**

  This is a level map-to-filter operator-to-member array of all report filters with the exception of numeric filters like `Top10` or `Greater than`.

The **filter** object is a map of levels to predicate objects. A predicate object is a map of predicate operators to operator arguments. A single level such as *\[Customer].\[Name]* may have more than one predicate operator, such as contains `John` but does not contain `Doe`.

The possible operators are: EQUALS, NOT\_EQUAL, BEFORE, AFTER, BETWEEN, CONTAIN, and NOT\_CONTAIN. For all operators with the exception of CONTAIN and NOT\_CONTAIN, the operator arguments are MDX members such as `[Time].[2014]`. CONTAIN and NOT\_CONTAIN have string literals as operator arguments. Numeric filters such as **Top 10 Account by Sales** are not exposed in the filter object.

As an example, assuming the user clicks on this cell:

Then the **member**, **ctx**, and **filter** arguments will look like:

{% code overflow="wrap" %}

```javascript
ctx: Object
     [Markets].[Territory]: "[Markets].[APAC]"
     [Measures].[MeasuresLevels]: "[Measures].[Sales]"
     [Order Status].[Type]: "[Order Status].[Shipped]"
     [Time].[Years]: "[Time].[2003]"
     __proto__: Object
filter: Object
    {
    '[Product].[Line]':
    {EQUALS:['[Product].[Trucks and Buses]','[Product].[Trains]','[Product].[Planes]']}
    ,
    '[Time].[Years]':
    {EQUALS: ['[Time].[2013]','[Time].[2014]']}

    }
formula: "[Measures].[Sales]"
```

{% endcode %}

Here are a couple of helpful tips for implementing the JavaScript functions:

* You can use `cv.util.parseMDXExpression` to extract the name of the member. For example, `[Year].[2003]` would return: `2003`.
* You can construct your own URL and then open the URL in a new **PUC** tab, assuming Analyzer is running within PUC with the function: `window.parent.parent.mantle_openTab`.

### Determine when to show a custom action

There is also another feature to validate whether a custom action link should be included in the context menu or not. You can implement a validation function which returns false to hide the link in the UI. If this validation function is not implemented, then the link will always be shown. This validation function must be named by suffixing the custom action JavaScript function name with `_validate`.

In this example, the **Custom action 1** menu item will not be included if the user right-clicks on a **Measure** cell where the current context includes `Territory: Japan`:

```javascript
cv.extension.customHandlerOne_validate = function (report, formula, ctx, filter) {
var territory = ctx['[Markets].[Territory]'];
if (territory == "[Markets].[Japan]")
return false;
return true;
}
```

Notice how **Custom action 1** was not included in the above menu.

## PDF and Excel export customizations

Analyzer allows you to customize the appearance and content of your PDF and Excel outputs.

The complete list of properties that you can change are in the file comments. You can find the file here at `server/pentaho-server/pentaho-solutions/system/analyzer/analyzer.properties`.

You can test your customizations to `analyzer.properties` in real time by refreshing the cache for the Analyzer report you are modifying using the **More actions and options** > **Administration** > **Clear Cache** menu action.

You can customize the appearance of your company's PDF and Excel exports from Analyzer in a number of ways. For example, Analyzer PDF exports can be personalized with a company logo and a cover page, and you can change the default font used to generate PDFs.

### Customizing the PDF cover page

You can customize the PDF cover page with the following `analyzer.properties`.

| Property                     | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| ---------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **renderer.pdf.cover.hide**  | Generates the PDF export without a cover page. (Default value: `false`)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| **renderer.pdf.cover.image** | <p>Generates the PDF export with a custom cover image. The gray boxes in the title background of the report’s cover page can be hidden by setting <strong>renderer.pdf.cover.hideTitleBackground</strong><code>=true</code>. When the background is hidden, the title font color is black instead of white.</p><p>The cover image is anchored in the bottom left corner of the page. The image is not scaled based on the export page size. Specify the file name of the image and type, no path, and place the image file in the <code>/pentaho-solutions/system/analyzer/resources</code> directory.</p><p>If you want to design a cover page with a specific page size and image orientation, then you can override the default <strong>renderer.pdf.cover.image</strong>. For each page size and orientation (see below), the provided image width and height completely fill the cover page. When setting the property to use for the size and orientation, you should replace the “width x height” value in the property with the file name and type of the image, for example <strong>renderer.pdf.cover.image.letter.landscape</strong><code>= my\_favorite\_image.jpg</code>.</p><ul><li><strong>renderer.pdf.cover.image.letter.landscape=792x612</strong></li><li><strong>renderer.pdf.cover.image.letter.portrait=612x792</strong></li><li><strong>renderer.pdf.cover.image.legal.landscape=1008x612</strong></li><li><strong>renderer.pdf.cover.image.legal.portrait=612x1008</strong></li><li><strong>renderer.pdf.cover.image.note.landscape=720x540</strong></li><li><strong>renderer.pdf.cover.image.note.portrait=540x720</strong></li><li><strong>renderer.pdf.cover.image.tabloid.landscape=1224x792</strong></li><li><strong>renderer.pdf.cover.image.tabloid.portrait=792x1224</strong></li><li><strong>renderer.pdf.cover.image.ledger.landscape=792x1224</strong></li><li><strong>renderer.pdf.cover.image.ledger.portrait=1224x792</strong></li><li><strong>renderer.pdf.cover.image.postcard.landscape=416x283</strong></li><li><strong>renderer.pdf.cover.image.postcard.portrait=283x416</strong></li><li><strong>renderer.pdf.cover.image.executive.landscape=756x283</strong></li><li><strong>renderer.pdf.cover.image.executive.portrait=522x756</strong></li><li><strong>renderer.pdf.cover.image.a3.landscape=1191x842</strong></li><li><strong>renderer.pdf.cover.image.a3.portrait=842x1191</strong></li><li><strong>renderer.pdf.cover.image.a4.landscape=842x595</strong></li><li><strong>renderer.pdf.cover.image.a4.portrait=595x842</strong></li><li><strong>renderer.pdf.cover.image.a5.landscape=595x420</strong></li><li><strong>renderer.pdf.cover.image.a5.portrait=420x595</strong></li><li><strong>renderer.pdf.cover.image.b4.landscape=1000x708</strong></li><li><strong>renderer.pdf.cover.image.b4.portrait=708x1000</strong></li><li><strong>renderer.pdf.cover.image.b5.landscape=708x498</strong></li><li><strong>renderer.pdf.cover.image.b5.portrait=498x708</strong></li></ul> |

### Customizing the PDF logo

You can customize the PDF logo with the following `analyzer.properties`.

| Property                            | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| ----------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **renderer.logo.image**             | <p>Adds a custom logo image to a PDF export. The logo image is placed on the bottom left corner of every page. This image should have no padding and a white background. If the PDF includes a cover page, the logo is placed bottom center on that page. You need to specify the image file name and type, no path, and place the image file in the <code>/pentaho-solutions/system/analyzer/resources/</code> directory.If you want to set a logo image specific to a page size, then you can override the <strong>default renderer.logo.image</strong> property with the desired size value:</p><ul><li><strong>renderer.logo.image.letter</strong></li><li><strong>renderer.logo.image.legal</strong></li><li><strong>renderer.logo.image.note</strong></li><li><strong>renderer.logo.image.tabloid</strong></li><li><strong>renderer.logo.image.ledger</strong></li><li><strong>renderer.logo.image.postcard</strong></li><li><strong>renderer.logo.image.executive</strong></li><li><strong>renderer.logo.image.a3</strong></li><li><strong>renderer.logo.image.a4</strong></li><li><strong>renderer.logo.image.a5</strong></li><li><strong>renderer.logo.image.b4</strong></li><li><strong>renderer.logo.image.b5</strong></li></ul> |
| **renderer.logo.image.hideOnCover** | Hides the logo on the cover page when set to `true`. Useful when the cover page already includes a custom background image. (Default value: `false`)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |

### Set default fonts for PDF export

When displaying data in Analyzer, your reports will use the default browser fonts. However, the PDF export function may not have the same fonts available to it when creating a PDF from your Analyzer report, resulting in output that doesn't look the same way in PDF format as it does in the browser. The default font for PDFs is Helvetica, but you can specify any TrueType font or collection to replace it. Follow the instructions below to specify a different font for PDF exports.

**Note:** If you have localized your schema in a language that uses a multi-byte character set (most Asian languages fit into this category), this process is required to make PDF output appear without errors.

1. Stop the Pentaho User Console and Pentaho Server.
2. Navigate to the `pentaho/server/pentaho-server/pentaho-solutions/system/analyzer/` directory and open the `analyzer.properties` file with any text editor.
3. Uncomment the **renderer.pdf.font.path** line.

   ```
   renderer.pdf.font.path=C:/WINDOWS/Fonts/MSGOTHIC.TTC,1
   ```
4. Replace the value of this line with the `TrueType` font or collection that you want to use as the default. If you are specifying a collection, you must put a `,1` after the font name, as shown in the above example. This does not apply to individual fonts (TTF files).

   ```
   renderer.pdf.font.path=/usr/share/fonts/truetype/freefont/FreeSans.ttf
   ```
5. Save and close the file and restart the Pentaho Server.

Your PDF exports from Analyzer should have the font you specified.

### Removing report attributes

PDF and Excel exports from Analyzer, by default, include information such as the report creator, report name, folder location, filters used, and fields used. As shown in the table below, you can exclude some or all of this information from an export by setting the value of its property to `true` in `analyzer.properties`.

| Property                                   | Description                                                        |
| ------------------------------------------ | ------------------------------------------------------------------ |
| **renderer.metadata.hide.aboutThisReport** | Removes the “About this report” section. (Default value = `false`) |
| **renderer.metadata.hide.filterSummary**   | Removes the “Filter summary” section. (Default value = `false`)    |
| **renderer.metadata.hide.fieldsUsed**      | Removes the “Fields used” section. (Default value = `false`)       |

You can retain the "About This Report" section and customize the items it contains by setting the value for the associated property, as described in the following table.

| Property                                               | Description                                                       |
| ------------------------------------------------------ | ----------------------------------------------------------------- |
| **renderer.metadata.hide.aboutThisReport.name**\`\`    | Removes the “report name” field. (Default value = `false`)        |
| **renderer.metadata.hide.aboutThisReport.description** | Removes the “report description” field. (Default value = `false`) |
| **renderer.metadata.hide.aboutThisReport.creator**     | Removes the “report creator” field. (Default value = `false`)     |
| **renderer.metadata.hide.aboutThisReport.location**    | Removes the “report location” field. (Default value = `false`)    |
| **renderer.metadata.hide.aboutThisReport.createdOn**   | Removes the “creation date” field. (Default value = `false`)      |
| **renderer.metadata.hide.aboutThisReport.cube**        | Removes the “cube annotation” field. (Default value = `false`)    |

### Removing a data table and report worksheet

PDF and Excel exports of an Analyzer chart report, by default, also include a data table and report worksheet. You can exclude the data table and / or the report worksheet from PDF and Excel exports of a chart report by setting the value of the associated property to `true`, as described in the following table.

| Property                          | Description                                                                                                   |
| --------------------------------- | ------------------------------------------------------------------------------------------------------------- |
| **renderer.pdf.dataTable.hide**   | Excludes the data table from a chart report exported to PDF. (Default value = `false`)                        |
| **renderer.excel.dataTable.hide** | Excludes the data table and report worksheet from a chart report exported to Excel. (Default value = `false`) |

### Creating custom headers and footers

Headers and footers can be customized to include static text such as disclaimers and copyright information, or dynamic text such as the current user and date. These header and footer templates, defined in Analyzer's resource message files, can be localized into different languages. Analyzer's resource message files are in the `pentaho-solutions/system/analyzer/resources` directory. The base resources file is `messages.properties`. The table below describes each message file.

{% hint style="info" %}
**Note:** For testing custom headers and footers, you can set `localizationService.cache.resource.bundle=false` in the `analyzer.properties` file for immediate pickup by Analyzer of changes to the `message*.properties` files. For performance reasons, this setting should only be performed in development environments.
{% endhint %}

| Message file                    | Description                                                                                                       |
| ------------------------------- | ----------------------------------------------------------------------------------------------------------------- |
| **RendererPDFHeaderTemplate**   | Header template that appears in top-left corner of a PDF. (Default value = `%report`)                             |
| **RendererPDFFooterTemplate**   | Footer template that appears in bottom-right corner of a PDF. (Default value = `Page %pageCurrent of %pageTotal`) |
| **RendererExcelHeaderTemplate** | Header template that appears on the first line of each Excel worksheet.                                           |
| **RendererExcelFooterTemplate** | Footer template that appears after the content on each Excel worksheet.                                           |

When a PDF and Excel export is generated, the tokens described in the table below are replaced in the template text.

| Token          | Description                               |
| -------------- | ----------------------------------------- |
| `%report`      | Current report name.                      |
| `%user`        | Username of session exporting the report. |
| `%date`        | Date and time when report was exported.   |
| `%pageCurrent` | Current page number (PDF only).           |
| `%pageTotal`   | Total page number (PDF only).             |

### Theming a pivot table

If you modify the system theme or add a new theme that changes the styles on the HTML pivot table, the PDF and Excel pivot tables can inherit the same background and font colors. To enable this feature, `renderer.dataTable.inheritTheme` must be set to `true` in `analyzer.properties`.

The following pivot table items can be themed in PDF and Excel exports.

When generating the PDF or Excel export, the following CSS rule sets are used by the theme-specific CSS file to customize the pivot table.

| Number                                                                                                                       | Pivot table item              | CSS selector                                                     | CSS declarations A                  | Example                                                |
| ---------------------------------------------------------------------------------------------------------------------------- | ----------------------------- | ---------------------------------------------------------------- | ----------------------------------- | ------------------------------------------------------ |
| 1                                                                                                                            | Level headers                 | <p>.pivotTable</p><p>.columnHeaders</p><p>.columnheading</p>     | <p>background-color</p><p>color</p> | <p>Education Level</p><p>Name</p><p>Product Family</p> |
| 2                                                                                                                            | Level member property headers | <p>.pivotTable</p><p>.columnHeaders</p><p>.columnPropHeading</p> | <p>background-color</p><p>color</p> | Yearly Income                                          |
| 3                                                                                                                            | Measure headers               | <p>.pivotTable</p><p>.columnHeaders</p><p>.metric</p>            | <p>background-color</p><p>color</p> | Unit Sales                                             |
| 4                                                                                                                            | Level members                 | <p>.pivotTable</p><p>.columnHeaders</p><p>.member</p>            | background-color                    | <p>Graduate Degree</p><p>Food</p><p>1997</p>           |
| 5                                                                                                                            | Total members and cells       | <p>.pivotTable</p><p>.cells</p><p>.colSubTotal</p>               | background-color                    | Cells under Graduate Degree Total and Food Total       |
| 6                                                                                                                            | Grand total cells             | <p>.pivotTable</p><p>.cells</p><p>.colGrandTotal</p>             | background-color                    | Cells under Grand Total                                |
| A CSS declarations for background-color and color must be specified using hex notation, such as `#FF0000` for the color red. |                               |                                                                  |                                     |                                                        |

The example below shows a pivot table that was themed by modifying the ruby theme in the \`pentaho-solutions/system/analyzer/styles/themes/ruby/anaRuby.css\` file.

If you are customizing the HTML pivot table, use the following reference which lists the corresponding CSS selectors for each pivot table item. Many of these items also support `:hover` selection style changes. The CSS rule sets used to style the PDF and Excel pivot tables are a subset of the CSS selectors listed below.

{% hint style="info" %}
**Note:** When styling the HTML pivot table, static resources such as CSS files are cached in the Pentaho Server. You can temporarily disable this caching by setting `<cache>` to `false` in the `pentaho-solutions\system\analyzer\settings.xml` file.
{% endhint %}

| Number | Pivot table item              | CSS selectors                                                                                                                                                                                                         |
| ------ | ----------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| 1      | Level headers                 | <p>.pivotTable</p><p>.columnHeaders</p><p>.columnheading</p><p>.pivotTable</p><p>.rowLabelHeaders TD</p>                                                                                                              |
| 2      | Level member property headers | <p>.pivotTable</p><p>.columnHeaders</p><p>.columnPropHeading</p><p>.pivotTable</p><p>.rowLabelHeaders</p><p>.rowPropHeader</p>                                                                                        |
| 3      | Measure headers               | <p>.pivotTable</p><p>.columnHeaders</p><p>.metric</p>                                                                                                                                                                 |
| 4      | Level members                 | <p>.pivotTable</p><p>.columnHeaders</p><p>.member</p><p>.pivotTable</p><p>.rowHeaders</p><p>.inner</p><p>.pivotTable</p><p>.rowHeaders</p><p>.outer</p>                                                               |
| 5      | Total members and cells       | <p>.pivotTable</p><p>.columnHeaders</p><p>.memberSubTotal</p><p>.pivotTable</p><p>.rowHeaders</p><p>.subTotal</p><p>.pivotTable</p><p>.cells</p><p>.colSubTotal</p><p>.pivotTable</p><p>.cells</p><p>.rowSubTotal</p> |
| 6      | Grand total cells             | <p>.pivotTable</p><p>.cells</p><p>.colGrandTotal</p>                                                                                                                                                                  |

#### Set pivot table minimum font size

When rendering the pivot table for PDF export, Analyzer attempts to fit the complete width of the table onto a single page using a size 9 font. If the table cannot fit the page using the size 9 font, then progressively smaller font sizes fonts are automatically attempted, down to a lower default limit of 3. To set a higher minimum font size and avoid the need to use PDF zoom functions to read the table, you can override this property.

1. Navigate to the `pentaho/server/pentaho-server/pentaho-solutions/system/analyzer/` directory and open the `analyzer.properties` file with any text editor.
2. Locate **renderer.pdf.font.table.min**.

   `renderer.pdf.font.table.minSize=3`
3. Replace the value with the smallest font size that you want used for exported pivot tables.
4. Save and close the file.
5. Test your changes by refreshing the cache or by restarting the Pentaho Server.

Your pivot tables exported to PDF from Analyzer will use text with the minimum font size.

### Customize the logo on Excel exports

You can add a custom logo to your Excel exports from Analyzer. The image is placed after the content on each worksheet.

To add a custom logo, follow the steps below.

1. Navigate to the `pentaho/server/pentaho-server/pentaho-solutions/system/analyzer/` directory and open the `analyzer.properties` file with any text editor.
2. Locate **renderer.excel.logo.image**

   `renderer.excel.logo.image=`
3. Specify the image file name and type, with no path.

   For example, `my_favorite_logo.jpg`
4. Place the image file in the `/pentaho-solutions/system/analyzer/resources/` directory.
5. Save and close the file.
6. Test your changes by refreshing the cache or by restarting the Pentaho Server.

Your Excel exports from Analyzer will now contain the logo.

### Customize the font on Excel exports

You can set the font used for your Excel exports from Analyzer.

To change the font, follow the steps below.

{% hint style="info" %}
**Note:** The font used with Excel reports must be accessible by the Java virtual machine or operating system.
{% endhint %}

1. Navigate to the `pentaho/server/pentaho-server/pentaho-solutions/system/analyzer/` directory and open the `analyzer.properties` file with any text editor.
2. Locate **renderer.excel.font.name**.

   `renderer.excel.font.name=Verdana`
3. Specify the name of the font.

   (Default `= Verdana`
4. Save and close the file.
5. Test your changes by refreshing the cache or by restarting the Pentaho Server.

Your Excel exports from Analyzer will now use the font.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.pentaho.com/pdia-admin/customize-pentaho-products-cp/customize-pentaho-analyzer.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
