Update xaxis label in real time

68 views
Skip to first unread message

Chakir Mrabet

unread,
Jun 1, 2016, 10:51:59 AM6/1/16
to Flot graphs
I have a graph that can be samples or time based, the user can select one option clicking on a toolbar. When this happens, I update the plot object in setting the value of the new text to the xaxisLabel property of the X axis, however this doesn't seem to work. I'm using the axislabels pulgin. This is part of my code:

  if(this.flotPlot){
                this.flotPlot.getOptions().xaxis.xaxisLabel=xaxisLabel;                
                this.flotPlot.setData(this.dataArray);
                this.flotPlot.setupGrid();
                this.flotPlot.draw();
            }
            else {       
                this.flotPlot = $.plot(this.divSelector, this.dataArray, drawingOptions);
                this.initializeFlotPlot();
            }

Where xaxisLabel is calculated in another part of the code which is working since I've debugged in console.

Any ideas?

Ced

unread,
Jun 2, 2016, 12:33:06 AM6/2/16
to Flot graphs
Assuming you're using the flot-axislabels plugin found at https://github.com/markrcote/flot-axislabels.

Then the property you need to set is "axisLabel" and not "xaxisLabel"

Reply all
Reply to author
Forward
0 new messages