This question has been flagged
1 Reply
3944 Views

How get the category value in Dashboard, when i clicking the show data button x value come as 0,1,2,... I want to replace the 0 by that product category name. see the attachment i want some values x axis.In x axis image has Category name but i cant get the value in the table.

Avatar
Discard
Best Answer

Default Dashboard show data x value come as 0,1,2,... from the below code:-

Folder: addons\web_graph\static\lib\flotr2\js\plugins\spreadsheet.js

Default OpenERP Code:-

function getRowLabel(value){
  if (this.options.spreadsheet.tickFormatter){
    //TODO maybe pass the xaxis formatter to the custom tick formatter as an opt-out?
    return this.options.spreadsheet.tickFormatter(value);
  }
  else {
    var t = _.find(this.axes.x.ticks, function(t){return t.v == value;});
    if (t) {
      return t.label;
    }
    return value; /* Default it shows 0, 1, 2 */
  }
}

Based on your requirement to change the below code in spreadsheet.js its shows Product Category Name in x-axis

function getRowLabel(value){
  if (this.options.spreadsheet.tickFormatter){
    //TODO maybe pass the xaxis formatter to the custom tick formatter as an opt-out?
    return this.options.spreadsheet.tickFormatter(value);
  }
  else {
    var t = _.find(this.axes.x.ticks, function(t){return t.v == value;});
    if (t) {
      return t.label;
    }
    return  this.options.xaxis.ticks[value][1]; /* It return x-axis value in Data Dashboard */
  }
}
Avatar
Discard
Author

Yes Yes... It is working... Thank You...