Class PivotViewConditionalSetting
Represents conditional settings for controlling hyperlink visibility in the SfPivotView<TValue> component based on specific conditions.
Inheritance
Inherited Members
Namespace: Syncfusion.Blazor.PivotView
Assembly: Syncfusion.Blazor.dll
Syntax
public class PivotViewConditionalSetting : SfOwningComponentBase, IComponent, IHandleEvent, IHandleAfterRender, IDisposable
Remarks
The PivotViewConditionalSetting class defines conditions that determine when hyperlinks are displayed in pivot table cells. These conditions are evaluated against cell values using specified operators and thresholds.
The following options are available:
- Measure: Specifies the value field caption used to evaluate hyperlink visibility for a specific measure.
- Conditions: Specifies the operator type such as equals, greater than, less than, and others.
- Value1: Specifies the start value for condition evaluation.
- Value2: Specifies the end value for condition evaluation. Used when the operator is Between or NotBetween.
Constructors
PivotViewConditionalSetting()
Declaration
public PivotViewConditionalSetting()
Properties
Conditions
Gets or sets the operator type used to evaluate the condition for hyperlink visibility or conditional formatting.
Declaration
[Parameter]
[JsonPropertyName("conditions")]
[JsonConverter(typeof(JsonStringEnumConverter))]
public Condition Conditions { get; set; }
Property Value
| Type | Description |
|---|---|
| Condition | A Condition enumeration value specifying the comparison operator. The default value is NotEquals. |
Remarks
The available operators are as follows:
- LessThan: Matches cells with a value less than the start value.
- GreaterThan: Matches cells with a value greater than the start value.
- LessThanOrEqualTo: Matches cells with a value less than or equal to the start value.
- GreaterThanOrEqualTo: Matches cells with a value greater than or equal to the start value.
- Equals: Matches cells with a value equal to the start value.
- NotEquals: Matches cells with a value not equal to the start value.
- Between: Matches cells with a value between the start and end values.
- NotBetween: Matches cells with a value not between the start and end values.
Examples
The following example demonstrates how to use different condition operators:
<SfPivotView TValue="ProductDetails" Width="800" Height="500">
<PivotViewDataSourceSettings DataSource="@data">
<!-- Configure rows, columns, values, and filters -->
<PivotViewConditionalFormatSettings>
<!-- Apply formatting only for the row header labeled "France" -->
<PivotViewConditionalFormatSetting Measure="Sales" Label="France" Conditions="Condition.GreaterThan" Value1="5000">
<PivotViewStyle BackgroundColor="#E6FFCC" Color="#145A32" FontFamily="Arial" FontSize="14px" />
</PivotViewConditionalFormatSetting>
</PivotViewConditionalFormatSettings>
</PivotViewDataSourceSettings>
</SfPivotView>
Label
Gets or sets the row or column header label to target when enabling features such as hyperlink visibility or scoped formatting for a specific header.
Declaration
[Parameter]
[JsonPropertyName("label")]
public string Label { get; set; }
Property Value
| Type | Description |
|---|---|
| string | A string specifying the header text (row or column) to target. The default value is |
Remarks
Set this property to the exact header label as it appears in the pivot table (for example, a country name in rows or a quarter in columns). This is used to scope certain features (such as hyperlink visibility or conditional formatting) to that specific header.
Examples
The following example demonstrates how to scope a conditional formatting rule to a specific row header label:
<SfPivotView TValue="ProductDetails" Width="800" Height="500">
<PivotViewDataSourceSettings DataSource="@data">
<!-- Configure rows, columns, values, and filters -->
<PivotViewConditionalFormatSettings>
<!-- Apply formatting only for the row header labeled "France" -->
<PivotViewConditionalFormatSetting Measure="Sales" Label="France" Condition="Condition.GreaterThan" Value1="5000">
<PivotViewStyle BackgroundColor="#E6FFCC" Color="#145A32" FontFamily="Arial" FontSize="14px" />
</PivotViewConditionalFormatSetting>
</PivotViewConditionalFormatSettings>
/// </PivotViewDataSourceSettings>
</SfPivotView>
Measure
Gets or sets the value field (measure) name to which the setting applies.
Declaration
[Parameter]
[JsonPropertyName("measure")]
public string Measure { get; set; }
Property Value
| Type | Description |
|---|---|
| string | A string specifying the target measure's field name. The default value is |
Remarks
Set this property to the name of a value field defined in the pivot report (for example, a field in the Values axis) to apply the configuration (such as conditional formatting or filtering) to that specific measure.
If the specified measure name does not exist in the current report, the configuration is ignored.
Examples
The following example demonstrates how to set a measure for conditional formatting:
<SfPivotView TValue="ProductDetails" Width="800" Height="500">
<PivotViewDataSourceSettings DataSource="@data">
<!-- Configure rows, columns, values, and filters -->
<PivotViewConditionalFormatSettings>
<PivotViewConditionalFormatSetting Measure="Sales" Condition="Condition.GreaterThan" Value1="5000">
<PivotViewStyle BackgroundColor="lightgreen" Color="darkgreen" FontFamily="Arial" FontSize="14px" />
</PivotViewConditionalFormatSetting>
</PivotViewConditionalFormatSettings>
</PivotViewDataSourceSettings>
</SfPivotView>
Value1
Gets or sets the first (start) value used to evaluate a condition for features like hyperlinks, conditional formatting, or filtering.
Declaration
[Parameter]
[JsonPropertyName("value1")]
public double Value1 { get; set; }
Property Value
| Type | Description |
|---|---|
| double | A double representing the start value for the condition. The default value is |
Remarks
For single-value checks (e.g., Equals, GreaterThan), this value is compared with the cell’s value.
For range checks (e.g., Between, NotBetween), Value1 is the lower bound and Value2 is the upper bound.
Examples
The following example applies a style when the “Sold” measure is greater than 500:
<SfPivotView TValue="ProductDetails" Width="800" Height="500">
<PivotViewDataSourceSettings DataSource="@data">
<PivotViewConditionalFormatSettings>
<PivotViewConditionalFormatSetting Measure="Sold" Conditions="Condition.GreaterThan" Value1="500">
<PivotViewStyle BackgroundColor="#80cbc4" Color="black" FontFamily="Tahoma" FontSize="12px" />
</PivotViewConditionalFormatSetting>
</PivotViewConditionalFormatSettings>
</PivotViewDataSourceSettings>
</SfPivotView>
Value2
Gets or sets the second (end) value used to evaluate range-based conditions for features such as hyperlinks, conditional formatting, or filtering.
Declaration
[Parameter]
[JsonPropertyName("value2")]
public double Value2 { get; set; }
Property Value
| Type | Description |
|---|---|
| double | A double representing the end value for range evaluation. The default value is |
Remarks
Use this property together with Value1 when the operator is Between or NotBetween.
For range checks, Value1 is the lower bound and Value2 is the upper bound. For other operators, this property is ignored.
Examples
The following example applies a style when the “Sales” measure is between 5,000 and 10,000:
<SfPivotView TValue="ProductDetails" Width="800" Height="500">
<PivotViewDataSourceSettings DataSource="@data">
<!-- Configure rows, columns, values, and filters -->
<PivotViewConditionalFormatSettings>
<PivotViewConditionalFormatSetting Measure="Sales" Conditions="Condition.Between" Value1="5000" Value2="10000">
<PivotViewStyle BackgroundColor="lightblue" Color="darkblue" FontFamily="Verdana" FontSize="13px" />
</PivotViewConditionalFormatSetting>
</PivotViewConditionalFormatSettings>
</PivotViewDataSourceSettings>
</SfPivotView>
Methods
Dispose(bool)
Dispose unmanaged resources in the component.
Declaration
protected override void Dispose(bool disposing)
Parameters
| Type | Name | Description |
|---|---|---|
| bool | disposing |
Overrides
OnInitializedAsync()
Method invoked when the component is ready to start, having received its initial parameters from its parent in the render tree. Override this method if you will perform an asynchronous operation and want the component to refresh when that operation is completed.
Declaration
protected override Task OnInitializedAsync()
Returns
| Type | Description |
|---|---|
| Task | A System.Threading.Tasks.Task representing any asynchronous operation. |
Overrides
OnParametersSetAsync()
Method invoked when the component has received parameters from its parent in the render tree, and the incoming values have been assigned to properties.
Declaration
protected override Task OnParametersSetAsync()
Returns
| Type | Description |
|---|---|
| Task | A System.Threading.Tasks.Task representing any asynchronous operation. |