Search results

Ranges in Vue Bullet Chart component

Ranges are represents the quality of a specific range in bullet-chart scale like good, bad and satisfactory. The end property specifies the ending point of the qualitative range. Minimum value of quantitative scale is considered as the starting point of first range and previous end points are considered as starting point for other ranges.

Source
Preview
app.vue
<template>
  <div>
      <ejs-bulletchart id="bulletChart"
        :dataSource="data"
        valueField="value"
        targetField="target"
        :minimum="minimum"
        :maximum="maximum"
        :interval="interval"
        title="Revenue"
        :categoryField="category"
        :categoryLabelStyle="categoryStyle"
        height="400px"
      >
      <e-bullet-range-collection>
          <e-bullet-range end="35" color="darkred" opacity= 0.5 ></e-bullet-range>
          <e-bullet-range end="50" color="red" opacity= 1 ></e-bullet-range>
          <e-bullet-range end="75" color="blue" opacity= 0.7 ></e-bullet-range>
          <e-bullet-range end="90" color="lightgreen" opacity= 1 ></e-bullet-range>
          <e-bullet-range end="100" color="green" opacity= 1 ></e-bullet-range>
        </e-bullet-range-collection>
      </ejs-bulletchart>
  </div>
</template>
<script>
import Vue from 'vue';
import { BulletChartPlugin } from '@syncfusion/ej2-vue-charts';
Vue.use(BulletChartPlugin);

export default {
  data () {
    return {
      data: [{ value: 55, target: 75, category: "Year 1" },
            { value: 70, target: 70, category: "Year 2" },
            { value: 85, target: 75, category: "Year 3" }],
      minimum: 0, maximum: 100, interval: 10,
      categoryStyle: { color: "red", size: "13", fontWeight: "bold" }
    }
  }
}
</script>

Color Customization

Color for each qualitative range is customized using color property based on end values. Also you can customize the opacity of the each range color.

Source
Preview
app.vue
<template>
  <div>
      <ejs-bulletchart id="bulletChart"
        :dataSource="data"
        valueField="value"
        targetField="target"
        :minimum="minimum"
        :maximum="maximum"
        :interval="interval"
        title="Revenue"
        :categoryField="category"
        :categoryLabelStyle="categoryStyle"
        height="400px"
      >
      <e-bullet-range-collection>
          <e-bullet-range end="35" color="darkred" opacity= 0.5 ></e-bullet-range>
          <e-bullet-range end="50" color="red" opacity= 1 ></e-bullet-range>
          <e-bullet-range end="75" color="blue" opacity= 0.7 ></e-bullet-range>
          <e-bullet-range end="90" color="lightgreen" opacity= 1 ></e-bullet-range>
          <e-bullet-range end="100" color="green" opacity= 1 ></e-bullet-range>
        </e-bullet-range-collection>
      </ejs-bulletchart>
  </div>
</template>
<script>
import Vue from 'vue';
import { BulletChartPlugin } from '@syncfusion/ej2-vue-charts';
Vue.use(BulletChartPlugin);

export default {
  data () {
    return {
      data: [{ value: 55, target: 75, category: "Year 1" },
            { value: 70, target: 70, category: "Year 2" },
            { value: 85, target: 75, category: "Year 3" }],
      minimum: 0, maximum: 100, interval: 10,
      categoryStyle: { color: "red", size: "13", fontWeight: "bold" }
    }
  }
}
</script>