[Linux] How to format and style Cartesian Charts
Summary: The discussion titled 'Column And Line Chart Formatting' consists of two participants, intapiuser and paola_ig. However, no content was provided in the conversation.
Introduction
Sisense Cartesian charts (such as Column, Bar, and Line widgets) can be customized with a widget script to go beyond the standard appearance settings. This article provides a single script that bundles several independent formatting tweaks - axis titles, floating data labels, axis label formatting, widget background color, and axis scale and tick intervals, so you can style a chart to match your own themes and readability needs. The script is tested on Sisense Linux 2026.3.2 and works for both cloud and self-hosted customers. Each section is independent: feel free to apply only the parts you need or adapt it and remove the rest.
Step-by-Step Guide
1. Open the widget script editor
Open the dashboard containing your Column, Bar, or Line widget. Enter edit mode, open the widget menu, and select Edit Script to open the widget script editor.
2. Paste the script
Paste the following into the widget script editor. You can keep all six sections or remove the ones you don't need (see the notes below on commenting out sections):
/*********************************************************************/
/******** Column & Line Chart Formatting (widget script) **********/
/******** Tested on Sisense Linux 2026.3.2-build.59 **********/
/*********************************************************************/
/*
* This script bundles several independent formatting tweaks for a
* Cartesian chart:
* 1. Axis titles (text, color, font)
* 2. Floating data labels on a chosen series
* 3. Axis label formatting (rotation, color, font)
* 4. Widget background color
* 5. Legend text color
* 6. Axis scale and tick intervals
*
*/
/******************************************************************/
/******** 1. Change the Axis Titles, Color, Font Size **********/
/******************************************************************/
widget.on('processresult', function (se, ev) {
// Primary X axis
if (ev.result.xAxis) {
ev.result.xAxis.title = {
text: 'X AXIS TITLE',
style: { color: '#ffcb05', fontSize: '50px', fontFamily: 'Verdana' }
};
}
// Primary (left) Y axis
if (ev.result.yAxis && ev.result.yAxis[0]) {
ev.result.yAxis[0].title = {
text: 'Y Axis Title',
style: { color: '#ffcb05', fontSize: '32px', fontFamily: 'Arial' }
};
}
// Secondary (right) Y axis - only present when a value is on the
// secondary axis. The guard prevents "Cannot set properties of
// undefined (setting 'title')".
if (ev.result.yAxis && ev.result.yAxis[1]) {
ev.result.yAxis[1].title = {
text: 'Secondary Y Axis Title',
style: { color: '#ffcb05', fontSize: '24px', fontFamily: 'Comic Sans MS' }
};
}
});
/*******************************************/
/******** 2. Format Floating Data Labels */
/*******************************************/
widget.on('beforeviewloaded', function (widget, ev) {
/* Set this to the exact name of the series you want labeled. */
var seriesName = 'Total Cost';
var series = (ev.options && ev.options.series) ? ev.options.series : [];
var target = _.find(series, function (ser) { return ser.name === seriesName; });
// Guard: if no series matches the name, skip silently.
if (!target) { return; }
/* Enable labels + style, rotation (-360..360) and Y offset */
target.dataLabels = {
enabled: true,
style: { fontSize: '11px', fontWeight: 'bold', color: '#fff' },
rotation: 350,
y: 40
};
});
/*************************************************/
/******** 3. Change the Axis Labels Format *****/
/*************************************************/
widget.on('render', function (se, ev) {
var q = se.queryResult;
if (!q) { return; }
/* X axis labels */
if (q.xAxis && q.xAxis.labels) {
q.xAxis.labels.rotation = -45;
q.xAxis.labels.y = 30;
q.xAxis.labels.style = q.xAxis.labels.style || {};
q.xAxis.labels.style.color = '#ffcb05';
q.xAxis.labels.style.fontSize = '12px';
q.xAxis.labels.style.fontWeight = 'bold';
q.xAxis.labels.style.fontFamily = 'Verdana';
}
/* Primary (left) Y axis labels */
if (q.yAxis && q.yAxis[0] && q.yAxis[0].labels) {
q.yAxis[0].labels.rotation = 45;
q.yAxis[0].labels.x = 15;
q.yAxis[0].labels.style = q.yAxis[0].labels.style || {};
q.yAxis[0].labels.style.color = '#ffcb05';
q.yAxis[0].labels.style.fontSize = '12px';
q.yAxis[0].labels.style.fontWeight = 'bold';
q.yAxis[0].labels.style.fontFamily = 'Arial';
}
/* Secondary (right) Y axis labels - guarded (may not exist) */
if (q.yAxis && q.yAxis[1] && q.yAxis[1].labels) {
q.yAxis[1].labels.rotation = -45;
q.yAxis[1].labels.x = 10;
q.yAxis[1].labels.style = q.yAxis[1].labels.style || {};
q.yAxis[1].labels.style.color = '#ffcb05';
q.yAxis[1].labels.style.fontSize = '15px';
q.yAxis[1].labels.style.fontWeight = 'bold';
q.yAxis[1].labels.style.fontFamily = 'Calibri';
}
});
/****************************************************/
/******** 4. Change the Widget Background Color ***/
/****************************************************/
widget.on('ready', function (se, ev) {
$(element).css('background-color', '#000000'); // widget body
$('widget-header', element.parent()).css('background-color', '#000000'); // widget title bar
});
/***************************************************/
/******** 5. Change the Legend Text Color ********/
/***************************************************/
widget.on('beforeviewloaded', function (se, ev) {
if (!ev.options) { return; }
ev.options.legend = ev.options.legend || {};
ev.options.legend.itemStyle = ev.options.legend.itemStyle || {};
// Normal legend item color (applies to "Total Cost", "Total Revenue", etc.)
ev.options.legend.itemStyle.color = '#ffcb05';
ev.options.legend.itemStyle.fontSize = '14px';
ev.options.legend.itemStyle.fontWeight = 'bold';
// Color when a series is toggled off (hidden) via the legend
ev.options.legend.itemHiddenStyle = ev.options.legend.itemHiddenStyle || {};
ev.options.legend.itemHiddenStyle.color = '#666666';
});
/***************************************************/
/******** 6. Change the Axis Scale & Intervals ***/
/***************************************************/
/*
* Note: leave `max` unset (undefined) so Highcharts auto-scales the axis
* to the data. Only set `max` if you truly want
* a fixed ceiling. The same applies to `tickInterval`: pick a value that
* fits your data range.
*/
widget.on('ready', function (se, ev) {
var chart = element.data('hc');
if (!chart || !chart.yAxis) { return; }
/* Primary (left) Y axis */
if (chart.yAxis[0]) {
chart.yAxis[0].update({
alignTicks: false,
tickInterval: 10000,
min: 0
// max intentionally omitted -> auto-scale to the data
}, false); // defer redraw
}
/* Secondary (right) Y axis - guarded (may not exist) */
if (chart.yAxis[1]) {
chart.yAxis[1].update({
alignTicks: false,
tickInterval: 1,
min: 1
// max intentionally omitted -> auto-scale to the data
}, false); // defer redraw
}
/* Redraw once, after both axes are updated */
chart.redraw();
});3. Adapt the sections to your chart
Section 1 - Axis titles: Replace the
textvalues ("X AXIS TITLE", "Y Axis Title", "Secondary Y Axis Title") and adjustcolor,fontSize, andfontFamilyto taste.Section 2 - Data labels: Set
seriesNameto the exact name of the series you want to label. Adjust thestyle,rotation(-360 to 360), andyoffset. Labels are enabled at the series level so they survive hover and redraw.Section 3 - Axis labels: Adjust rotation, offset, color, size, weight, and font family for the X and Y axis labels.
Section 4 - Background color: Change the two
background-colorhex values for the widget body and title bar.Section 5 - Legend text color: Adjust
itemStylefor the normal legend text color, size, and weight, anditemHiddenStyle.colorfor the color shown when a series is toggled off via the legend.Section 6 - Axis scale and intervals: Set
tickIntervalandminto fit your data range. Leavemaxomitted so Highcharts auto-scales to the data; set it only if you want a fixed ceiling.
4. Refresh and apply
Refresh the Widget Editor page, then click Apply to render the chart with your formatting. Here are examples on what you would see applying this script to a Column, Bar and Line charts:



How it works
processresult (section 1): Axis titles are set on the
processresultevent, which modifies the chart configuration before it is drawn.beforeviewloaded (sections 2 and 5): Data labels and the legend styling are applied by editing the Highcharts options object (
ev.options) before the view is rendered. For data labels, enabling them on the series (not on each individual data point) lets Highcharts manage the label elements through its normal create/destroy lifecycle, so they survive hover and redraw instead of throwing errors on interaction. The legend styling setsitemStylefor visible items anditemHiddenStylefor items toggled off.render (section 3): Axis label styling is applied on the
renderevent via the widget'squeryResult, so rotation and font styles land on the rendered X and Y axis labels.ready (sections 4 and 6): The background color is set by styling the widget DOM elements once the widget is ready, and the axis scale/intervals are applied directly to the live Highcharts object (
element.data('hc')) with a single deferredredraw()after both axes are updated.Defensive guards: Each section checks that the axis or series it targets actually exists (for example, the secondary Y axis is only present when a value is assigned to it) so a missing element is skipped silently instead of throwing an error.
Important notes
Apply only what you need: The six sections are independent. Drop or comment out any section you don't want using
/*and*/. If you need to customize any parts not covered in this article, you can check the Highcharts API to find the option you need and customize it accordingly.Series name must match: In section 2,
seriesNamemust exactly match the name of the series you want labeled, or the labels are skipped.Secondary axis is optional: The secondary (right) Y axis sections only take effect when a value is assigned to the secondary axis; otherwise they are skipped by the guards.
Colors follow CSS formatting: Use standard CSS color values. A color picker such as colorpicker.com is handy for finding hex codes.
Axis scale: Leave
maxunset so Highcharts auto-scales to the data (unless you want a specific scale limit), and choose atickIntervalthat fits your data range.
Conclusion
With a single widget script you can fully customize the look and feel of Column, Bar, and Line charts - axis titles, data labels, axis label styling, background color, legend text color, and axis scaling - without any changes to your data model. Because each section is self-contained, you can mix and match the tweaks you need and reuse the same patterns across your Cartesian widgets.
References / Related content
Customizing Sisense Using Code – https://docs.sisense.com/main/SisenseLinux/customizing-sisense-using-code.htm
Sisense JS API Reference (Widget class) – https://developer.sisense.com/guides/customJs/jsApiRef/widgetClass/
Highcharts API (chart options) – https://api.highcharts.com/highcharts/
Disclaimer: This post outlines a potential custom workaround for a specific use case or provides instructions regarding a specific task. The solution may not work in all scenarios or Sisense versions, so we strongly recommend testing it in your environment before deployment. If you need further assistance with this, please let us know.
paola_ig
Thanks for sharing this script. Is there a way to turn this into a dashboard script that can be applied to every column and bar chart widget on a dashboard ?