0

I am using Flot which is a Javascript charting framework. There's a property 'tickFormatter' which is defined by a function which defines the format of the tick's label for the x-axis (time). I am trying to see the value of 'date' during runtime. I set a breakpoint in Chrome and a logger. Neither the breakpoint gets hit, nor the console is showing the values. I know the function gets run because if I add a throw statement, I get an exception.

How do I display variable values in this type of function?

tickFormatter: function(v, axis)
          {
            var date = new Date(v);
            if (window.console) console.log("date: " + date);
            if (date.getSeconds() % 2 == 0)
              {
                var hours = date.getHours() < 10 ? "0" + date.getHours() : date.getHours();
                var minutes = date.getMinutes() < 10 ? "0" + date.getMinutes() : date.getMinutes();
                var seconds = date.getSeconds() < 10 ? "0" + date.getSeconds() : date.getSeconds();
                return minutes + ":" + seconds;
              }
            else
              {
                return "";
              }
          }

1 Answer 1

0

Well, if you are sure that the code gets executed, perhaps it's simply because you enabled filtering of the console messages. Make sure to select the option to show all console output. Also, I am not sure why a breakpoint set using the dev tools wouldn't work, but you can always try to put a breakpoint directly in the code by adding the debugger; statement.

3
  • I don't have filters on. 'debugger' doesn't do anything. Breakpoints inside regular functions work fine. Sep 5, 2013 at 18:31
  • @Tony_Henrich, Have you tried refreshing the page or simply close and restart the browser? How did you add the throw statement? Are you sure that you're getting the error that you are throwing in the console? If that's the case then I cannot help you as it seems to be an issue with the dev tools, but I am pretty sure that code simply isin't getting executed.
    – plalx
    Sep 5, 2013 at 18:40
  • It's my mistake. The function actually doesn't run like I thought! Sep 5, 2013 at 20:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.