ArcGIS Pro 3.3 API Reference Guide
ArcGIS.Core.CIM Namespace / CIMVoxelStretchRenderer Class / ColorRangeMin Property
Example

In This Topic
    ColorRangeMin Property
    In This Topic
    Gets or sets the minimum value.
    Syntax
    public double ColorRangeMin {get; set;}
    Public Property ColorRangeMin As Double
    Example
    Access Stats and Color Range for a Stretch Renderer
    //var voxelLayer = ... ;
    //Must be on the QueuedTask.Run()
    
    //Get the variable profile on which to access the data
    var variable = voxelLayer.SelectedVariableProfile;
    //or use ...voxelLayer.GetVariableProfiles()
    
    //Data range
    //At 2.x - 
    //var min = variable.GetVariableStatistics().MinimumValue;
    //var max = variable.GetVariableStatistics().MaximumValue;
    
    var min = variable.Statistics.MinimumValue;
    var max = variable.Statistics.MaximumValue;
    
    //Color range (Continuous only)
    double color_min, color_max;
    if (variable.DataType == VoxelVariableDataType.Continuous)
    {
        var renderer = variable.Renderer as CIMVoxelStretchRenderer;
        color_min = renderer.ColorRangeMin;
        color_max = renderer.ColorRangeMax;
    }
    
    Change Stretch Renderer Color Range
    //Typically, the default color range covers the most
    //commonly occuring voxel values. Usually, the data
    //range is much broader than the color range
    
    //Get the variable profile whose renderer will be changed
    var variable = voxelLayer.SelectedVariableProfile;
    
    //Check DataType
    if (variable.DataType != VoxelVariableDataType.Continuous)
        return;//must be continuous to have a Stretch Renderer...
    
    var renderer = variable.Renderer as CIMVoxelStretchRenderer;
    var color_min = renderer.ColorRangeMin;
    var color_max = renderer.ColorRangeMax;
    //increase range by 10% of the current difference
    var dif = (color_max - color_min) * 0.05;
    color_min -= dif;
    color_max += dif;
    
    //make sure we do not exceed data range
    //At 2.x - 
    //if (color_min < variable.GetVariableStatistics().MinimumValue)
    //    color_min = variable.GetVariableStatistics().MinimumValue;
    //if (color_max > variable.GetVariableStatistics().MaximumValue)
    //    color_max = variable.GetVariableStatistics().MaximumValue;
    
    if (color_min < variable.Statistics.MinimumValue)
        color_min = variable.Statistics.MinimumValue;
    if (color_max > variable.Statistics.MaximumValue)
        color_max = variable.Statistics.MaximumValue;
    
    //variable.Statistics.MinimumValue
    renderer.ColorRangeMin = color_min;
    renderer.ColorRangeMax = color_max;
    
    //apply changes
    variable.SetRenderer(renderer);
    
    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3 or higher.
    See Also