SPBucketHealthScoreCalculator.SetScoreBuckets Method

Sets the array of score values that define the subranges of scores—the "buckets"—used by CalculateScore(Double) to generate health scores.

Namespace:  Microsoft.SharePoint.Utilities
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Available in Sandboxed Solutions: No

public void SetScoreBuckets(
	double[] buckets
)

Parameters

buckets
Type: []

An array of values representing the buckets.

ExceptionCondition
ArgumentException

The pattern of values in buckets is inconsistent with the value of the IsASC property.

The buckets parameter must meet certain conditions.

  • The values of the elements in buckets must be well-ordered, either from smallest to largest or from largest to smallest.

  • The direction of the ordering must conform to the value of the IsASC property. If the latter is true, for example, the values must progress from smallest to largest. Because the IsASC property is read-only, you should use this method only to change the bucket boundaries, not to reverse the ascending or descending character of the performance measure.

  • The values in buckets must also be well-ordered from healthiest to least healthy. So buckets[0] is a healthier value than buckets[1] and the latter is a healthier value than buckets[2], and so on. Hence, buckets[buckets.Length-1] must always be the least healthy value in buckets.

Depending on the performance being measured, it is often appropriate for the values in buckets to scale exponentially.

The following example is a declaration of an array used to specify ranges of available memory, measured in megabytes.


double[] availableMemoryBuckets = new double[10]
                                  {1000.0, 500.0, 400.0, 300.0, 200.0,
                                    100.0,  80.0,  60.0,  40.0,  20.0};

For an example of this method in use, see How to: Create, Modify, and Change a Bucket-Style Health-Score Calculator.

Show: