You can customize the width
, color
, and size
of minor and major tick lines using the
majorTickLines
and
minorTickLines
properties of the bullet-chart.
<template>
<div>
<ejs-bulletchart id="bulletChart"
:dataSource="data"
valueField="value"
targetField="target"
:minimum="minimum"
:maximum="maximum"
:interval="interval"
title="Revenue"
:majorTickLines="majorTickLines"
:minorTickLines="minorTickLines"
>
<e-bullet-range-collection>
<e-bullet-range end="100" color="red"></e-bullet-range>
<e-bullet-range end="200" color="blue"></e-bullet-range>
<e-bullet-range end="300" color="green"></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: 270, target: 250 }],
minimum: 0, maximum: 300, interval: 50,
majorTickLines: { color: 'blue', width: 5 },
minorTickLines: { color: 'red', width: 5 }
}
}
}
</script>
You can place major and minor ticks inside
or outside
the ranges using the tickPosition
property of bullet-chart.
<template>
<div>
<ejs-bulletchart id="bulletChart"
:dataSource="data"
valueField="value"
targetField="target"
:minimum="minimum"
:maximum="maximum"
:interval="interval"
title="Revenue"
tickPosition="Inside"
>
<e-bullet-range-collection>
<e-bullet-range end="20" color="red"></e-bullet-range>
<e-bullet-range end="25" color="blue"></e-bullet-range>
<e-bullet-range end="30" color="green"></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: 23, target: 22 }],
minimum: 0, maximum: 30, interval: 5
}
}
}
</script>
Axis Label Format
Axis numeric labels can be formatted by using the labelFormat
property. Axis labels support all globalize formats. The following table describes the result of applying some commonly used label formats on numeric axis values.
<template>
<div>
<ejs-bulletchart id="bulletChart"
:dataSource="data"
valueField="value"
targetField="target"
:minimum="minimum"
:maximum="maximum"
:interval="interval"
title="Revenue"
labelFormat="c"
>
<e-bullet-range-collection>
<e-bullet-range end="500" color="red"></e-bullet-range>
<e-bullet-range end="1000" color="blue"></e-bullet-range>
<e-bullet-range end="1500" color="green"></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: 1100, target: 950 }],
minimum: 0, maximum: 1500, interval: 500
}
}
}
</script>
The following ‘Table’ describes the result of applying some commonly used ‘Label’ formats on Numeric axis 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 | $1000.0 | The Currency symbol is appended to number and number is rounded to 1 decimal place |
1000 | c2 | $1000.00 | The Currency symbol is appended to number and number is rounded to 2 decimal place |
To separate groups of thousands, use the enableGroupSeparator
property of bullet-chart.
<template>
<div>
<ejs-bulletchart id="bulletChart"
:dataSource="data"
valueField="value"
targetField="target"
:minimum="minimum"
:maximum="maximum"
:interval="interval"
title="Revenue"
enableGroupSeparator=true
>
<e-bullet-range-collection>
<e-bullet-range end="500" color="red"></e-bullet-range>
<e-bullet-range end="1000" color="blue"></e-bullet-range>
<e-bullet-range end="1500" color="green"></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: 1100, target: 950 }],
minimum: 0, maximum: 1500, interval: 500
}
}
}
</script>
You can also customize the axis label format using a placeholder like ${value}K, in which the value represents the axis label, e.g. $20K.
<template>
<div>
<ejs-bulletchart id="bulletChart"
:dataSource="data"
valueField="value"
targetField="target"
:minimum="minimum"
:maximum="maximum"
:interval="interval"
title="Revenue"
labelFormat="${value}K"
>
<e-bullet-range-collection>
<e-bullet-range end="100" color="red"></e-bullet-range>
<e-bullet-range end="200" color="blue"></e-bullet-range>
<e-bullet-range end="300" color="green"></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: 270, target: 250 }],
minimum: 0, maximum: 300, interval: 50
}
}
}
</script>
You can customize the axis labels inside
or outside
the bullet-chart using the labelPosition
property.
<template>
<div>
<ejs-bulletchart id="bulletChart"
:dataSource="data"
valueField="value"
targetField="target"
:minimum="minimum"
:maximum="maximum"
:interval="interval"
title="Revenue"
labelPosition="Inside"
>
<e-bullet-range-collection>
<e-bullet-range end="100" color="red"></e-bullet-range>
<e-bullet-range end="200" color="blue"></e-bullet-range>
<e-bullet-range end="300" color="green"></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: 270, target: 250 }],
minimum: 0, maximum: 300, interval: 50
}
}
}
</script>
To place an axis opposite to its original position,
set the opposedPosition
property to true.
<template>
<div>
<ejs-bulletchart id="bulletChart"
:dataSource="data"
valueField="value"
targetField="target"
:minimum="minimum"
:maximum="maximum"
:interval="interval"
title="Revenue"
opposedPosition=true
>
<e-bullet-range-collection>
<e-bullet-range end="100" color="red"></e-bullet-range>
<e-bullet-range end="200" color="blue"></e-bullet-range>
<e-bullet-range end="300" color="green"></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: 270, target: 250 }],
minimum: 0, maximum: 300, interval: 50
}
}
}
</script>
You can display the x axis label by mapping the categoryField
from dataSource of a bullet-chart. It is a more efficient way to understand data.
<template>
<div>
<ejs-bulletchart id="bulletChart"
:dataSource="data"
valueField="value"
targetField="target"
:minimum="minimum"
:maximum="maximum"
:interval="interval"
title="Revenue"
categoryField="category"
>
<e-bullet-range-collection>
<e-bullet-range end="100" color="red"></e-bullet-range>
<e-bullet-range end="200" color="blue"></e-bullet-range>
<e-bullet-range end="300" color="green"></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: 270, target: 250, category: "Product A" }],
minimum: 0, maximum: 300, interval: 50
}
}
}
</script>
You can customize the category label by using the categoryLabelStyle
property of the bullet-chart.
<template>
<div>
<ejs-bulletchart id="bulletChart"
:dataSource="data"
valueField="value"
targetField="target"
:minimum="minimum"
:maximum="maximum"
:interval="interval"
title="Revenue"
categoryField="category"
:categoryLabelStyle="categoryStyle"
>
<e-bullet-range-collection>
<e-bullet-range end="100" color="red"></e-bullet-range>
<e-bullet-range end="200" color="blue"></e-bullet-range>
<e-bullet-range end="300" color="green"></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: 270, target: 250, category: "Product A" }],
minimum: 0, maximum: 300, interval: 50,
categoryStyle: { color: "Orange" }
}
}
}
</script>