Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

multibyte characters in widgets are not working #3868

Closed
archiba opened this issue Aug 2, 2019 · 3 comments · Fixed by #3836
Closed

multibyte characters in widgets are not working #3868

archiba opened this issue Aug 2, 2019 · 3 comments · Fixed by #3836
Labels
type: bug Something isn't correct or isn't working
Milestone

Comments

@archiba
Copy link

archiba commented Aug 2, 2019

desired result:
スクリーンショット 2019-08-02 13 36 57
(Label in chart title is equal to one in selection box, and it is corresponding)

actual result:
スクリーンショット 2019-08-02 13 37 38

Now I'm facing two different problems:

  1. Nothing happened when I select item in selection box
  2. displayed character in selection box is garbled

To solve problem 1, I think you need to put ensure_ascii=False for json.dumps at L463 in holoviews/plotting/widgets/__init__.py

To solve second one, static_template at L64 in holoviews/plotting/renderer.py should be

static_template = """
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    {css}
    {js}
  </head>
  <body>
    {html}
  </body>
</html>
"""

My code is here:

import pandas
import holoviews
import bokeh
import hvplot.pandas

print('pandas', pandas.__version__)
print('holoviews', holoviews.__version__)
print('bokeh', bokeh.__version__)

holoviews.extension('bokeh')

df = pandas.DataFrame({
    'a': ['あ', 'あ', 'あ', 'あ', 'あ', 'い', 'い', 'い', 'い', 'う', 'う', 'う'],
    'b': [10, 11, 12, 11, 10, 20, 21, 22, 21, 31, 32, 31],
    'c': [0, 1, 2, 1, 0, 0, -1, -2, -1, 1, 2, 3]
})
line_plot_groupby = df.hvplot.line(x='c', y='b', groupby='a', dynamic=False)
renderer = holoviews.renderer('bokeh')
renderer.save(line_plot_groupby, 'line_plot_groupby')

pandas 0.25.0
holoviews 1.2.9.post67+g7dd50144
bokeh 1.3.1

@philippjfr philippjfr added the type: bug Something isn't correct or isn't working label Aug 2, 2019
@philippjfr
Copy link
Member

Thanks for the detailed bug report. Would you be willing to submit a PR for the fixes?

@philippjfr
Copy link
Member

Actually nevermind, the widgets are about to be replaced entirely.

@archiba
Copy link
Author

archiba commented Aug 8, 2019

Thanks for your reply.
I gave up submit PR for the fixes because it was really difficult to understand how my code should be tested.

Additionally, I think problem can be solved by two different approaches:

  1. fix python code to dump json
  2. fix javascript code to load json

I don't know which approach is better for holoviews. So I just put issue.

@philippjfr philippjfr added this to the v1.13.0 milestone Sep 22, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug Something isn't correct or isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants