# How to draw a stacked bar chart which has different 'x' values?

**URL:** https://community.plotly.com/t/how-to-draw-a-stacked-bar-chart-which-has-different-x-values/38909
**Category:** Dash Python
**Created:** [May 5, 2020, 6:04am UTC](https://community.plotly.com/t/how-to-draw-a-stacked-bar-chart-which-has-different-x-values/38909 "2020-05-05T06:04:34Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![priyaramki16](https://sea2.discourse-cdn.com/flex024/user_avatar/community.plotly.com/priyaramki16/32/10625_2.png) [@priyaramki16](https://community.plotly.com/u/priyaramki16)
#### Post date: [May 5, 2020, 6:04am UTC](https://community.plotly.com/t/how-to-draw-a-stacked-bar-chart-which-has-different-x-values/38909/1 "2020-05-05T06:04:34Z")

</div>

Hi…I am new to dash and plotly…and I am also new to this community forum… So I was writinng a code to create horizontal bar charts which is stacked. I have pasted the piece of code below. As you can see from the code the ‘x’ value for 2 traces are 2 different lists(startdates and enddates)(these lists have dates in the format dd-mm-yyyy)…When I run the code…I get a graph where the x axis shows years(like 2020,2030,2040…) instead of the dates in the lists and only if i zoom very closely i can see the graphs w.r.t dates.

graphs = go.Figure()  
graphs.add\_trace(go.Bar(  
y=owner\_list,  
x=startdates,  
name=‘PENDING’,  
orientation=‘h’,  
marker=dict(  
color=‘rgb(235, 234, 230)’,  
line=dict(color=‘rgb(23, 23, 22)’, width=3)  
)))

```
graphs.add_trace(go.Bar(
    y=owner_list,
    x=enddates,
    name='COMPLETED',
    orientation='h',
    text= '%',
    marker=dict(
        color='rgb(9, 230, 68)',
        line=dict(color='rgb(23, 23, 22)', width=3)
)))

```

graphs.update\_layout(barmode=‘stack’)

and image of my graph which shows years instead of dates has been attached. ![Capture](https://us1.discourse-cdn.com/flex024/uploads/plot/original/2X/e/e6611355f0c65b0f44bbf78ac90477020f9e8eb1.png)

Kindly help me with this.  
This is the excel i am referring…as you can see start dates do not have 2030, 2040 ,…and all  
 ![Capture2](https://us1.discourse-cdn.com/flex024/uploads/plot/original/2X/a/a625fd9c82d685a514cdf9444ca5e8f5769bf1b0.png)
