# Create a line chart based on fields values

**URL:** https://discuss.tryton.org/t/create-a-line-chart-based-on-fields-values/1385
**Category:** Developer
**Created:** [May 13, 2019, 4:33am UTC](https://discuss.tryton.org/t/create-a-line-chart-based-on-fields-values/1385 "2019-05-13T04:33:55Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![German](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/german/32/143_2.png) [@German](https://discuss.tryton.org/u/German)
#### Post date: [May 13, 2019, 4:33am UTC](https://discuss.tryton.org/t/create-a-line-chart-based-on-fields-values/1385/1 "2019-05-13T04:33:55Z")

</div>

I was checking the graph view documentation and examples, I created a simple charts.  
I have a model with 5 fields, and static X axis values, the question is: Can I create a line chart in tryton that has X: 1,2,3 and Y: field1\_value, field2\_value, field\_3\_value ? Is is possible? or graph can’t be used for that.  
thanks team.

---

<div class="post-metadata">

### Author: ![ced](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/ced/32/1237_2.png) [@ced](https://discuss.tryton.org/u/ced)
#### Post date: [May 13, 2019, 9:07am UTC](https://discuss.tryton.org/t/create-a-line-chart-based-on-fields-values/1385/2 "2019-05-13T09:07:23Z")

</div>

You can have only one field on the `x` axis but any `y` you want.

---

<div class="post-metadata">

### Author: ![German](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/german/32/143_2.png) [@German](https://discuss.tryton.org/u/German)
#### Post date: [May 13, 2019, 2:21pm UTC](https://discuss.tryton.org/t/create-a-line-chart-based-on-fields-values/1385/3 "2019-05-13T14:21:08Z")

</div>

I guess that it’s for plot multiple-series, but can I create a graph for a One2Many Field? Thanks for the quick answer @ced , This is the last question.

---

<div class="post-metadata">

### Author: ![pokoli](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/pokoli/32/22_2.png) [@pokoli](https://discuss.tryton.org/u/pokoli)
#### Post date: [May 13, 2019, 2:45pm UTC](https://discuss.tryton.org/t/create-a-line-chart-based-on-fields-values/1385/4 "2019-05-13T14:45:17Z")

</div>

> [@German](#):
>
> but can I create a graph for a One2Many Field

Yes, you should add the graph view on the One2Many field [view\_ids](http://docs.tryton.org/projects/server/en/latest/topics/views/index.html?highlight=view_ids#field) and the relation will be shown as graph.

---

<div class="post-metadata">

### Author: ![German](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/german/32/143_2.png) [@German](https://discuss.tryton.org/u/German)
#### Post date: [May 13, 2019, 3:08pm UTC](https://discuss.tryton.org/t/create-a-line-chart-based-on-fields-values/1385/5 "2019-05-13T15:08:25Z")

</div>

Thanks Sergi !!  
Definitely I’ll read about it and give it a try.

---

<div class="post-metadata">

### Author: ![German](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/german/32/143_2.png) [@German](https://discuss.tryton.org/u/German)
#### Post date: [May 13, 2019, 4:06pm UTC](https://discuss.tryton.org/t/create-a-line-chart-based-on-fields-values/1385/6 "2019-05-13T16:06:15Z")

</div>

It worked! Thanks sergi again.  
Just for the reference, my steps was:

1. Create a graph type view on my model views.xml definition.
2. Then create a inside a tree.xml view the call for One2ManyField like this:  
field colspan=“4” name=“one2many\_field\_name” view\_ids=“ **module\_name**.tree\_view\_id, **module\_name**.graph\_view\_id”

Thanks you all for your help, that was I was looking for. a line chart view for One2Many field.

---

<div class="post-metadata">

### Author: ![system](https://discuss-cdn.tryton.org/uploads/default/original/1X/c6f8ec0a40525cdcd50058c734283450a4b3d38b.png) [@system](https://discuss.tryton.org/u/system)
#### Post date: [June 12, 2019, 4:06pm UTC](https://discuss.tryton.org/t/create-a-line-chart-based-on-fields-values/1385/7 "2019-06-12T16:06:18Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
