Search results

User Interaction in Vue Linear Gauge component

Tooltip

Linear gauge will display the details about the pointer value through tooltip, when the mouse is moved over the pointer. By default, tooltip will not be visible and you can enable the tooltip by setting enable property to true and by injecting GaugeTooltip module using LinearGauge.Inject(GaugeTooltip).

Source
Preview
app.vue
<template>
   <div>
    <div class="content-wrapper">
    <div align='center'>
    <ejs-lineargauge   :tooltip='tooltip' >
    <e-axes>
      <e-axis >
        <e-pointers>
           <e-pointer value=80 ></e-pointer>
    </e-pointers>
    </e-axis>
    </e-axes>
    </ejs-lineargauge>
  </div>
  </div>
  </div>
</template>
<script>
import Vue from 'vue';
import { LinearGaugePlugin, GaugeTooltip } from "@syncfusion/ej2-vue-lineargauge";

Vue.use(LinearGaugePlugin);
export default {
      data: function () {
          return{
            tooltip: {
               enable: true
            }
          }
    },
     provide: {
       lineargauge: [ GaugeTooltip]
     },
};
</script>
<style>
#content-wrapper {
    padding: 0px !important;
}
</style>

Format the Tooltip

By default, tooltip will show the pointer value only. In addition to that, you can show more information in tooltip. For example, the format ${value} shows pointer value with currency symbol.

Source
Preview
app.vue
<template>
   <div>
    <div class="content-wrapper">
    <div align='center'>
    <ejs-lineargauge   :tooltip='tooltip' >
    <e-axes>
      <e-axis >
        <e-pointers>
           <e-pointer value=80 ></e-pointer>
    </e-pointers>
    </e-axis>
    </e-axes>
    </ejs-lineargauge>
  </div>
  </div>
  </div>
</template>
<script>
import Vue from 'vue';
import { LinearGaugePlugin, GaugeTooltip } from "@syncfusion/ej2-vue-lineargauge";

Vue.use(LinearGaugePlugin);
export default {
      data: function () {
          return{
            tooltip: {
               enable: true,
                format: '${value}'
            }
          }
    },
     provide: {
       lineargauge: [ GaugeTooltip]
     },
};
</script>
<style>
#content-wrapper {
    padding: 0px !important;
}
</style>

Tooltip Template

Any HTML elements can be displayed in the tooltip by using the template property of the tooltip. You can use the {value} as placeholders in the HTML element to display the pointer values of the corresponding axis.

Source
Preview
app.vue
<template>
   <div>
    <div class="content-wrapper">
    <div align='center'>
    <ejs-lineargauge   :tooltip='tooltip' >
    <e-axes>
      <e-axis >
        <e-pointers>
           <e-pointer value=80 ></e-pointer>
    </e-pointers>
    </e-axis>
    </e-axes>
    </ejs-lineargauge>
  </div>
  </div>
  </div>
</template>
<script>
import Vue from 'vue';
import { LinearGaugePlugin, GaugeTooltip } from "@syncfusion/ej2-vue-lineargauge";
Vue.use(LinearGaugePlugin);

var contentVue = Vue.component("contentTemplate", {
  template: '<div>Pointer: 80 </div>',
  data() {
    return {
      data: {}
    };
  }
});

var contentTemplate = function() {
  return { template: contentVue };
};

export default {
      data: function () {
          return{
            tooltip: {
               enable: true,
               template: contentTemplate
            }
          }
    },
     provide: {
       lineargauge: [GaugeTooltip]
     },
};
</script>
<style>
#content-wrapper {
    padding: 0px !important;
}
</style>

Customize the Appearance of Tooltip

The fill and border properties are used to customize the background color and border of the tooltip respectively. The textStyle property in the tooltip is used to customize the font of the tooltip text.

Source
Preview
app.vue
<template>
   <div>
    <div class="content-wrapper">
    <div align='center'>
    <ejs-lineargauge   :tooltip='tooltip' >
    <e-axes>
      <e-axis >
        <e-pointers>
           <e-pointer value=80 ></e-pointer>
    </e-pointers>
    </e-axis>
    </e-axes>
    </ejs-lineargauge>
  </div>
  </div>
  </div>
</template>
<script>
import Vue from 'vue';
import { LinearGaugePlugin, GaugeTooltip } from "@syncfusion/ej2-vue-lineargauge";

Vue.use(LinearGaugePlugin);
export default {
      data: function () {
          return{
            tooltip: {
               enable: true,
            fill: '#e5bcbc',
            border: {
                color: '#d80000',
                width: 2
            }
            }
          }
    },
     provide: {
       lineargauge: [ GaugeTooltip]
     },
};
</script>
<style>
#content-wrapper {
    padding: 0px !important;
}
</style>

Pointer Drag

You can drag and drop either marker or bar pointer over the desired axis value using enableDrag property in the pointer.

Source
Preview
app.vue
<template>
   <div>
    <div class="content-wrapper">
    <div align='center'>
    <ejs-lineargauge >
    <e-axes>
      <e-axis >
        <e-pointers>
           <e-pointer value=80  enableDrag= 'true' ></e-pointer>
    </e-pointers>
    </e-axis>
    </e-axes>
    </ejs-lineargauge>
  </div>
  </div>
  </div>
</template>
<script>
import Vue from 'vue';
import { LinearGaugePlugin } from "@syncfusion/ej2-vue-lineargauge";

Vue.use(LinearGaugePlugin);
export default { };
</script>
<style>
#content-wrapper {
    padding: 0px !important;
}
</style>