Forum Discussion

Ophir_Buchman's avatar
Ophir_Buchman
Data Integration
04-29-2022

Line Chart - Line Conditional Formatting

When creating a line chart, you might want it to color differently for values below the threshold.

Add the following script to your widget:

widget.on('processresult', function(widget, result) {
let dataSeries = result.result.series[0];
let threshold = 0;
let aboveColor = '#0000ff'
let belowColor = '#ff0000'

dataSeries.threshold = threshold;
dataSeries.color = aboveColor;
dataSeries.negativeColor = belowColor
})
Before After

1 Reply

Replies have been turned off for this discussion
  • Is there a way to make the threshold one of the panels in my line chart?

    I have a bar chart and a target line, I want to colour the bar based on the target line.