By default, gauge will be displayed with an axis. Each axis contains its own ranges, pointers and annotation.
You can customize the width and color of an axis line by using lineStyle
property.
Background for an axis can be customized by using background
property.
<template>
<div id="app">
<div class='wrapper'>
<ejs-circulargauge >
<e-axes>
<e-axis :lineStyle= 'lineStyle' background= 'rgba(0, 128, 128, 0.3)'>
</e-axis>
</e-axes>
</ejs-circulargauge>
</div>
</div>
</template>
<script>
import Vue from 'vue';
import { CircularGaugePlugin } from "@syncfusion/ej2-vue-circulargauge";
Vue.use(CircularGaugePlugin);
export default {
data: function (){
return{
lineStyle: {
width: 2,
color: 'red'
}
}
}
};
</script>
<style>
.wrapper {
max-width: 300px;
margin: 0 auto;
}
</style>
Circular gauge axis can sweep from 0 to 360 degrees. By default start angle of an axis is 200 degree and
end angle is 160 degree and you can customize this option by using
startAngle
and endAngle
property.
<template>
<div id="app">
<div class='wrapper'>
<ejs-circulargauge :axes = 'axes'>
</ejs-circulargauge>
</div>
</div>
</template>
<script>
import Vue from 'vue';
import { CircularGaugePlugin } from "@syncfusion/ej2-vue-circulargauge";
Vue.use(CircularGaugePlugin);
export default {
data: function () {
return{
axes: [{
startAngle: 270,
endAngle: 90
}]
}
}
};
</script>
<style>
.wrapper {
max-width: 300px;
margin: 0 auto;
}
</style>
The direction
property enables you to render the gauge axis either in
ClockWise
or in AntiClockWise
direction.
<template>
<div id="app">
<div class='wrapper'>
<ejs-circulargauge >
<e-axes>
<e-axis direction= 'AntiClockWise'>
</e-axis>
</e-axes>
</ejs-circulargauge>
</div>
</div>
</template>
<script>
import Vue from 'vue';
import { CircularGaugePlugin } from "@syncfusion/ej2-vue-circulargauge";
Vue.use(CircularGaugePlugin);
export default { };
</script>
<style>
.wrapper {
max-width: 300px;
margin: 0 auto;
}
</style>
By default, radius of an axis is calculated based on the available size.
You can customize this, by using radius
property.
It takes value either in percentage
or in pixel
.
You can set the radius of the gauge in pixel as demonstrated below,
<template>
<div id="app">
<div class='wrapper'>
<ejs-circulargauge >
<e-axes>
<e-axis radius= '150'>
</e-axis>
</e-axes>
</ejs-circulargauge>
</div>
</div>
</template>
<script>
import Vue from 'vue';
import { CircularGaugePlugin } from "@syncfusion/ej2-vue-circulargauge";
Vue.use(CircularGaugePlugin);
export default { };
</script>
<style>
.wrapper {
max-width: 300px;
margin: 0 auto;
}
</style>
By setting value in percentage, gauge gets its dimension with respect to its available size. For example, when the radius is ‘50%’, gauge renders to half of the available size.
<template>
<div id="app">
<div class='wrapper'>
<ejs-circulargauge >
<e-axes>
<e-axis radius= '50%'>
</e-axis>
</e-axes>
</ejs-circulargauge>
</div>
</div>
</template>
<script>
import Vue from 'vue';
import { CircularGaugePlugin } from "@syncfusion/ej2-vue-circulargauge";
Vue.use(CircularGaugePlugin);
export default { };
</script>
<style>
.wrapper {
max-width: 300px;
margin: 0 auto;
}
</style>
You can customize the height
,
color
and
width
of major and minor ticks by
using majorTicks
and minorTicks
property.
By default, interval
for
majorTicks
will be calculated automatically
and also you can customize the interval for major and minor ticks using
interval
property.
<template>
<div id="app">
<div class='wrapper'>
<ejs-circulargauge >
<e-axes>
<e-axis :majorTicks= 'majorTicks' :minorTicks= 'minorTicks' >
</e-axis>
</e-axes>
</ejs-circulargauge>
</div>
</div>
</template>
<script>
import Vue from 'vue';
import { CircularGaugePlugin } from "@syncfusion/ej2-vue-circulargauge";
Vue.use(CircularGaugePlugin);
export default {
data: function () {
return {
majorTicks: {
interval: 10,
color:'red',
height: 10,
width: 3
},
minorTicks: {
interval: 5,
color:'green',
height: 5,
width: 2
}
}
}
};
</script>
<style>
.wrapper {
max-width: 300px;
margin: 0 auto;
}
</style>
Both minor and major ticks can be moved by using offset
and position
property. The offset
defines the distance between the axis and ticks.
By default, offset value is 0. The position
will place the ticks either inside or outside of the axis.
By default, ticks will be placed inside
the axis.
<template>
<div id="app">
<div class='wrapper'>
<ejs-circulargauge >
<e-axes>
<e-axis :majorTicks= 'majorTicks' :minorTicks= 'minorTicks' >
</e-axis>
</e-axes>
</ejs-circulargauge>
</div>
</div>
</template>
<script>
import Vue from 'vue';
import { CircularGaugePlugin } from "@syncfusion/ej2-vue-circulargauge";
Vue.use(CircularGaugePlugin);
export default {
data: function () {
return {
majorTicks: {
interval: 10,
color:'red',
height: 10,
width: 3,
position: 'Inside',
offset: 5
},
minorTicks: {
interval: 5,
color:'green',
height: 5,
width: 2,
position: 'Inside',
offset: 5
}
}
}
};
</script>
<style>
.wrapper {
max-width: 300px;
margin: 0 auto;
}
</style>
Labels of an axis can be customized by using font
property in labelStyle
options.
<template>
<div id="app">
<div class='wrapper'>
<ejs-circulargauge >
<e-axes>
<e-axis :labelStyle ='labelStyle' >
</e-axis>
</e-axes>
</ejs-circulargauge>
</div>
</div>
</template>
<script>
import Vue from 'vue';
import { CircularGaugePlugin } from "@syncfusion/ej2-vue-circulargauge";
Vue.use(CircularGaugePlugin);
export default {
data: function () {
return {
labelStyle: {
font: {
color: 'red',
size: '20px',
fontWeight: 'Bold'
}
}
}
}
};
</script>
<style>
.wrapper {
max-width: 300px;
margin: 0 auto;
}
</style>
Labels can be moved by using offset
or
position
property.
The offset
defines the distance between the labels and ticks.
By default, offset value is 0.
The position
will place the labels either inside or outside of the axis.
By default, labels will be placed inside
the axis.
<template>
<div id="app">
<div class='wrapper'>
<ejs-circulargauge >
<e-axes>
<e-axis :labelStyle ='labelStyle' >
</e-axis>
</e-axes>
</ejs-circulargauge>
</div>
</div>
</template>
<script>
import Vue from 'vue';
import { CircularGaugePlugin } from "@syncfusion/ej2-vue-circulargauge";
Vue.use(CircularGaugePlugin);
export default {
data: function () {
return {
labelStyle: {
position: 'Outside',
offset: 5
}
}
}
};
</script>
<style>
.wrapper {
max-width: 300px;
margin: 0 auto;
}
</style>
If the last label is not in the visible range, it will be hidden by default. If you want to show the last label, set the showLastLabel
property to true
in the axes
API of circular gauge.
<template>
<div id="app">
<div class='wrapper'>
<ejs-circulargauge >
<e-axes>
<e-axis showLastLabel="true" minimum= 0 maximum= 170 startAngle= 210 endAngle= 150 >
</e-axis>
</e-axes>
</ejs-circulargauge>
</div>
</div>
</template>
<script>
import Vue from 'vue';
import { CircularGaugePlugin } from "@syncfusion/ej2-vue-circulargauge";
Vue.use(CircularGaugePlugin);
export default {
data: function () {
return {}
}
};
</script>
<style>
.wrapper {
max-width: 300px;
margin: 0 auto;
}
</style>
Labels can be swept along the axis angle by enabling autoAngle
property.
<template>
<div id="app">
<div class='wrapper'>
<ejs-circulargauge >
<e-axes>
<e-axis :labelStyle ='labelStyle' >
</e-axis>
</e-axes>
</ejs-circulargauge>
</div>
</div>
</template>
<script>
import Vue from 'vue';
import { CircularGaugePlugin } from "@syncfusion/ej2-vue-circulargauge";
Vue.use(CircularGaugePlugin);
export default {
data: function () {
return {
labelStyle: {
autoAngle: true
}
}
}
};
</script>
<style>
.wrapper {
max-width: 300px;
margin: 0 auto;
}
</style>
When an axis makes a complete circle, then the first and last label of the axis will get overlap with each other.
In this scenario, you can either hide 1st or last label using hiddenLabel
property.
When hiddenLabel
value is First
,
then the 1st label will be hidden and when the
hiddenLabel
value is ‘Last’,
then the last label will be hidden.
<template>
<div id="app">
<div class='wrapper'>
<ejs-circulargauge >
<e-axes>
<e-axis minimum= 0 maximum= 12 startAngle= 0 endAngle= 360 :labelStyle ='labelStyle' :minorTicks= 'minorTicks' :majorTicks= 'majorTicks' >
</e-axis>
</e-axes>
</ejs-circulargauge>
</div>
</div>
</template>
<script>
import Vue from 'vue';
import { CircularGaugePlugin } from "@syncfusion/ej2-vue-circulargauge";
Vue.use(CircularGaugePlugin);
export default {
data: function () {
return {
majorTicks: {
interval: 1,
position: 'Inside',
height: 10
},
minorTicks: {
interval: 0.2,
position: 'Inside',
height: 5
}, labelStyle: {
position: 'Inside',
hiddenLabel: 'First'
}
}
}
};
</script>
<style>
.wrapper {
max-width: 300px;
margin: 0 auto;
}
</style>
Axis labels can be formatted by using format
property in labelStyle
and its supports all globalize format.
<template>
<div id="app">
<div class='wrapper'>
<ejs-circulargauge >
<e-axes>
<e-axis :labelStyle ='labelStyle' >
</e-axis>
</e-axes>
</ejs-circulargauge>
</div>
</div>
</template>
<script>
import Vue from 'vue';
import { CircularGaugePlugin } from "@syncfusion/ej2-vue-circulargauge";
Vue.use(CircularGaugePlugin);
export default {
data: function () {
return {
labelStyle: {
format: 'p1'
}
}
}
};
</script>
<style>
.wrapper {
max-width: 300px;
margin: 0 auto;
}
</style>
The following table describes the result of applying some commonly used label formats on numeric values.
Label Value | Label Format property value | Result | Description |
1000 | n1 | 1000.0 | The Number is rounded to 1 decimal place |
1000 | n2 | 1000.00 | The Number is rounded to 2 decimal place |
1000 | n3 | 1000.000 | The Number is rounded to 3 decimal place |
0.01 | p1 | 1.0% | The Number is converted to percentage with 1 decimal place |
0.01 | p2 | 1.00% | The Number is converted to percentage with 2 decimal place |
0.01 | p3 | 1.000% | The Number is converted to percentage with 3 decimal place |
1000 | c1 | 0. ,000.0 | The Currency symbol is appended to number and number is rounded to 1 decimal place |
1000 | c2 | 0. ,000.00 | The Currency symbol is appended to number and number is rounded to 2 decimal place |
Axis labels support custom label format using placeholder like {value}°C, in which the value represent the axis label e.g 20°C.
<template>
<div id="app">
<div class='wrapper'>
<ejs-circulargauge >
<e-axes>
<e-axis :labelStyle ='labelStyle' >
</e-axis>
</e-axes>
</ejs-circulargauge>
</div>
</div>
</template>
<script>
import Vue from 'vue';
import { CircularGaugePlugin } from "@syncfusion/ej2-vue-circulargauge";
Vue.use(CircularGaugePlugin);
export default {
data: function () {
return {
labelStyle: {
format: '{value}°C'
}
}
}
};
</script>
<style>
.wrapper {
max-width: 300px;
margin: 0 auto;
}
</style>
When the axis labels overlap with each other, you can hide the intersected labels by setting the hideIntersectingLabel
property to true in the axis.
<template>
<div id="app">
<div class='wrapper'>
<ejs-circulargauge >
<e-axes>
<e-axis :startAngle='startAngle' :hideIntersectingLabel='hideIntersectingLabel' :endAngle='endAngle' :majorTicks='majorTicks' :minorTicks='minorTicks' minimum=0 maximum=200 >
</e-axis>
</e-axes>
</ejs-circulargauge>
</div>
</div>
</template>
<script>
import Vue from 'vue';
import { CircularGaugePlugin } from "@syncfusion/ej2-vue-circulargauge";
Vue.use(CircularGaugePlugin);
export default {
data: function () {
return {
startAngle: 270,
endAngle: 90,
hideIntersectingLabel: true,
majorTicks: {
interval: 4
},
minorTicks: {
interval: 2
},
}
}
};
</script>
<style>
.wrapper {
max-width: 300px;
margin: 0 auto;
}
</style>
The minimum
and maximum
properties
enables you to customize the start and end values of an axis.
<template>
<div id="app">
<div class='wrapper'>
<ejs-circulargauge >
<e-axes>
<e-axis minimum= 50 maximum= 250>
</e-axis>
</e-axes>
</ejs-circulargauge>
</div>
</div>
</template>
<script>
import Vue from 'vue';
import { CircularGaugePlugin } from "@syncfusion/ej2-vue-circulargauge";
Vue.use(CircularGaugePlugin);
export default { };
</script>
<style>
.wrapper {
max-width: 300px;
margin: 0 auto;
}
</style>
In addition to the default axis, you can add n number of axis to a gauge. Each axis will have its own ranges, pointers, annotations and customization options.
<template>
<div id="app">
<div class='wrapper'>
<ejs-circulargauge :axes= 'axes' >
</ejs-circulargauge>
</div>
</div>
</template>
<script>
import Vue from 'vue';
import { CircularGaugePlugin } from "@syncfusion/ej2-vue-circulargauge";
Vue.use(CircularGaugePlugin);
export default {
data: function () {
return {
axes: [{
majorTicks: {
interval: 10,
position: 'Inside',
height: 10,
},
pointers: [],
minorTicks: {
interval: 5,
position: 'Inside',
height: 5,
}
}, {
pointers: [],
majorTicks: {
interval: 10,
position: 'Inside',
height: 10,
color: '#27d5ff'
},
minorTicks: {
interval: 5,
position: 'Inside',
height: 5,
color: '#27d5ff'
}
}]
}
}
};
</script>
<style>
.wrapper {
max-width: 300px;
margin: 0 auto;
}
</style>