Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SIP] Proposal for HTML rendering in summary cells #30986

Open
BaurArabov opened this issue Nov 20, 2024 · 0 comments
Open

[SIP] Proposal for HTML rendering in summary cells #30986

BaurArabov opened this issue Nov 20, 2024 · 0 comments
Labels
design:proposal Design proposals sip Superset Improvement Proposal

Comments

@BaurArabov
Copy link

[SIP] Proposal for HTML rendering

Motivation

In Apache Superset, the ability to provide visually appealing and informative summaries is crucial for effective data visualization. The current implementation does not support HTML rendering in summary cells, which limits the ability to convey complex visual information. For instance, when summarizing a column that consists of custom div elements for percentage representation, the output is rendered as plain text, losing the intended visual context.

Proposed Change

The proposed change involves modifying the rendering logic for summary cells to allow HTML content.

path: superset-frontend\plugins\plugin-chart-table\src\TableChart.tsx

<td style={sharedStyle}>
  <strong dangerouslySetInnerHTML={{ __html: formatColumnValue(column, totals[key])[1] }} />
</td>

image

This change enables the summary cell to render HTML directly, allowing for the inclusion of styled elements that visually represent data. For example, if a column contains a div structure representing a percentage filled with color, this modification will ensure that the summary displays not just the numerical value but also retains the visual cues associated with it.

New or Changed Public Interfaces

This SIP introduces a new behavior in how summary cells are rendered within tables in Superset. The key changes include:

  • HTML Rendering: Summary cells will now accept and render HTML content.
  • Custom Styling: Users can define custom styles within their data representations that will be preserved in summaries.

Result

Before:
image

After:
image

I recognize that there may be other approaches to achieve similar outcomes without modifying the core frontend code. If anyone has alternative methods or suggestions, please feel free to share your insights.

@BaurArabov BaurArabov added the sip Superset Improvement Proposal label Nov 20, 2024
@BaurArabov BaurArabov changed the title [SIP] Your Title Here (do not add SIP number) [SIP] Proposal for HTML rendering in summary cells Nov 20, 2024
@dosubot dosubot bot added the design:proposal Design proposals label Nov 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
design:proposal Design proposals sip Superset Improvement Proposal
Projects
None yet
Development

No branches or pull requests

1 participant