Skip to main content

GetMaxPointValue

Returns the value of the maximum value condition for the data bar.

Syntax

expression.GetMaxPointValue();

expression - A variable that represents a ApiDatabar class.

Parameters

This method doesn't have any parameters.

Returns

string | number | null

Example

Read the upper boundary value used by a data bar rule in a spreadsheet.

// How do I find out the number or threshold at the top end of a data bar in a spreadsheet?

// Check what value marks the longest bar to understand the data bar scale in a spreadsheet.

let worksheet = Api.GetActiveSheet();

worksheet.GetRange("A1").SetValue("Sales Data");
worksheet.GetRange("A2").SetValue(100);
worksheet.GetRange("A3").SetValue(250);
worksheet.GetRange("A4").SetValue(150);
worksheet.GetRange("A5").SetValue(300);
worksheet.GetRange("A6").SetValue(75);

let dataRange = worksheet.GetRange("A2:A6");
let formatConditions = dataRange.GetFormatConditions();

let dataBar = formatConditions.AddDatabar();

let maxPointValue = dataBar.GetMaxPointValue();

worksheet.GetRange("C1").SetValue("Max Point Value:");
worksheet.GetRange("C2").SetValue(maxPointValue || "Auto");