> For the complete documentation index, see [llms.txt](https://nocode-artisan.gitbook.io/plotly-charts/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://nocode-artisan.gitbook.io/plotly-charts/creating-charts/traces-customization/text-and-labels/how-to-display-values-on-chart.md).

# How to display values on chart

We have a column chart where we have displayed the sales for each month.

<div align="left"><figure><img src="/files/5FSxlcYFNOxDsyhiGQMM" alt="" width="375"><figcaption><p>A column chart of sales over the months.</p></figcaption></figure></div>

We are going to display the total sales for each month on the chart. For this, we can use the "**Text Template**" field.

## Text Template

To add **Y values** as columns' labels, we enter `%{y}` into the Text Template field.&#x20;

<figure><img src="/files/68jOtZWgx47zvOF4Ts8U" alt=""><figcaption><p>Use "<strong>Text Template</strong>" to add Y values as labels.</p></figcaption></figure>

As you see, Y values are added at the end of inside of each column. Also, it formats some of the values automatically for better appearance.

<div align="left"><figure><img src="/files/YokazSWcFmlT2CdsHfg6" alt="" width="563"><figcaption></figcaption></figure></div>

### Values Formatting

To customize the format of label's numbers (or date-time), Plotly  uses D3 format method, which you can see on [Formatting Cheat Sheet](/plotly-charts/additional-resources/formatting-cheat-sheet.md) page.

In our case, if we want to display sales with as currency and use SI-prefix with two significant digits we can change the text template to `%{y:$.2s}` that makes the labels looks:

<div align="left"><figure><img src="/files/qlVCXo32Lvda9qzsuRNo" alt="" width="563"><figcaption><p>Custom formatting numbers in text template</p></figcaption></figure></div>

## FAQ

<details>

<summary>Is this feature only available in Bar trace?</summary>

No, this feature is available in all trace modules.

</details>

<details>

<summary>I do the same with a Scatter trace, but labels don't display!</summary>

In scatter traces, you need to make sure that the mode selected for the trace includes text.

<img src="/files/koXpwCrrqUcEz0IqpXTx" alt="" data-size="original">

</details>

<details>

<summary>Can I add custom text instead of using the chart's data?</summary>

Yes, of course, you can enter your text directly in the field. Only the values inside `%{ }` are created dynamically according to the data. \
Likewise, you can use static and dynamic text at the same time. `Sales: %{y}`

</details>

<details>

<summary>Could I add margins for inside labels?</summary>

You can add extra spaces before/after your template to add gaps. `%{y}`

</details>
