Hello,
I am trying to generate a candlestick chart using BokehJS and have a problem with vbar glyph, more specifically, I get this error: “Uncaught TypeError: plot.vbar is not a function”. It works fine with a segment glyph. Any help is highly appreciated.
var width = 12151000;
var source = new Bokeh.ColumnDataSource({
data: { x: [Math.random()], o: [Math.random()],
h: [Math.random()], l: [Math.random()],
c: [Math.random()], w: width}
});
var tools = “pan,crosshair,wheel_zoom,box_zoom,reset”;
var plot = Bokeh.Plotting.figure({title:‘Example of Random data’,
x_axis_type:'datetime',
tools: tools, height: 300, width: 900});
var segment = plot.segment({field: “x”},
{field: "h"},
{field: "x"},
{field: "l"},
{source:source});
var vbar = plot.vbar({field: “x”},
{field: "w"},
{field: "o"},
{field: "c"},
{source:source});
Bokeh.Plotting.show(plot, document.getElementById(‘bk_plot’));
function getCandles(){
$.ajax({
type: "POST",
url: "/get_data",
contentType: 'application/json; charset=UTF-8',
success: function(response){
source.data.x = response.time;
source.data.o = response.o;
source.data.h = response.h;
source.data.l = response.l;
source.data.c = response.c;
source.trigger('change')
},
error: function(error){
console.log(error);
}
});
}
``