Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

Add custom title in X-axis and Y-axis in OpenERP 7 Graph view

By
Walid Berrad
on 5/20/15, 4:10 PM 671 views

I want to add a text (legend) for the X-axis and the Y-axis in a graph in OpenERP 7. My model contains many fields that will be displayed each one in a separate graph. I tried to make some changes in "server\openerp\addons\web_graph\static\src\js\graph.js"  (as mentioned below) but this displays the same text for all fields. I'd like to add a custom text for each field (the name of the field for example), how can I do this ?

the code below display a condition for the model, i'd like to make a condition for the field in that model.


make_graph: function (mode, container, data) {
if (mode === 'area') { mode = 'line'; }
var format = this.get_format(this['options_' + mode](data));
/* The next if statement is made on the model tdb_moulin */
if (this.dataset.model == 'tdb_moulin')
{
format['xaxis']['title'] = 'name_of_field_in_x_axis';
format['yaxis']['title'] = 'name_of_field_in_y_axis';
}
return Flotr.draw(container, data.data, format);
},

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 5/20/15, 4:10 PM
Seen: 671 times
Last updated: 5/20/15, 4:10 PM