Patrice
Patrice

Reputation: 209

flot: show yaxis values

I can not show values for yaxis and I do not understand

I have the values for : data1 : 22, 000001115, 93, 0.000001137, 538, 0.000001003, 982, 0.000001004

my javascript function :

function Formatter(val, axis) {
 if ((val > 0.000001) && (val < 0.000002))  {

  return "<span >" +  val * 1000000  + "e-6</span>";
}
 else {
    return val.toFixed(axis.tickDecimals);
  }

}

the graph :

var placeholder = $("#flot-exemple-1");
 var options = {
    xaxis: {
        axisLabel: 'Temperature (C)',
        axisLabelUseCanvas: true,
        axisLabelFontSizePixels: 12,
        axisLabelFontFamily: 'verdana, sans-serif'
    },
    yaxis: {
        //scientific:TRUE,
        tickFormatter: Formatter,

edit: fiddle

Upvotes: 1

Views: 151

Answers (1)

Raidri
Raidri

Reputation: 17550

In your fiddle the second part of the formatter function is not executed because the first part is always executed. Change the first if-clause to

if ((val >= 0.004) && (val < 0.04))

and then the second will be executed for your example data. (See updated fiddle)

Upvotes: 1

Related Questions