Nanoseconds datetime support?

Hi,

first of all, a big chunk of gratitude from my side for creating such awesome tool! Thanks :slight_smile:
Now to the question: I am plotting a profiling data of a program with a nanosecond tick resolution. Is it possible to modify datetime x axis scaling in such a way, so that nanoseconds are also supported? I really want to see some meaningful labels (like x µs, y ms) on bigger zoom levels, and not e.g 5.0e+6

Btw, is there a way to add interactive widgets (like checkboxes) without starting a server?

Thanks for the help!

Best Regards,

Artjom

I guess a “community” support means no support at all :slight_smile: Okay then.

···

On Friday, February 5, 2016 at 10:03:54 AM UTC+1, Artjom Kossow wrote:

Hi,

first of all, a big chunk of gratitude from my side for creating such awesome tool! Thanks :slight_smile:
Now to the question: I am plotting a profiling data of a program with a nanosecond tick resolution. Is it possible to modify datetime x axis scaling in such a way, so that nanoseconds are also supported? I really want to see some meaningful labels (like x µs, y ms) on bigger zoom levels, and not e.g 5.0e+6

Btw, is there a way to add interactive widgets (like checkboxes) without starting a server?

Thanks for the help!

Best Regards,

Artjom

Hi Artjom

This list sees a lot of questions and sometimes they get missed, so don’t take it personally. I think you would have a better chance of getting help if you provided a little more information about what you have already tried. Questions that include a reproducible code snippet tend to get more help because others can try it out.

I haven’t tried a chart with nanosecond resolution, but I’d suggest looking through the examples for applying formatters to axes.

Yes, interactive widgets can work without a server. Look for examples that use CustomJS.

http://bokeh.pydata.org/en/0.11.1/docs/user_guide/interaction.html#customjs-for-widgets

cheers

Dennis

···

On Wed, Feb 24, 2016, 12:16 AM Artjom Kossow [email protected] wrote:

I guess a “community” support means no support at all :slight_smile: Okay then.

On Friday, February 5, 2016 at 10:03:54 AM UTC+1, Artjom Kossow wrote:

Hi,

first of all, a big chunk of gratitude from my side for creating such awesome tool! Thanks :slight_smile:
Now to the question: I am plotting a profiling data of a program with a nanosecond tick resolution. Is it possible to modify datetime x axis scaling in such a way, so that nanoseconds are also supported? I really want to see some meaningful labels (like x µs, y ms) on bigger zoom levels, and not e.g 5.0e+6

Btw, is there a way to add interactive widgets (like checkboxes) without starting a server?

Thanks for the help!

Best Regards,

Artjom

–

You received this message because you are subscribed to the Google Groups “Bokeh Discussion - Public” group.

To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].

To post to this group, send email to [email protected].

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/2050b214-8714-4e46-bbaf-4555517b4a50%40continuum.io.

For more options, visit https://groups.google.com/a/continuum.io/d/optout.

Hi Artjom,

I'm sorry that you have not gotten a timely response to your question, and I empathize with how that can be frustrating. I very much want that every user gets their questions answered. But the reality right now is that sometimes there are more new users and questions than there are people and time to answer all of them. The Bokeh community is still fairly young, after all. But there are more and more people participating and answering questions now, though, so my hope is that we are nearing a "critical mass" where the number of people who feel confident enough to offer answers and support rises dramatically.

All that said, I'd just like to echo what Dennis said. The number one things that help me decide to jump in to a question are:

* detailed description of what is desired
* detailed description of what has been tried
* example code to get me started

And the reason is this: Even answering "quick" question can take 10 or 15 minutes (it takes time to go look through source code or docs to make sure I am speaking correctly, e.g.), If I have to try and create example code from scratch, that number can go up dramatically. There's only so many hours in the day. :slight_smile: But the main dis-incentive is if the problem is not fully specified. If I would have to guess at what you really want and need, then I risk being wrong, and going to all that time and effort to answer the wrong question!

For instance in your case, do you only need labels "around" the nanosecond scale, or do you need the entire current large scale set of tick labels PLUS nanosecond labels in addition? There are different possibilities depending on these kinds of details. In the former case, you might get away easily with by pre-scaling your data and using PrintfTickFormatter. In the latter case, we'd probably need to look at extending the existing DatetimeTickFormatter here:

  https://github.com/bokeh/bokeh/blob/master/bokehjs/src/coffee/models/formatters/datetime_tick_formatter.coffee

Or equivalently (and probably more quickly for a general user) creating a custom TickFormatter model to suit your needs. There are already some examples of custom TickFormatters that you could look at immediately to get you started, for example:

  https://github.com/bokeh/bokeh/blob/master/examples/plotting/file/custom_datetime_axis.py

Regards,

Bryan

···

On Feb 24, 2016, at 2:16 AM, Artjom Kossow <[email protected]> wrote:

I guess a "community" support means no support at all :slight_smile: Okay then.

On Friday, February 5, 2016 at 10:03:54 AM UTC+1, Artjom Kossow wrote:
Hi,

first of all, a big chunk of gratitude from my side for creating such awesome tool! Thanks :slight_smile:
Now to the question: I am plotting a profiling data of a program with a nanosecond tick resolution. Is it possible to modify datetime x axis scaling in such a way, so that nanoseconds are also supported? I really want to see some meaningful labels (like x µs, y ms) on bigger zoom levels, and not e.g 5.0e+6
Btw, is there a way to add interactive widgets (like checkboxes) without starting a server?

Thanks for the help!

Best Regards,
Artjom

--
You received this message because you are subscribed to the Google Groups "Bokeh Discussion - Public" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/2050b214-8714-4e46-bbaf-4555517b4a50%40continuum.io\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.

As pertains to nanosecond ticking, I think that one of the challenges is that the JS library we use for tick formatting does not support nanosecond resolution:

https://github.com/bokeh/bokeh/issues/3580#issuecomment-188271191

(Not sure why that library doesn’t support NS - perhaps related to JS numerical precision? But it’s float64 so that doesn’t seem like it should be a problem…)

However, you can work around this problem with a bit of a hack, where you just multiply your time values by 1000, and then override the “microseconds” formatter to render as “%f ns”… Of course you’d have to also override all the formatters above it to be shifted by a factor of a thousand as well. That should be fine in most circumstances.

-Peter

···

On Wed, Feb 24, 2016 at 9:01 AM, Bryan Van de Ven [email protected] wrote:

Hi Artjom,

I’m sorry that you have not gotten a timely response to your question, and I empathize with how that can be frustrating. I very much want that every user gets their questions answered. But the reality right now is that sometimes there are more new users and questions than there are people and time to answer all of them. The Bokeh community is still fairly young, after all. But there are more and more people participating and answering questions now, though, so my hope is that we are nearing a “critical mass” where the number of people who feel confident enough to offer answers and support rises dramatically.

All that said, I’d just like to echo what Dennis said. The number one things that help me decide to jump in to a question are:

  • detailed description of what is desired

  • detailed description of what has been tried

  • example code to get me started

And the reason is this: Even answering “quick” question can take 10 or 15 minutes (it takes time to go look through source code or docs to make sure I am speaking correctly, e.g.), If I have to try and create example code from scratch, that number can go up dramatically. There’s only so many hours in the day. :slight_smile: But the main dis-incentive is if the problem is not fully specified. If I would have to guess at what you really want and need, then I risk being wrong, and going to all that time and effort to answer the wrong question!

For instance in your case, do you only need labels “around” the nanosecond scale, or do you need the entire current large scale set of tick labels PLUS nanosecond labels in addition? There are different possibilities depending on these kinds of details. In the former case, you might get away easily with by pre-scaling your data and using PrintfTickFormatter. In the latter case, we’d probably need to look at extending the existing DatetimeTickFormatter here:

    [https://github.com/bokeh/bokeh/blob/master/bokehjs/src/coffee/models/formatters/datetime_tick_formatter.coffee](https://github.com/bokeh/bokeh/blob/master/bokehjs/src/coffee/models/formatters/datetime_tick_formatter.coffee)

Or equivalently (and probably more quickly for a general user) creating a custom TickFormatter model to suit your needs. There are already some examples of custom TickFormatters that you could look at immediately to get you started, for example:

    [https://github.com/bokeh/bokeh/blob/master/examples/plotting/file/custom_datetime_axis.py](https://github.com/bokeh/bokeh/blob/master/examples/plotting/file/custom_datetime_axis.py)

Regards,

Bryan

On Feb 24, 2016, at 2:16 AM, Artjom Kossow [email protected] wrote:

I guess a “community” support means no support at all :slight_smile: Okay then.

On Friday, February 5, 2016 at 10:03:54 AM UTC+1, Artjom Kossow wrote:

Hi,

first of all, a big chunk of gratitude from my side for creating such awesome tool! Thanks :slight_smile:

Now to the question: I am plotting a profiling data of a program with a nanosecond tick resolution. Is it possible to modify datetime x axis scaling in such a way, so that nanoseconds are also supported? I really want to see some meaningful labels (like x µs, y ms) on bigger zoom levels, and not e.g 5.0e+6

Btw, is there a way to add interactive widgets (like checkboxes) without starting a server?

Thanks for the help!

Best Regards,

Artjom

–

You received this message because you are subscribed to the Google Groups “Bokeh Discussion - Public” group.

To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].

To post to this group, send email to [email protected].

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/2050b214-8714-4e46-bbaf-4555517b4a50%40continuum.io.

For more options, visit https://groups.google.com/a/continuum.io/d/optout.

–

You received this message because you are subscribed to the Google Groups “Bokeh Discussion - Public” group.

To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].

To post to this group, send email to [email protected].

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/751B6653-43B6-4D13-AEBB-F421F5B650D6%40continuum.io.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.

–

Peter Wang

CTO, Co-founder

Hi everyone,
thanks for replies. Sorry for such a harsh comment before, I guess I should have just “bumped” the question and thats it :slight_smile:
Now to the issue with datetime:
I guess, it must not be a datetime after all, as I just want to display a value (seconds) with a proper scaling of its 10th power (n,µ,m, k, M, G), so that 0.0003123 is formatted to 3.1 µs or maybe even 3123 ns, depending on resolution. I tried NumeralTickFormatter, with "0.0a" but it does not seem to work (it only scales to kilo and mega), and also I can't output "s" to that.
`PrintfTickFormatter can output any additional characters you want, but has no scaling options, only option of scientific notation.
So I thought I could try and write my own formatter, but I couldn’t find any extensive documentation on your JS api and object model, and examples were not enough. Is there a tutorial for your JS client api?
Which leads us to interactive widgets: there is not much documentation on how to use customJS, only few examples, which give you no idea what is available to you at “js run time”, which objects are there, what properties do they have and how to manipulate them.

So, I went the other way and start a python server now, but there is, again, not enough docs to make it clear what you need to do to trigger updates. Code snippet:

   p.quad(name="main", top="tops", bottom="bottoms", left="lefts",right="rights", color="colors", alpha=0.8, source=msource)
   .....
    def __chkhandle(active):
        print("TEST",active) #just to see if it works
        p.select(name="main")[0].glyph.visible = False
    ....
    checkbox_group.on_click(__chkhandle);
`

This code tries to select a quad group named “main” and hide it. If you run the “…glyph.visibble = False” before you make your first draw, the object will not be drawn. So, there should be some way to either trigger a full redraw, or an update… Again, no luck in docs for me :confused:

Best Regards,
Artjom

···

On Wednesday, February 24, 2016 at 6:01:37 PM UTC+1, Bryan Van de ven wrote:

Hi Artjom,

I’m sorry that you have not gotten a timely response to your question, and I empathize with how that can be frustrating. I very much want that every user gets their questions answered. But the reality right now is that sometimes there are more new users and questions than there are people and time to answer all of them. The Bokeh community is still fairly young, after all. But there are more and more people participating and answering questions now, though, so my hope is that we are nearing a “critical mass” where the number of people who feel confident enough to offer answers and support rises dramatically.

All that said, I’d just like to echo what Dennis said. The number one things that help me decide to jump in to a question are:

  • detailed description of what is desired

  • detailed description of what has been tried

  • example code to get me started

And the reason is this: Even answering “quick” question can take 10 or 15 minutes (it takes time to go look through source code or docs to make sure I am speaking correctly, e.g.), If I have to try and create example code from scratch, that number can go up dramatically. There’s only so many hours in the day. :slight_smile: But the main dis-incentive is if the problem is not fully specified. If I would have to guess at what you really want and need, then I risk being wrong, and going to all that time and effort to answer the wrong question!

For instance in your case, do you only need labels “around” the nanosecond scale, or do you need the entire current large scale set of tick labels PLUS nanosecond labels in addition? There are different possibilities depending on these kinds of details. In the former case, you might get away easily with by pre-scaling your data and using PrintfTickFormatter. In the latter case, we’d probably need to look at extending the existing DatetimeTickFormatter here:

    [https://github.com/bokeh/bokeh/blob/master/bokehjs/src/coffee/models/formatters/datetime_tick_formatter.coffee](https://github.com/bokeh/bokeh/blob/master/bokehjs/src/coffee/models/formatters/datetime_tick_formatter.coffee)

Or equivalently (and probably more quickly for a general user) creating a custom TickFormatter model to suit your needs. There are already some examples of custom TickFormatters that you could look at immediately to get you started, for example:

    [https://github.com/bokeh/bokeh/blob/master/examples/plotting/file/custom_datetime_axis.py](https://github.com/bokeh/bokeh/blob/master/examples/plotting/file/custom_datetime_axis.py)

Regards,

Bryan

On Feb 24, 2016, at 2:16 AM, Artjom Kossow [email protected] wrote:

I guess a “community” support means no support at all :slight_smile: Okay then.

On Friday, February 5, 2016 at 10:03:54 AM UTC+1, Artjom Kossow wrote:

Hi,

first of all, a big chunk of gratitude from my side for creating such awesome tool! Thanks :slight_smile:
Now to the question: I am plotting a profiling data of a program with a nanosecond tick resolution. Is it possible to modify datetime x axis scaling in such a way, so that nanoseconds are also supported? I really want to see some meaningful labels (like x µs, y ms) on bigger zoom levels, and not e.g 5.0e+6

Btw, is there a way to add interactive widgets (like checkboxes) without starting a server?

Thanks for the help!

Best Regards,

Artjom

–
You received this message because you are subscribed to the Google Groups “Bokeh Discussion - Public” group.

To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].

To post to this group, send email to [email protected].

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/2050b214-8714-4e46-bbaf-4555517b4a50%40continuum.io.

For more options, visit https://groups.google.com/a/continuum.io/d/optout.

I just wanted to say that a proper JS API (basically a port of bokeh.plotting to JavaScript) has recently become a priority, and I intend to make a thorough documentation pass regarding the JS API as well as what's typical in a "custom model" implementation as part of that work.

I will say though that the Bokeh models and JS models are basically 1-1 in terms of available properties. So any property you can see in the python reference guide is available to the JS side. They are Backbone models, so if there is a property "scale" on a python bokeh model, then in JS you'd access it with
  
  .get('scale')

and

  .set('scale', 1000)

Regarding *server* apps, you typically never need to trigger anything. The server's main and primary purpose is to automatically keep the python and JS models in sync automatically, and to call and change handlers (on the python side) if anything changes. That said there may be some "plumbing" issues around glyphs specifically that cause updates/re-renders not to happen. For instance, I think your code below ought to work, so if it does not can you open a bug report on GH issues with an example?

Thanks,

Bryan

···

On Feb 25, 2016, at 3:48 AM, Artjom Kossow <[email protected]> wrote:

Hi everyone,

thanks for replies. Sorry for such a harsh comment before, I guess I should have just "bumped" the question and thats it :slight_smile:
Now to the issue with datetime:
I guess, it must not be a datetime after all, as I just want to display a value (seconds) with a proper scaling of its 10th power (n,µ,m, k, M, G), so that 0.0003123 is formatted to 3.1 µs or maybe even 3123 ns, depending on resolution. I tried NumeralTickFormatter, with "0.0a" but it does not seem to work (it only scales to kilo and mega), and also I can't output "s" to that.
PrintfTickFormatter can output any additional characters you want, but has no scaling options, only option of scientific notation.
So I thought I could try and write my own formatter, but I couldn't find any extensive documentation on your JS api and object model, and examples were not enough. Is there a tutorial for your JS client api?
Which leads us to interactive widgets: there is not much documentation on how to use customJS, only few examples, which give you no idea what is available to you at "js run time", which objects are there, what properties do they have and how to manipulate them.

So, I went the other way and start a python server now, but there is, again, not enough docs to make it clear what you need to do to trigger updates. Code snippet:

       p.quad(name="main", top="tops", bottom="bottoms", left="lefts",right="rights", color="colors", alpha=0.8, source=msource)
       .....
        def __chkhandle(active):
            print("TEST",active) #just to see if it works
            p.select(name="main")[0].glyph.visible = False
        ....
        checkbox_group.on_click(__chkhandle);
    
This code tries to select a quad group named "main" and hide it. If you run the "..glyph.visibble = False" before you make your first draw, the object will not be drawn. So, there should be some way to either trigger a full redraw, or an update... Again, no luck in docs for me :confused:

Best Regards,
Artjom

On Wednesday, February 24, 2016 at 6:01:37 PM UTC+1, Bryan Van de ven wrote:
Hi Artjom,

I'm sorry that you have not gotten a timely response to your question, and I empathize with how that can be frustrating. I very much want that every user gets their questions answered. But the reality right now is that sometimes there are more new users and questions than there are people and time to answer all of them. The Bokeh community is still fairly young, after all. But there are more and more people participating and answering questions now, though, so my hope is that we are nearing a "critical mass" where the number of people who feel confident enough to offer answers and support rises dramatically.

All that said, I'd just like to echo what Dennis said. The number one things that help me decide to jump in to a question are:

* detailed description of what is desired
* detailed description of what has been tried
* example code to get me started

And the reason is this: Even answering "quick" question can take 10 or 15 minutes (it takes time to go look through source code or docs to make sure I am speaking correctly, e.g.), If I have to try and create example code from scratch, that number can go up dramatically. There's only so many hours in the day. :slight_smile: But the main dis-incentive is if the problem is not fully specified. If I would have to guess at what you really want and need, then I risk being wrong, and going to all that time and effort to answer the wrong question!

For instance in your case, do you only need labels "around" the nanosecond scale, or do you need the entire current large scale set of tick labels PLUS nanosecond labels in addition? There are different possibilities depending on these kinds of details. In the former case, you might get away easily with by pre-scaling your data and using PrintfTickFormatter. In the latter case, we'd probably need to look at extending the existing DatetimeTickFormatter here:

        https://github.com/bokeh/bokeh/blob/master/bokehjs/src/coffee/models/formatters/datetime_tick_formatter.coffee

Or equivalently (and probably more quickly for a general user) creating a custom TickFormatter model to suit your needs. There are already some examples of custom TickFormatters that you could look at immediately to get you started, for example:

        https://github.com/bokeh/bokeh/blob/master/examples/plotting/file/custom_datetime_axis.py

Regards,

Bryan

> On Feb 24, 2016, at 2:16 AM, Artjom Kossow <[email protected]> wrote:
>
> I guess a "community" support means no support at all :slight_smile: Okay then.
>
> On Friday, February 5, 2016 at 10:03:54 AM UTC+1, Artjom Kossow wrote:
> Hi,
>
> first of all, a big chunk of gratitude from my side for creating such awesome tool! Thanks :slight_smile:
> Now to the question: I am plotting a profiling data of a program with a nanosecond tick resolution. Is it possible to modify datetime x axis scaling in such a way, so that nanoseconds are also supported? I really want to see some meaningful labels (like x µs, y ms) on bigger zoom levels, and not e.g 5.0e+6
> Btw, is there a way to add interactive widgets (like checkboxes) without starting a server?
>
> Thanks for the help!
>
> Best Regards,
> Artjom
>
> --
> You received this message because you are subscribed to the Google Groups "Bokeh Discussion - Public" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to bokeh+un...@continuum.io.
> To post to this group, send email to bo...@continuum.io.
> To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/2050b214-8714-4e46-bbaf-4555517b4a50%40continuum.io\.
> For more options, visit https://groups.google.com/a/continuum.io/d/optout\.

--
You received this message because you are subscribed to the Google Groups "Bokeh Discussion - Public" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/1265c362-a547-4f17-8c85-12c7bd3434ce%40continuum.io\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.