4

I graph data as follows but I can't seem to get the axis labels to show:

!function ($) {
      var options = {
        xaxis: {
                    mode: "time",
                    min: start_time,
                    // max: (new Date()).getTime(),
                    tickSize: [4, "hour"],
                    tickLength: 0,
                    axisLabel: 'Day',
                    axisLabelUseCanvas: true,
                    axisLabelFontSizePixels: 12,
                    axisLabelFontFamily: 'Verdana, Arial, Helvetica, Tahoma, sans-serif',
                    axisLabelPadding: 3
        },
        yaxis: {
                    axisLabel: 'Amount',
                    axisLabelUseCanvas: true,
                    axisLabelFontSizePixels: 12,
                    axisLabelFontFamily: 'Verdana, Arial, Helvetica, Tahoma, sans-serif',
                    axisLabelPadding: 5
                },
      }
      $.plot($("#placeholder"), [open_emails],options);


    }(window.jQuery

I have included the following in my views and they are being loaded

//= require jquery.flot
//= require jquery.flot.symbol.min
//= require jquery.flot.axislabels

The result is as follows:

enter image description here

How can I get the labels to show?

4

1 に答える 1

7

Hiya working demo http://jsfiddle.net/wuALT/

So all you need is to add this:

<script type='text/javascript' src="https://raw.github.com/xuanluo/flot-axislabels/master/jquery.flot.axislabels.js"></script>

and rest code will start identifying the axisLabel.

Read: http://codenachos.com/view/axis-labels-in-flot was a known issue http://code.google.com/p/flot/issues/detail?id=42

This will help and see Day and Amount appearing in the X and Y axis now.

enter image description here

于 2012-05-17T09:19:15.623 に答える