A newer version of this page is available. Switch to the current version.

JavaScript/jQuery CircularGauge - rangeContainer

Specifies gauge range container properties.

For the purpose of more intelligible data visualization, you can combine values into ranges and color each range differently. For instance, you can indicate the range of warm and cold temperatures. To set the ranges, assign an array of objects defining the ranges to the ranges property of the rangeContainer configuration object. In addition, you can specify the orientation of the ranges relative to an invisible scale line, and an offset from this line using the rangeContainer properties.

backgroundColor

Specifies a range container's background color.

Default Value: '#808080'

The background color is used to indicate the area reserved for the range container in the gauge. This color is replaced with the colors of the ranges contained in the range container.

This property supports the following colors:

You can also specify a custom pattern or gradient instead of a plain color. Call the registerPattern() or registerGradient() method to obtain a fill ID. Assign that value to the fillId field.

jQuery
index.js
$(function(){
    $("#circularGaugeContainer").dxCircularGauge({
        // ...
        rangeContainer: {
            // ...
            backgroundColor: {
                fillId: customPatternId
            }
        }
    });
});
Angular
app.component.html
app.component.ts
<dx-circular-gauge ... >
    <dxo-range-container [backgroundColor]="fill">
        <!-- ... -->
    </dxo-range-container>
</dx-circular-gauge>
// ...

export class AppComponent {
    // ...

    fill = {
        fillId: this.customPatternId
    };
} 
Vue
App.vue (Options API)
App.vue (Composition API)
<template>
    <DxCircularGauge ... >
        <DxRangeContainer
            :background-color="fill"
        >
            <!-- ... -->
        </DxRangeContainer>
    </DxCircularGauge>
</template>

<script>
import DxCircularGauge, { DxRangeContainer } from 'devextreme-vue/circular-gauge'; 
// ...

export default {
    components: {
        DxCircularGauge,
        DxRangeContainer
    },
    data() {
        return {
            // ...
            fill: {
                fillId: this.customPatternId
            }
        }
    }
}
</script>
<template>
    <DxCircularGauge ... >
        <DxRangeContainer
            :background-color="fill"
        >
            <!-- ... -->
        </DxRangeContainer>
    </DxCircularGauge>
</template>

<script setup>
import DxCircularGauge, { DxRangeContainer } from 'devextreme-vue/circular-gauge'; 
// ...

const fill = {
    fillId: customPatternId
};
</script>
React
App.js
import React from 'react';
import CircularGauge, { RangeContainer } from 'devextreme-react/circular-gauge';

// ...
const fill = {
    fillId: customPatternId
};

export default function App() { 
    return ( 
        <CircularGauge ... >
            <RangeContainer backgroundColor={fill}>
                {/* ... */}
            </RangeContainer>
        </CircularGauge>        
    ); 
} 

offset

Specifies the offset of the range container from an invisible scale line in pixels.

Type:

Number

Default Value: 0

orientation

Specifies the orientation of the range container in the CircularGauge UI component.

Default Value: 'outside'

This property specifies the range container's orientation relative to the invisible scale line.

When setting up a range container, apply the required orientation first to check that the result responds to your needs. Then, set the required offset from the invisible scale line to shift the range container.

palette

Specifies the palette to be used for colorizing ranges in the range container.

Type:

Array<String>

|

Palette

Default Value: 'Material'

This property accepts either the name of a predefined palette or an array of colors. The array can include the following colors:

View Demo

See Also

paletteExtensionMode

Specifies what to do with colors in the palette when their number is less than the number of ranges in the range container.

Default Value: 'blend'

The following variants are available:

  • "blend"
    Create a blend of two neighboring colors and insert it between these colors in the palette.

  • "alternate"
    Repeat the full set of palette colors, alternating their normal, lightened, and darkened shades in that order.

  • "extrapolate"
    Repeat the full set of palette colors, changing their shade gradually from dark to light.

View Demo

ranges[]

An array of objects representing ranges contained in the range container.

Type:

Array<Object>

Default Value: []
Cannot be used in themes.

Ranges allow you to mark certain value ranges in the gauge. Visually, the ranges are displayed as bars along scales. To define ranges, introduce the ranges array. Specify a start value, an end value and a color for each range.

View Demo

width

Specifies the range container's width in pixels.

Type:

Number

Default Value: 5