# Hovertemplate : unexpected behaviour on Pie Chart

**URL:** <https://community.plotly.com/t/hovertemplate-unexpected-behaviour-on-pie-chart/62636>\
**Category:** 📊 Plotly Python\
**Tags:** question\
**Created:** [April 2, 2022, 4:03pm UTC](https://community.plotly.com/t/hovertemplate-unexpected-behaviour-on-pie-chart/62636 "2022-04-02T16:03:53Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jgomes\_eu](https://sea2.discourse-cdn.com/flex024/user_avatar/community.plotly.com/jgomes_eu/32/14895_2.png) [@jgomes\_eu](https://community.plotly.com/u/jgomes_eu)\
**Post date:** [April 2, 2022, 4:03pm UTC](https://community.plotly.com/t/hovertemplate-unexpected-behaviour-on-pie-chart/62636/1 "2022-04-02T16:03:53Z")

</div>

Hi everyone,  
I have the following code that you can run on your own machine

import pandas as pd  
import plotly.express as px

df = pd.read\_csv(‘[https://docs.google.com/spreadsheets/d/e/2PACX-](https://docs.google.com/spreadsheets/d/e/2PACX-)’  
‘1vTPpPotcptmOX2CBhvzWUbRJNCXFqkUIicECxWRKg1uszebqlPsGZHVv4EBDOEkN1J5dzr3\_K1MW1qS/pub?gid=0&single=true&output=csv’)

df\_totals = df.groupby([“country”, “region”]).volunteers.sum().reset\_index()

```auto
fig_pie = px.pie(df_totals, names='region', values='volunteers', hole=0.5, color='region',custom_data=['region','volunteers'])
print(df_totals.info())
# Donut Chart Styling
fig_pie.update_traces(textposition='inside')
fig_pie.update_layout(uniformtext_minsize=12, uniformtext_mode='hide')
fig_pie.update_traces(hovertemplate="<b>Okres:</b> %{customdata[0]}<br><b>Celkom:</b> %{customdata[1]}")
fig_pie.update_layout(
        hoverlabel=dict(
        bgcolor="#273B80",
        font_size=16,
        font_family="sans-serif"
    	)
)   
fig_pie.show()

```

After trying using `names`and `values` for my hovertemplate, **without it fetching the values** I have assigned both columns to `custom_data`

Here is a sample of the results:

**Showing a number in customdata[0] (that should only have the region name) and not rendering customdata[1]**

 ![Screenshot 2022-04-02 at 16.57.41](https://us1.discourse-cdn.com/flex024/uploads/plot/original/3X/9/b/9bf62abf5b488bcc5b6412c10d2eeb16f6aabf3c.jpeg)

**Rendering customdata[1] but showing a different number from the one that appears, out of nowhere, on customdata[0]**

 ![Screenshot 2022-04-02 at 16.57.37](https://us1.discourse-cdn.com/flex024/uploads/plot/original/3X/4/b/4b8f09bb5a75ffa7dac027f230cfccf5955eefbf.jpeg)

**Am I doing something wrong, or is this a bug?**

Thank you in advance for your help!

_ **Disclaimer** : The solutions presented will be used in non-profit NGO project. No commercial use of the solution will be made._
