---
title: "Line, Badge Annotation"
language: "en"
canonical: "https://g2.antv.antgroup.com/en/examples/annotation/shape/line-badge/"
version: "5.4.8"
---

# Line, Badge Annotation

[Live example](https://g2.antv.antgroup.com/en/examples/annotation/shape/line-badge/)

[Resource index](/llms.txt)

Provide a DOM element with `id="container"`. The original example source follows.

## Source

```ts
import { Chart } from '@antv/g2';

const chart = new Chart({
  container: 'container',
  autoFit: true,
  insetTop: 50,
});

chart.options({
  type: 'view',
  data: {
    type: 'fetch',
    value:
      'https://gw.alipayobjects.com/os/antvdemo/assets/data/blockchain.json',
    transform: [
      {
        type: 'fold',
        fields: ['blockchain', 'nlp'],
        key: 'type',
        value: 'value',
      },
    ],
  },
  axis: { x: { labelAutoHide: 'greedy' } },
  children: [
    {
      type: 'line',
      encode: { x: (d) => new Date(d.date), y: 'value', color: 'type' },
    },
    {
      type: 'text',
      data: [new Date('2017-12-17'), 100],
      encode: { shape: 'badge' },
      style: {
        text: '100',
        dy: -1,
        markerSize: 24,
        markerFill: '#6395FA',
        markerFillOpacity: 0.55,
      },
    },
  ],
});

chart.render();
```
