Skip to content

Customization Guide for Embedded Page Styles ​

After creating Dashboards and Charts using the HENGSHI SENSE platform, you can embed them into existing systems via iframes. To achieve a unified style, embedding iframes supports a variety of customization options.

img

Set the Embedded Page's Light or Dark Theme ​

The host page can specify the current embedded page's theme mode through the iframe's name attribute:

name parameterResult
theme=darkUse the dark theme.
theme=lightUse the light theme.
No theme parameter, or another valueFollow the HENGSHI system appearance settings. When those settings use “Follow system”, follow the end user's operating system color scheme.

For example, embed the entire HENGSHI platform with the dark theme:

html
<iframe
  name="topLevel=system,theme=dark"
  src="https://bi.example.com/home">
</iframe>

Put theme in the name attribute, separating it from other parameters with commas. Values are case-sensitive. Specify one theme mode per iframe. theme=dark and theme=light take precedence over system appearance settings and affect only the current iframe; they do not change HENGSHI system settings or other pages. The parameter does not apply to a page opened outside an iframe.

Set name when creating the iframe. To switch modes, recreate the iframe with the new name. Recreate it without theme to follow HENGSHI system appearance settings again. Changing only the loaded iframe element's name and refreshing may leave the child page reading the old window name.

Set the Embedded Page's Primary Color ​

Set primaryColor=#RRGGBB in the iframe's name to choose the primary color when the embedded page loads. For example, primaryColor=#7856E8 makes buttons, links, and other components that use the system primary color appear purple. Use a # followed by six hexadecimal digits. Letters can be uppercase or lowercase. If primaryColor is omitted or invalid, the page uses the HENGSHI system primary color.

html
<iframe
  name="topLevel=system,theme=dark,primaryColor=#7856E8"
  src="https://bi.example.com/home">
</iframe>

Specify one primaryColor per iframe. Use it on its own or separate it from parameters such as theme with commas. To switch colors, recreate the iframe with the new name. The theme parameters apply to the system interface in that iframe. Dashboards and charts use their own configured themes and palettes.

Customize the iframe of the Dashboard ​

Parameter List ​

The following parameters are supported when embedding a dashboard.

Parameter NameParameter FunctionParameter TypeParameter Value
copyrightThis parameter controls the display status of the dashboard header and footer.BooleanParameter values:
true: Display header and footer, default is true.
false: Do not display header and footer.
headerThis parameter controls the display status of the dashboard header.BooleanParameter values:
true: Display header, default is true.
false: Do not display header.
pagerThis parameter controls the display status of the dashboard pager.BooleanParameter values:
true: Display pager, default is true.
false: Do not display pager.
scrollableThis parameter controls the scrolling behavior within the dashboard.BooleanParameter values:
true: Supports scrolling within the dashboard, default is true.
false: Does not support scrolling within the dashboard.
chartAccessibleThis parameter controls the chart interaction behavior within the dashboard.BooleanParameter values:
true: Supports opening charts for interaction, default is true.
false: Does not support opening charts for interaction.
sidebarThis parameter controls the sidebar of the dashboard editor. It only applies to the dashboard editor page.BooleanParameter values:
true: Keeps the sidebar interactions, default is true.
false: Hides the dashboard editor sidebar and the chart settings panel: clicking a chart does not highlight or select it, does not open the sidebar, and does not navigate to the chart editor page.
interpretThis parameter controls the chart interpretation entry on the dashboard editor page. It only applies to the dashboard editor page.StringParameter values:
Absent or local: clicking "Interpret" opens the Data Agent inside the embedded page.
parent: clicking only posts a chart.interpret.request message to the parent page and does not open the internal conversation.
parentOriginThis parameter sets the parent page origin used as the target for interpret=parent messages.StringExample value: https://portal.example.com. Recommended; when omitted, the target is derived from a same-origin parent or document.referrer.
showRepublishThis parameter controls the "Republish" button in the dashboard editor top action bar.BooleanParameter values:
true: Show republish; clicking it republishes the app directly.
Absent or false: hidden. It only applies to the dashboard editor page. The button requires app administrator permission (`admin
backgroundThis parameter sets the background color of the dashboard. If the dashboard theme has already set a background color, this parameter will not take effect.StringParameter value format: rgba(255,255,255,1).
wrapperBackgroundThis parameter sets the background color of the parent div element of the dashboard, which can override the dashboard theme background color.StringParameter value format: rgba(255,255,255,1).
chartTitleColorThis parameter sets the color of chart titles within the dashboard. It applies to all chart titles within the dashboard (excluding filters). Use with caution.StringParameter value format: rgba(255,255,255,1).
chartGapThis parameter sets the spacing between charts within the dashboard.StringParameter value should include pixel information, e.g., 10px.

Common Embedding Questions ​

1. How do I show the embedded page in English or another language? ​

Append the locale parameter to the embed URL, for example:

  • ?locale=en-US
  • ?locale=zh-CN
  • ?locale=zh-TW

This is especially useful for multilingual portals, OEM scenarios, or any host system that needs the embedded page to follow the host language.

2. How do I trigger fullscreen from the host page? ​

In a standard iframe embedding scenario, call fullscreen directly from the host page:

js
const iframe = document.querySelector('iframe');
iframe.requestFullscreen();

This lets the customer's own page controls switch the embedded dashboard into fullscreen mode.

3. How do I refresh the dashboard externally without rebuilding the iframe? ​

If the host page keeps multiple iframes cached and you do not want to recreate them when switching back, trigger a dashboard refresh with postMessage:

js
const iframe = document.querySelector('iframe');
iframe.contentWindow.postMessage(
  JSON.stringify({
    event: 'dispatchCustomEvent',
    data: ['hs_dashboard_refresh', {}],
  }),
  '*',
);

For more events, see Embed Interaction Events.

4. What should I do if I hit cross-domain issues? ​

Use one of these recommended deployment patterns first:

  1. Deploy HENGSHI and the host system under the same main domain, using a sub-path or reverse proxy, for example https://example.com/bi.
  2. Deploy HENGSHI as a dedicated HTTPS domain such as https://bi.example.com, and configure the Base URL and reverse-proxy headers correctly.

For SSO or proxy scenarios, make sure headers such as X-Forwarded-Host and X-Forwarded-Proto are forwarded correctly. See Third-Party Software Configuration FAQs for related proxy guidance.

5. How do I hand dashboard chart interpretation to the host page? ​

By default, clicking "Interpret" on a chart opens the Data Agent inside the embedded page. To handle it yourself, append interpret=parent to the dashboard editor URL:

text
https://bi.example.com/app/251/dashboard/18?sidebar=false&header=false&pager=false&interpret=parent&parentOrigin=https%3A%2F%2Fportal.example.com

Use the dashboard editor route /app/{appId}/dashboard/{dashboardId}; /kanban/... is the chart analysis page and does not accept these parameters.

On click, the dashboard posts one message to the parent:

json
{
  "type": "hengshi:dashboard-embed",
  "version": "1.0",
  "event": "chart.interpret.request",
  "payload": {
    "appId": 251,
    "dashboardId": 18,
    "chartId": 42,
    "chartTitle": "Sales by region"
  }
}
js
window.addEventListener('message', (event) => {
  if (event.origin !== 'https://bi.example.com') return;
  if (event.data?.type !== 'hengshi:dashboard-embed'
      || event.data.version !== '1.0'
      || event.data.event !== 'chart.interpret.request') return;

  const { appId, dashboardId, chartId, chartTitle } = event.data.payload;
  // Render it yourself, or hand it to the complete UI SDK:
  agent.onCreateChat({
    prompt: `Interpret chart: ${chartTitle}`,
    dashboardContext: { appId, dashboardId, chartId, chartTitle, mode: 'edit' },
  });
});
  • The message is a one-way notification; no reply is expected.
  • Validate both event.origin and event.source (the dashboard iframe's contentWindow).
  • When parentOrigin is omitted, the target origin is derived from a same-origin parent or document.referrer. A strict Referrer-Policy: no-referrer on the host requires the explicit parameter; otherwise the dashboard falls back to its internal Data Agent.
  • The parameter changes only the entry behavior; data permissions are unchanged.

6. How do I put republishing into the embedding flow? ​

Append showRepublish=true to the dashboard editor URL. The top action bar then shows a "Republish" button. Clicking it calls POST /api/apps/{appId}/republish directly (no body; reuses the previous publish configuration) without a dialog. The publish hash stays stable, so embedded publish links keep working.

After publishing, the dashboard posts to the parent:

json
{
  "type": "hengshi:dashboard-embed",
  "version": "1.0",
  "event": "publish.result",
  "payload": {
    "success": true,
    "originAppId": 251,
    "publishedAppId": 252,
    "publishHash": "<stable-hash>",
    "dashboardId": 18,
    "url": "https://bi.example.com/publish/<stable-hash>"
  }
}

On failure success is false with error.code / error.message. The host refreshes or navigates the published iframe itself. The button only appears in edit mode; publish permission is still validated server-side.

The following are deprecated parameters in the dashboard embedding scenario.

Parameter NameParameter FunctionParameter TypeParameter ValueDeprecation Notes
paddingThis parameter sets the inner padding of the dashboard.String<number>Example value: 0 0 0 0This parameter is no longer supported.
chartBackgroundThis parameter sets the background color of chart controls.StringExample value: rgba(255,255,255,1)This parameter is no longer supported.
chartPaddingThis parameter sets the inner padding of charts.String<number>Example value: 0 0 0 0This parameter is no longer supported.
borderRadiusThis parameter sets the border radius of chart controls.StringExample value: 2pxFollows the dashboard theme settings.
borderWidthThis parameter sets the border width of charts.StringExample value: 1pxFollows the dashboard theme settings.
borderColorThis parameter sets the border color of charts.StringParameter value format: rgba(255,255,255,1)Follows the dashboard theme settings.
borderStyleThis parameter sets the border style of charts.StringOptions: solid, dashed, dottedFollows the dashboard theme settings.
filterPaddingThis parameter sets the inner padding of filters.String<number>Example value: 0 0 0 0This parameter is no longer supported.

Example ​

As shown in the dashboard below, the background color and chart title color are modified when embedding it.

Original dashboard link and style:

https://preview.hengshi.com/share/app/S5257D196AC363377BC2C3DF79FA26557/dashboard/45

img

Embedded dashboard link and style: https://preview.hengshi.com/private/share/E454FF2E910B7B9445C8F66391B25CCA/dashboard/EC0E826AB75FD2AA2C3D755CF8374DD6C?wrapperBackground=rgba(180,246,254,1)&chartTitleColor=rgb(0,0,0)&copyright=false&scrollable=false

img

Customize the Chart iframe ​

Parameter List ​

The following parameters are supported when embedding a chart.

Parameter NameParameter FunctionParameter TypeParameter Value
showActionThis parameter configures the interaction button in the top-right corner.BooleanParameter values:
true: Displays the interaction button in the top-right corner (default is true).
false: Hides the interaction button in the top-right corner.
chartPaddingThis parameter sets the chart's inner padding.String<number>Example parameter value: 0 0 0 0.

The following parameters are deprecated and no longer supported.

Parameter NameParameter FunctionParameter TypeParameter ValueDeprecation Notes
noFilterThis parameter controls whether to display filters.BooleanParameter values:
true: Displays filters (default is true).
false: Hides filters.
Filters are no longer supported when embedding charts.
titleColorThis parameter sets the chart title color.StringExample parameter value: rgba(255,255,255,1).Chart titles are no longer displayed when embedding pages.
chartBackgroundThis parameter sets the chart background color.StringExample parameter value: rgba(255,255,255,1).The chart background color will be overridden by the theme background color used by the chart.

User Manual for Hengshi Analysis Platform