Search results

Annotations

Annotations are used to mark the specific area of interest in the gauge area with texts, shapes or images. You can add any number of annotations to the gauge.

Annotation

By using the content property of annotation object, you can either specify the id of the element or specify the code to create a new element, that needs to be displayed in the gauge area.

<template>
   <div class="control-section">
         <div align='center'>
             <ejs-lineargauge style='display:block' align='center'  :annotations='annotations'>
             </ejs-lineargauge>
         </div>
</div>
</template>
<style>
  #control-container {
        padding: 0px !important;
    }
</style>
<script>
import Vue from "vue";
import { LinearGaugePlugin, Annotations } from "@syncfusion/ej2-vue-lineargauge";
Vue.use(LinearGaugePlugin);
export default {
    data:function(){
    return{
        annotations:[{
        content: "<div><img src='src/lineargauge/images/apple.png'></div>",
        zIndex: '1',
        x: 100,
        y: 100
        }]
    }
},
 provide: {
    lineargauge: [Annotations]
},
};
</script>

Annotation Customization

Changing the z-order

You can change the z-order of the annotation element by using the zIndex property.

Source
Preview
app.vue
<template>
   <div class="control-section">
         <div align='center'>
             <ejs-lineargauge style='display:block' align='center'  :annotations='annotations'>
             </ejs-lineargauge>
         </div>
  </div>
</template>
<script>
import Vue from "vue";
import { LinearGaugePlugin, Annotations } from "@syncfusion/ej2-vue-lineargauge";
Vue.use(LinearGaugePlugin);
export default {
    data:function(){
    return{
        annotations:[{
        content: '<div id="pointer"><h1>Gauge</h1></div>',
        zIndex: '1',
        verticalAlignment: 'Center',
        horizontalAlignment: 'Center',
        }]
    }
},
 provide: {
    lineargauge: [Annotations]
},
};
</script>
<style>
@import "../../node_modules/@syncfusion/ej2-vue-lineargauge/styles/material.css";
#content-wrapper {
    padding: 0px !important;
}
</style>

Positioning the Annotation

You can place the annotation anywhere in gauge area by specifying pixel values to the x and y properties.

Source
Preview
app.vue
<template>
   <div class="control-section">
         <div align='center'>
             <ejs-lineargauge style='display:block' align='center'  :annotations='annotations'>
             </ejs-lineargauge>
         </div>
</div>
</template>
<script>
import Vue from "vue";
import { LinearGaugePlugin, Annotations } from "@syncfusion/ej2-vue-lineargauge";
Vue.use(LinearGaugePlugin);
export default {
    data:function(){
    return{
        annotations:[{
        content: '<div id="pointer"><h1>Gauge</h1></div>',
        zIndex: '1',
         x: 100,
        y: 100
        }]
    }
},
 provide: {
    lineargauge: [Annotations]
},
};
</script>
<style>
@import "../../node_modules/@syncfusion/ej2-vue-lineargauge/styles/material.css";
#content-wrapper {
    padding: 0px !important;
}
</style>

Alignment of Annotation

You can align the annotation using horizontalAlignment and verticalAlignment properties.

Source
Preview
app.vue
<template>
   <div class="control-section">
         <div align='center'>
             <ejs-lineargauge style='display:block' align='center'  :annotations='annotations'>
             </ejs-lineargauge>
         </div>
</div>
</template>
<script>
import Vue from "vue";
import { LinearGaugePlugin, Annotations } from "@syncfusion/ej2-vue-lineargauge";
Vue.use(LinearGaugePlugin);
export default {
    data:function(){
    return{
        annotations:[{
        content: '<div id="pointer"><h1>Gauge</h1></div>',
        verticalAlignment: 'Center',
        horizontalAlignment: 'Center',
         zIndex: '1',
        }]
    }
},
 provide: {
    lineargauge: [Annotations]
},
};
</script>
<style>
@import "../../node_modules/@syncfusion/ej2-vue-lineargauge/styles/material.css";
#content-wrapper {
    padding: 0px !important;
}
</style>

Multiple Annotations

You can add multiple annotations to the gauge as demonstrated below.

Source
Preview
app.vue
<template>
   <div class="control-section">
         <div align='center'>
             <ejs-lineargauge style='display:block' align='center'  :annotations='annotations'>
             </ejs-lineargauge>
         </div>
</div>
</template>
<script>
import Vue from "vue";
import { LinearGaugePlugin, Annotations } from "@syncfusion/ej2-vue-lineargauge";
Vue.use(LinearGaugePlugin);
export default {
    data:function(){
    return{
        annotations:[ {
                content: '<div id="first"><h1 style="color:red;">Speed</h1></div>',
                verticalAlignment: 'Near',
                horizontalAlignment: 'Center',
                x: 100,
                y: 150,
                 zIndex: '1',
            },
            {
                content: '<div id="first"><h1 style="color:blue;">Meter</h1></div>',
                verticalAlignment: 'Center',
                horizontalAlignment: 'Center',
                x: -100,
                y: -100,
                zIndex: '1',
            }]
    }
},
 provide: {
    lineargauge: [Annotations]
},
};
</script>
<style>
@import "../../node_modules/@syncfusion/ej2-vue-lineargauge/styles/material.css";
#content-wrapper {
    padding: 0px !important;
}
</style>