How to create charts in bokeh with flask

Bokeh is an interactive visualization library for modern web browsers. It provides elegant, concise construction of versatile graphics, and affords high-performance interactivity over large or streaming dataset. Below are steps for creating charts with Bokeh and Flask.

  • Create directory with name "bokeh-app".
  • Inside "bokeh-app" create "templates" directory and "app.py" file.

  • Directory structure should be as shown below.
    bokeh-dir-structure

    Write below code in app.py

  • Create index.html inside templates directory and copy below below html.

  • Run the app.py and browser should display below response.


    bokeh-chart

    If browser does not display charts than check bokeh version and cdn links used in html for css and js. Use cdn urls compatible with the bokeh version.

    Categories: Python