How to create bokeh based HTML dashboard without appending data as JSON in it

Dear Experts, Please help me to develop my first bokeh based dashboard. I am able to export my plot layout to a HTML file. But it is appending the data itself in JSON format in the html. I don’t want that. I want the HTML web app to connect to the data from a csv file in a path without compromising data security. What am I doing wrong here.

code:

from bokeh.plotting import figure, output_file, show

# output to static HTML file
output_file(r'C:\Users\partha\example.html')


# prepare some data. I have the same data in path C:\Users\partha\data.csv

zone = ['north', 'south', 'east', 'west', 'others']
zone2 = [1,2,3,4,5]
spendcr = [ 6, 17, 2, 6, 0.30]

##### Plot-1 

# create a new plot with a title and axis labels

p = figure(plot_height=250,title="Zone wise Spend (Crore)", x_axis_label='Zone', y_axis_label='Spend(Cr)')

# add a line renderer with legend and line thickness. 
#Zone2 used as line plot was not taking caegorical x value

p.line(zone2,spendcr, legend_label="Spend", line_width=2, color='red')

show(p)

You need the FileInput widget. You cannot make a standalone HTML file load an arbitrary file by itself.

1 Like