Object properties for setting visibility, position, and color palette of a legend.
Configuring visualization overrides
The Visual Embed SDK allows you to apply visual styling overrides programmatically to the charts and tables generated from Search data queries in an embedded app.
Overviewπ
The visualization overrides feature allows developers to pre-define the chart and table settings for their embedding application users and apply these overrides at load time. This eliminates the need for embedding application users to manually adjust charts and tables in the edit mode.
Using the visualOverrides object, embed application developers can preset the following properties in the new answers retrieved from a search data query:
-
Chart properties, such as the legend position, data labels, axis ranges, column colors, conditional formatting, and grid lines
-
Table properties, including column visibility, text wrap, content density, and summary configuration
Configuring visual overridesπ
The visualOverrides object in the VisualizationOverrides interface lets you apply styling overrides to charts and tables generated in the embedded ThoughtSpot Search interface. These overrides can be categorized as:
-
Visualization-level overrides that affect settings such as legend visibility, data labels, axis ranges, colors, gridlines, and conditional formatting on a chart.
-
Column-level overrides applied such as number formatting, headline visibility, and sort order in a table.
Within visualOverrides, the chart and table settings can be applied in the chart and table objects.
Chart override settingsπ
For chart overrides, use the top-level chart object and configure the following properties as needed:
| Property | Description |
|---|---|
| |
| Boolean. Shows or hides the chart legend. |
| String. Position of the legend relative to the chart. Valid values include:
|
| Custom color palette properties for the legend. Overrides the default color sequence applied by ThoughtSpot. To customize color, specify the hex code in the |
| Data label visibility settings, including per-column label filters. |
| |
| |
| |
For
| |
| Object for chart display settings. |
| |
| |
| |
| Per-axis configurations. Each entry controls one axis group, identified by its linked columns. |
| |
| |
| |
| |
| Per-column overrides: series color and conditional formatting rules. Include the following attributes: |
| |
| |
| |
| Array of strings. Field mask for partial updates. Specifies which fields to apply when updating an existing visualization. Pass an empty array |
Table overridesπ
If the answers are in the table format, use the table object and define the following attributes:
Property | Description |
| Per-column overrides: visibility, text wrapping, and conditional formatting. |
| |
| |
|
|
Conditional formatting overridesπ
The conditional formatting properties can be configured in both chart and table override settings in the columns object.
Property | Description |
| Conditional formatting rules applied to data points in this column. Specify the following properties as needed. To apply conditional formatting, set an array of rules in the |
| |
| |
| |
| |
| |
| |
| |
Code sampleπ
The following example shows the chart and table override settings for the new Answers generated from the embedded Search interface:
import {
init, // Core SDK initialization function.
AuthType, // for authentication type selection.
SearchEmbed, // Embeds the ThoughtSpot Search page into a host application.
ConditionalFormattingOperator, // Enum for conditional formatting comparison operators.
DataLabelFilterOperator, // Enum for data label filter operators.
ConditionalFormattingComparisonType, // Enum for conditional formatting comparison.
BackgroundFormatType, // Enum for the background fill type in conditional formatting rules.
TableTheme, // Enum for the visual theme of embedded tables.
TableContentDensity, // Enum for the row height and padding density of embedded tables.
LegendPosition, // Enum for the position of the chart legend.
} from "@thoughtspot/visual-embed-sdk";
init({
thoughtSpotHost: '<ThoughtSpot Host>', // Replace with your application URL
authType: AuthType.None,
});
const embed = new SearchEmbed('#tsEmbed', {
frameParams: {
width: '100%',
height: '100%',
},
dataSource: "<data-source-id>", // Replace with your application URL
visualOverrides: {
chart: {
// Show or hide the chart legend, and set its position.
legend: {
show: true,
position: LegendPosition.Bottom,
},
// Data labels to show on chart series.
dataLabel: {
// Show labels on all data points across all series.
allLabels: true,
// Show cumulative total labels on stacked chart segments.
stackLabels: true,
// Per-column label visibility and optional value filters.
// Use filters to suppress labels below or above a threshold.
columnDataLabel: [{
name: 'Ship Mode',
visible: true,
// Only show the data label when the value is greater than 0
filter: {
value: 0,
operator: DataLabelFilterOperator.GreaterThan
},
},
{
name: 'Discount',
// Hide data labels for this column entirely.
visible: false,
// No filter applied
filter: null, //label is hidden regardless of value.
},
],
},
// chart display settings.
display: {
// Controls row/column summary rows on crosstab (pivot) charts.
summaries: {
showRowTotals: true, // Show totals at the end of each row.
showColumnTotals: false, // Hide totals at the bottom of each column.
showRowGrandTotals: true, // Show the grand total row.
showColumnGrandTotals: true, // Show the grand total column.
},
// Show a statistical regression (trend) line on the chart.
regressionLine: true,
// Show or hide horizontal and vertical grid lines.
gridLine: {
x: true, // Show vertical grid lines (x-axis).
y: true, // Show horizontal grid lines (y-axis).
},
},
// Each entry in this array configures one axis group. columns listed in "linkedColumns" share the same axis settings.
axis: [{
// Columns bound to this axis configuration.
linkedColumns: ['Total Discount', 'Ship Mode'],
// Show the axis name label.
showName: true,
// Show tick mark value labels along the axis.
showLabelValue: true,
// Fix the y-axis domain to a specific minimum/maximum range.
// Useful for enforcing a consistent scale across embed instances.
yAxisRange: {
min: 0,
max: 100,
},
}, ],
// Per-column series color and conditional formatting rules.
columns: [{
name: 'Total Discount',
// Default series color for this column (hex string).
color: '#ababab',
// Applies visual formatting rules to data points that meet the specified conditions. Each entry in rows[] is one rule.
conditionalFormatting: {
rows: [{
// Trigger this rule when the cell value is greater than 3300.
operator: ConditionalFormattingOperator.GreaterThan,
value: '3300',
// When true, draws a reference band across the chart instead of coloring individual data points.
plotAsBand: true,
// Compare the column value against a literal value.
comparisonType: ConditionalFormattingComparisonType.ValueBased,
// The column whose value is evaluated against the rule.
lhsColumnId: 'Total Discount',
// Applied to cell text when the condition is met.
fontProperties: {
color: '#ffffff', // White text.
bold: true,
italic: false,
strikeThrough: false,
underline: false,
},
// Use a solid fill color or a gradient fill.
backgroundFormatType: BackgroundFormatType.Solid,
solidBackgroundAttrs: {
color: '#2E75F0', // Blue background when condition is met.
},
// For gradient fill, set "BackgroundFormatType.Gradient".
// backgroundFormatType: BackgroundFormatType.Gradient,
// gradientBackgroundAttrs: {
// colors: ['#000000', '#ffffff'],
// },
}, ],
},
}, ],
// Field mask for partial updates. An empty array applies all provided fields.
updateMaskPaths: [],
},
table: {
// Per-column overrides for visibility, text wrapping, and conditional formatting.
columns: [{
name: "Total Discount", // Column name
wrapText: true, // wrap long content across multiple lines
show: true,
// Conditional formatting rules to cells in this column.
conditionalFormatting: {
rows: [{
// Trigger rule based on the cell value. Compares the column value against the literal string in `value`.
operator: ConditionalFormattingOperator.GreaterThan,
value: "3300",
// For value range-based matching condition, use `ConditionalFormattingOperator.IsBetween` and `rangeValues`
// operator: ConditionalFormattingOperator.IsBetween ('IS_BETWEEN').
// rangeValues: { min: 0, max: 1000000 },
// Apply formatting to the entire table row instead of just the individual cell.
isHighlightRow: false,
comparisonType: ConditionalFormattingComparisonType.ValueBased,
// The column whose value is evaluated against the rule (left-hand side).
lhsColumnId: "Total Discount",
// Text styling applied to the cell when the condition is met.
fontProperties: {
color: "#ffffff", // White text.
bold: true,
italic: false,
strikeThrough: false,
underline: false,
},
// Use solid or gradient fill color for background styling
backgroundFormatType: BackgroundFormatType.Solid,
solidBackgroundAttrs: {
color: "#2E75F0", //Solid fill color applied when the condition is met.
},
}, ],
},
},
// second column with no conditional formatting.
{
name: "Ship Mode",
wrapText: false,
show: true,
},
],
// Table-level display settings.
display: {
// Set the row height and padding density of the table.
tableContentDensity: TableContentDensity.Compact, // Use TableContentDensity.Regular for standard row height.
},
displaySummaryConfig: {
// Show summary rows for all columns by default.
showAllSummaries: true,
// Per-column exceptions to showAllSummaries.
columnVisibility: [{
columnId: "Total Discount",
visible: false
},
{
columnId: "Total Extended Price",
visible: false
},
],
},
// Field mask for partial updates. An empty array applies all provided fields.
updateMaskPaths: [],
},
},
});
embed.render();
Limitationsπ
-
Visual overrides cannot be applied to the existing saved answers or an answer with a modified search query. The overrides apply only to the new answers generated from the Search data interface.
-
Visual overrides are not supported in Liveboard and Spotter embedding.
-
Visual overrides do not control which fields are placed on the x-axis, y-axis, or slice-by-color. They also do not control whether measures share a single axis or are placed on dual axes.
-
Legend colors use a positional color palette and per-value mapping. Colors are applied in sequence to legend items in the order they appear in the chart. The overrides may not result in the exact legend item-to-color mapping by attribute value.
-
Overrides cannot be modified via HostEvents. To change overrides after the component has rendered, create a new embed with the updated configuration. ThoughtSpot recommends testing the overrides on a development or test environment before applying them on production instances.
-
Overrides do not create undo and redo history entries. Applying
visualOverridesdoes not add entries to the answerβs undo and redo history. Embedding application users cannot undo a visual override through the ThoughtSpot UI. -
Overrides do not trigger answer re-execution. Setting
visualOverridesdoes not re-run the underlying query. Overrides are merged into the existing visualization configuration after the answer is loaded, with no performance impact on query execution.