Multiline strings in Bokeh Datatable - linebreaks getting stripped

Hi, I’m trying to show a table of strings using Bokeh (I’m already using bokeh plots within a vplot+tabs, and wanted a table of data also in the vplot).

My strings are multiline via having ‘\n’ characters, but when attempting to display these within a Bokeh DataTable the line breaks are stripped (see attached screenshot) Any way to avoid this?

Environment: Python 3.5, Jupyter 1.0 / Notebook 4.1.0, bokeh 0.11.1

Question is also on stackoverflow (http://stackoverflow.com/questions/35949219/bokeh-wont-show-string-linebreaks-in-datatable) and sample code is at https://github.com/seltzered/Bokeh-multiline-datatable-demo

Thanks in advance,

Vivek

Just a small update - I ended up deciding to just work within the bounds and just using color to group & differentiate things.

The issue doesn’t appear to be due to bokeh, it’s more of a limitation of slickgrid - there’s some workarounds / slickgrid forks posted out there for those really looking for a solution to have multitline grids, but haven’t seen anything officially merged in.

···

On Friday, March 11, 2016 at 12:33:57 PM UTC-8, Vivek Gani wrote:

Hi, I’m trying to show a table of strings using Bokeh (I’m already using bokeh plots within a vplot+tabs, and wanted a table of data also in the vplot).

My strings are multiline via having ‘\n’ characters, but when attempting to display these within a Bokeh DataTable the line breaks are stripped (see attached screenshot) Any way to avoid this?

Environment: Python 3.5, Jupyter 1.0 / Notebook 4.1.0, bokeh 0.11.1

Question is also on stackoverflow (http://stackoverflow.com/questions/35949219/bokeh-wont-show-string-linebreaks-in-datatable) and sample code is at https://github.com/seltzered/Bokeh-multiline-datatable-demo

Thanks in advance,

Vivek

Sorry for the slow response, I was going to say I think it is a SlickGrid limitation which is unfortunate. If you do (or did) find anything that seems like it might be a useful or workable workaround (or even a modification we could make to our vendored version of slickgrid) please don't hesitate to open a GH issue.

Thanks,

Bryan

···

On Mar 12, 2016, at 1:33 PM, Vivek Gani <[email protected]> wrote:

Just a small update - I ended up deciding to just work within the bounds and just using color to group & differentiate things.

The issue doesn't appear to be due to bokeh, it's more of a limitation of slickgrid - there's some workarounds / slickgrid forks posted out there for those really looking for a solution to have multitline grids, but haven't seen anything officially merged in.

On Friday, March 11, 2016 at 12:33:57 PM UTC-8, Vivek Gani wrote:
Hi, I'm trying to show a table of strings using Bokeh (I'm already using bokeh plots within a vplot+tabs, and wanted a table of data also in the vplot).

My strings are multiline via having '\n' characters, but when attempting to display these within a Bokeh DataTable the line breaks are stripped (see attached screenshot) Any way to avoid this?

Environment: Python 3.5, Jupyter 1.0 / Notebook 4.1.0, bokeh 0.11.1

Question is also on stackoverflow (http://stackoverflow.com/questions/35949219/bokeh-wont-show-string-linebreaks-in-datatable) and sample code is at https://github.com/seltzered/Bokeh-multiline-datatable-demo

Thanks in advance,

Vivek

--
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/59aaeb8a-1612-42cd-a8d2-6409f710d199%40continuum.io.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.

Hi Vivek

You might try the HTMLTemplateFormatter

https://github.com/bokeh/bokeh/blob/master/bokeh/models/widgets/tables.py#L198

You can supply a template that is any HTML as a template with slots for the values. An example from the docstring:

HTMLTemplateFormatter(template=’<%= value %>’)

You could try a pre tag to preserved the newlines.

Let me know how that goes. I added the HTMLTeamplateFormatter in order to support links and images in a DataTable, but it should work for arbitrary HTML formatting.

cheers,

Dennis

···

On Sat, Mar 12, 2016 at 12:15 PM Bryan Van de Ven [email protected] wrote:

Sorry for the slow response, I was going to say I think it is a SlickGrid limitation which is unfortunate. If you do (or did) find anything that seems like it might be a useful or workable workaround (or even a modification we could make to our vendored version of slickgrid) please don’t hesitate to open a GH issue.

Thanks,

Bryan

On Mar 12, 2016, at 1:33 PM, Vivek Gani [email protected] wrote:

Just a small update - I ended up deciding to just work within the bounds and just using color to group & differentiate things.

The issue doesn’t appear to be due to bokeh, it’s more of a limitation of slickgrid - there’s some workarounds / slickgrid forks posted out there for those really looking for a solution to have multitline grids, but haven’t seen anything officially merged in.

On Friday, March 11, 2016 at 12:33:57 PM UTC-8, Vivek Gani wrote:

Hi, I’m trying to show a table of strings using Bokeh (I’m already using bokeh plots within a vplot+tabs, and wanted a table of data also in the vplot).

My strings are multiline via having ‘\n’ characters, but when attempting to display these within a Bokeh DataTable the line breaks are stripped (see attached screenshot) Any way to avoid this?

Environment: Python 3.5, Jupyter 1.0 / Notebook 4.1.0, bokeh 0.11.1

Question is also on stackoverflow (http://stackoverflow.com/questions/35949219/bokeh-wont-show-string-linebreaks-in-datatable) and sample code is at https://github.com/seltzered/Bokeh-multiline-datatable-demo

Thanks in advance,

Vivek

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/59aaeb8a-1612-42cd-a8d2-6409f710d199%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/CA9E81C3-73F3-4A48-8AD4-ABD66506C9B6%40continuum.io.

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

I just tried using HTMLTemplateFormatter and it did not work. As Vivek points out in the SO post, this is a limitation of slickgrid which assumes uniform height of rows for performance reasons. This post describes the problem and several forks to address it. http://stackoverflow.com/questions/2805094/is-variable-rowheight-a-possibility-in-slickgrid

And some relevant issues in the slickgrid project:

https://github.com/mleibman/SlickGrid/issues/122

https://github.com/mleibman/SlickGrid/issues/506

https://github.com/mleibman/SlickGrid/pull/426

From what I understand, slickgrid does not plan on supporting variable or dynamic row heights. There are a few forks that do, but there are questions about performance, quality of implementation, and maintenance of these.

cheers,

Dennis

···

On Sun, Mar 13, 2016 at 11:14 AM Dennis O’Brien [email protected] wrote:

Hi Vivek

You might try the HTMLTemplateFormatter

https://github.com/bokeh/bokeh/blob/master/bokeh/models/widgets/tables.py#L198

You can supply a template that is any HTML as a template with slots for the values. An example from the docstring:

HTMLTemplateFormatter(template=’<%= value %>’)

You could try a pre tag to preserved the newlines.

Let me know how that goes. I added the HTMLTeamplateFormatter in order to support links and images in a DataTable, but it should work for arbitrary HTML formatting.

cheers,

Dennis

On Sat, Mar 12, 2016 at 12:15 PM Bryan Van de Ven [email protected] wrote:

Sorry for the slow response, I was going to say I think it is a SlickGrid limitation which is unfortunate. If you do (or did) find anything that seems like it might be a useful or workable workaround (or even a modification we could make to our vendored version of slickgrid) please don’t hesitate to open a GH issue.

Thanks,

Bryan

On Mar 12, 2016, at 1:33 PM, Vivek Gani [email protected] wrote:

Just a small update - I ended up deciding to just work within the bounds and just using color to group & differentiate things.

The issue doesn’t appear to be due to bokeh, it’s more of a limitation of slickgrid - there’s some workarounds / slickgrid forks posted out there for those really looking for a solution to have multitline grids, but haven’t seen anything officially merged in.

On Friday, March 11, 2016 at 12:33:57 PM UTC-8, Vivek Gani wrote:

Hi, I’m trying to show a table of strings using Bokeh (I’m already using bokeh plots within a vplot+tabs, and wanted a table of data also in the vplot).

My strings are multiline via having ‘\n’ characters, but when attempting to display these within a Bokeh DataTable the line breaks are stripped (see attached screenshot) Any way to avoid this?

Environment: Python 3.5, Jupyter 1.0 / Notebook 4.1.0, bokeh 0.11.1

Question is also on stackoverflow (http://stackoverflow.com/questions/35949219/bokeh-wont-show-string-linebreaks-in-datatable) and sample code is at https://github.com/seltzered/Bokeh-multiline-datatable-demo

Thanks in advance,

Vivek

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/59aaeb8a-1612-42cd-a8d2-6409f710d199%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/CA9E81C3-73F3-4A48-8AD4-ABD66506C9B6%40continuum.io.

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

Thanks for looking into this!

Yeah, slickgrid does some interesting things where it defines the offset for the subsequent rows (e.g. a second row has an offset of 25px, but it’d be something higher depending on the maximum number of lines evaluated on all the columns in the row above.). From my understanding it means supporting multiline could require some degree of precalculation aside from some other CSS hacks I saw.

···

On Sunday, March 13, 2016 at 2:17:13 PM UTC-7, Dennis O’Brien wrote:

I just tried using HTMLTemplateFormatter and it did not work. As Vivek points out in the SO post, this is a limitation of slickgrid which assumes uniform height of rows for performance reasons. This post describes the problem and several forks to address it. http://stackoverflow.com/questions/2805094/is-variable-rowheight-a-possibility-in-slickgrid

And some relevant issues in the slickgrid project:

https://github.com/mleibman/SlickGrid/issues/122

https://github.com/mleibman/SlickGrid/issues/506

https://github.com/mleibman/SlickGrid/pull/426

From what I understand, slickgrid does not plan on supporting variable or dynamic row heights. There are a few forks that do, but there are questions about performance, quality of implementation, and maintenance of these.

cheers,

Dennis

On Sun, Mar 13, 2016 at 11:14 AM Dennis O’Brien [email protected] wrote:

Hi Vivek

You might try the HTMLTemplateFormatter

https://github.com/bokeh/bokeh/blob/master/bokeh/models/widgets/tables.py#L198

You can supply a template that is any HTML as a template with slots for the values. An example from the docstring:

HTMLTemplateFormatter(template=’<%= value %>’)

You could try a pre tag to preserved the newlines.

Let me know how that goes. I added the HTMLTeamplateFormatter in order to support links and images in a DataTable, but it should work for arbitrary HTML formatting.

cheers,

Dennis

On Sat, Mar 12, 2016 at 12:15 PM Bryan Van de Ven [email protected] wrote:

Sorry for the slow response, I was going to say I think it is a SlickGrid limitation which is unfortunate. If you do (or did) find anything that seems like it might be a useful or workable workaround (or even a modification we could make to our vendored version of slickgrid) please don’t hesitate to open a GH issue.

Thanks,

Bryan

On Mar 12, 2016, at 1:33 PM, Vivek Gani [email protected] wrote:

Just a small update - I ended up deciding to just work within the bounds and just using color to group & differentiate things.

The issue doesn’t appear to be due to bokeh, it’s more of a limitation of slickgrid - there’s some workarounds / slickgrid forks posted out there for those really looking for a solution to have multitline grids, but haven’t seen anything officially merged in.

On Friday, March 11, 2016 at 12:33:57 PM UTC-8, Vivek Gani wrote:

Hi, I’m trying to show a table of strings using Bokeh (I’m already using bokeh plots within a vplot+tabs, and wanted a table of data also in the vplot).

My strings are multiline via having ‘\n’ characters, but when attempting to display these within a Bokeh DataTable the line breaks are stripped (see attached screenshot) Any way to avoid this?

Environment: Python 3.5, Jupyter 1.0 / Notebook 4.1.0, bokeh 0.11.1

Question is also on stackoverflow (http://stackoverflow.com/questions/35949219/bokeh-wont-show-string-linebreaks-in-datatable) and sample code is at https://github.com/seltzered/Bokeh-multiline-datatable-demo

Thanks in advance,

Vivek

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/59aaeb8a-1612-42cd-a8d2-6409f710d199%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/CA9E81C3-73F3-4A48-8AD4-ABD66506C9B6%40continuum.io.

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