Skip to content

Instantly share code, notes, and snippets.

@samuelcolvin
Created June 16, 2014 21:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save samuelcolvin/d3461b5983b126b2eeaf to your computer and use it in GitHub Desktop.
Save samuelcolvin/d3461b5983b126b2eeaf to your computer and use it in GitHub Desktop.
Bokeh Test
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<link rel="stylesheet" href="bokeh.css" type="text/css" />
<script type="text/javascript" src="bokeh.js"></script>
<script type="text/javascript">
$(function() {
var modelid = "0a489022-9c00-4c76-9b69-e540406cd9af";
var modeltype = "PlotContext";
var elementid = "d2526472-3248-44ce-874b-d20ca4c1f075";
console.log(" modeltype:", modeltype);
console.log(" modelid:", modelid);
console.log(" elementid:", elementid);
var all_models = [
{
"attributes":
{
"doc": "a247baf8-21d3-48e5-afa2-2b955979d430",
"id": "0a489022-9c00-4c76-9b69-e540406cd9af",
"children":
[
{
"id": "41e76603-92fe-45f3-b723-aa04c4db914c",
"type": "Plot"
}
]
},
"id": "0a489022-9c00-4c76-9b69-e540406cd9af",
"type": "PlotContext"
},
{
"attributes":
{
"ticker": null,
"doc": "a247baf8-21d3-48e5-afa2-2b955979d430",
"plot":
{
"id": "41e76603-92fe-45f3-b723-aa04c4db914c",
"type": "Plot"
},
"id": "73bd21dc-9abf-4613-89b4-0b7ea7c1876e",
"dimension": 0,
"formatter": null
},
"id": "73bd21dc-9abf-4613-89b4-0b7ea7c1876e",
"type": "LinearAxis"
},
{
"attributes":
{
"ticker": null,
"doc": "a247baf8-21d3-48e5-afa2-2b955979d430",
"plot":
{
"id": "41e76603-92fe-45f3-b723-aa04c4db914c",
"type": "Plot"
},
"id": "ca28be2e-bd30-4026-b309-12d8e8b40bc1",
"dimension": 1,
"formatter": null
},
"id": "ca28be2e-bd30-4026-b309-12d8e8b40bc1",
"type": "LinearAxis"
},
{
"attributes":
{
"selected": [],
"doc": "a247baf8-21d3-48e5-afa2-2b955979d430",
"cont_ranges": {},
"id": "873bee29-167d-4a25-9f1c-36d89af7f761",
"column_names":
[
"x",
"y"
],
"data":
{
"x":
[
1,
2,
3,
4,
5
],
"y":
[
1,
4,
9,
16,
25
]
},
"discrete_ranges": {}
},
"id": "873bee29-167d-4a25-9f1c-36d89af7f761",
"type": "ColumnDataSource"
},
{
"attributes":
{
"doc": "a247baf8-21d3-48e5-afa2-2b955979d430",
"id": "919cc23e-d803-4728-9d7e-593c7b0876c1",
"sources":
{
"source":
{
"id": "873bee29-167d-4a25-9f1c-36d89af7f761",
"type": "ColumnDataSource"
},
"columns":
[
"y"
]
}
},
"id": "919cc23e-d803-4728-9d7e-593c7b0876c1",
"type": "DataRange1d"
},
{
"attributes":
{
"doc": "a247baf8-21d3-48e5-afa2-2b955979d430",
"id": "ab175b5a-24e8-4a19-9d90-47c300bd1972",
"sources":
{
"source":
{
"id": "873bee29-167d-4a25-9f1c-36d89af7f761",
"type": "ColumnDataSource"
},
"columns":
[
"x"
]
}
},
"id": "ab175b5a-24e8-4a19-9d90-47c300bd1972",
"type": "DataRange1d"
},
{
"attributes":
{
"server_data_source": null,
"ydata_range":
{
"id": "919cc23e-d803-4728-9d7e-593c7b0876c1",
"type": "DataRange1d"
},
"xdata_range":
{
"id": "ab175b5a-24e8-4a19-9d90-47c300bd1972",
"type": "DataRange1d"
},
"doc": "a247baf8-21d3-48e5-afa2-2b955979d430",
"id": "47ed9883-945a-44b9-896f-a06d169767f6",
"glyphspec":
{
"line_width":
{
"units": "data",
"field": 2
},
"line_color":
{
"value": "blue"
},
"x":
{
"units": "data",
"field": "x"
},
"line_alpha":
{
"units": "data",
"field": 1.0
},
"type": "line",
"y":
{
"units": "data",
"field": "y"
}
},
"data_source":
{
"id": "873bee29-167d-4a25-9f1c-36d89af7f761",
"type": "ColumnDataSource"
}
},
"id": "47ed9883-945a-44b9-896f-a06d169767f6",
"type": "Glyph"
},
{
"attributes":
{
"doc": "a247baf8-21d3-48e5-afa2-2b955979d430",
"plot":
{
"id": "41e76603-92fe-45f3-b723-aa04c4db914c",
"type": "Plot"
},
"id": "dfb90c69-7fd1-426b-b689-712854a7f647",
"dimensions":
[
"width",
"height"
]
},
"id": "dfb90c69-7fd1-426b-b689-712854a7f647",
"type": "PanTool"
},
{
"attributes":
{
"canvas_height": 600,
"id": "41e76603-92fe-45f3-b723-aa04c4db914c",
"data_sources": [],
"canvas_width": 600,
"tools":
[
{
"id": "dfb90c69-7fd1-426b-b689-712854a7f647",
"type": "PanTool"
}
],
"outer_height": 600,
"renderers":
[
{
"id": "47ed9883-945a-44b9-896f-a06d169767f6",
"type": "Glyph"
},
{
"id": "73bd21dc-9abf-4613-89b4-0b7ea7c1876e",
"type": "LinearAxis"
},
{
"id": "ca28be2e-bd30-4026-b309-12d8e8b40bc1",
"type": "LinearAxis"
}
],
"x_range":
{
"id": "ab175b5a-24e8-4a19-9d90-47c300bd1972",
"type": "DataRange1d"
},
"doc": "a247baf8-21d3-48e5-afa2-2b955979d430",
"y_range":
{
"id": "919cc23e-d803-4728-9d7e-593c7b0876c1",
"type": "DataRange1d"
},
"outer_width": 600,
"title": "Bokeh Plot"
},
"id": "41e76603-92fe-45f3-b723-aa04c4db914c",
"type": "Plot"
}
]
;
Bokeh.load_models(all_models);
var model = Bokeh.Collections(modeltype).get(modelid);
var view = new model.default_view({model: model, el: "#d2526472-3248-44ce-874b-d20ca4c1f075"});
});
</script>
</head>
<body>
<div class="plotdiv" id="d2526472-3248-44ce-874b-d20ca4c1f075"></div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment