Json.dumps(json_item(plot, "myplot"))

is there javascript way to create json_item directly in javascript
( to Return a JSON block that can be used to embed standalone Bokeh content.)

in other word how to write this:

item_text = json.dumps(json_item(p, "myplot"))

in javascript ?

1 Like

No, there is not currently, and no one has ever asked about it before. Typically if someone is already using the BokehJS API then they just directly embed the JavaScript objects (e.g. by passing a Plot object to show). Can you explain why you want to convert the JS objects to JSON first? It’s possible there is a use-case that could motivate adding this as a new feature, but it’s also possible you are making things harder than they need to be :slight_smile: It’s not possible to know which without more information about why you want to do this.

Hi Bryan, thanks for the quick reply,
I need to create a bokeh chart base on uthe website user selection
at this moemnt i know

  1. to send a json like string to the embeded html widget and create the bokeh chart within the html base on the data that was recevied from the page code.

  2. the idea was to create the chart on the page code using bokeJS and then just send the json to be embeded directly to the div in the embded html and for that i will need to convert the plot to json format.

  3. the issue that the data source is very big and therefore i need to generate the chart after the user filter the data source


I’m sorry this is still too vague for me to understand. Are you trying to do some parts with the Python API, and other parts later with the BokehJS API? If the data is too large to send to the page, that seems to indicate that the filtering has to happen in Python? In that case why not use the Python APIs to generate the plot and json items?

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.