Returning strange 'BAD COLUMN NAME' error but still plotting

I am receiving a strange error with the following code:

from bokeh.plotting import output_file, show, curdoc, figure
from bokeh.models import ColumnDataSource as CDS

start, end = datetime(2018,3,16), datetime(2018,3,16,23,59)

class Chart:

def __init__(self):
    self.prices = CDS()
   
   
def make_one_data(self):  
    dts = [Timestamp('2017-01-01'), Timestamp('2017-01-02'), Timestamp('2017-01-03')]
    cls = [5,60,15]
    self.prices.data = dict(datetime = dts, close = cls)
   
   
def init_chart(self):
    self.chart=figure(x_axis_type="datetime",plot_width=900, height=200)
    self.chart.xaxis[0].ticker.desired_num_ticks=24

def chart_line(self):
    self.chart.line("datetime", "close", source = self.prices)
   
   
def make_one_chart(self):
    self.init_chart()
    self.chart_line()        

def test_Chart():
chart = Chart()
chart.make_one_data()
chart.make_one_chart()
return chart

``

chart = test_Chart()
show(chart.chart)

``

This still show the plot in an html windows, but I can see an error message E-1001 (BAD_COLUMN_NAME): Glyph refers to nonexistent column name: close, datetime [renderer: GlyphRenderer(id='36333382-dbaa-455e-be05-0e8b97e3f554', ...)] showing in the terminal

I have tried to isolate the problem but I am getting very confused.

Can anyone help me get rid of that error message?

Thanks a lot!

Vincent

Actually found the problem:

self.prices needs to be instantiated with self.prices = CDS({‘datetime’ : , ‘close’:})

···

Le mercredi 18 avril 2018 23:58:24 UTC+1, Vincent Konaté a écrit :

I am receiving a strange error with the following code:

from bokeh.plotting import output_file, show, curdoc, figure
from bokeh.models import ColumnDataSource as CDS

start, end = datetime(2018,3,16), datetime(2018,3,16,23,59)

class Chart:

def __init__(self):
    self.prices = CDS()
   
   
def make_one_data(self):  
    dts = [Timestamp('2017-01-01'), Timestamp('2017-01-02'), Timestamp('2017-01-03')]
    cls = [5,60,15]
    self.prices.data = dict(datetime = dts, close = cls)
   
   
def init_chart(self):
    self.chart=figure(x_axis_type="datetime",plot_width=900, height=200)
    self.chart.xaxis[0].ticker.desired_num_ticks=24


def chart_line(self):
    self.chart.line("datetime", "close", source = self.prices)
   
   
def make_one_chart(self):
    self.init_chart()
    self.chart_line()        

def test_Chart():
chart = Chart()
chart.make_one_data()
chart.make_one_chart()
return chart

``

chart = test_Chart()
show(chart.chart)

``

This still show the plot in an html windows, but I can see an error message E-1001 (BAD_COLUMN_NAME): Glyph refers to nonexistent column name: close, datetime [renderer: GlyphRenderer(id='36333382-dbaa-455e-be05-0e8b97e3f554', ...)] showing in the terminal

I have tried to isolate the problem but I am getting very confused.

Can anyone help me get rid of that error message?

Thanks a lot!

Vincent

Available column names used to be computed only at CDS init. But a recent PR made them a computed property, so that they are always reported correctly. I would not expect your original code to cause a warning with the next release.

Thanks,

Bryan

···

On Apr 18, 2018, at 16:34, Vincent Konaté <[email protected]> wrote:

Actually found the problem:

self.prices needs to be instantiated with self.prices = CDS({'datetime' : , 'close':})

Le mercredi 18 avril 2018 23:58:24 UTC+1, Vincent Konaté a écrit :
I am receiving a strange error with the following code:

from bokeh.plotting import output_file, show, curdoc, figure
from bokeh.models import ColumnDataSource as CDS

start, end = datetime(2018,3,16), datetime(2018,3,16,23,59)

class Chart:
    
    def __init__(self):
        self.prices = CDS()
        
    def make_one_data(self):
        dts = [Timestamp('2017-01-01'), Timestamp('2017-01-02'), Timestamp('2017-01-03')]
        cls = [5,60,15]
        self.prices.data = dict(datetime = dts, close = cls)
        
    def init_chart(self):
        self.chart=figure(x_axis_type="datetime",plot_width=900, height=200)
        self.chart.xaxis[0].ticker.desired_num_ticks=24

    def chart_line(self):
        self.chart.line("datetime", "close", source = self.prices)
        
    def make_one_chart(self):
        self.init_chart()
        self.chart_line()

def test_Chart():
    chart = Chart()
    chart.make_one_data()
    chart.make_one_chart()
    return chart

chart = test_Chart()
show(chart.chart)

This still show the plot in an html windows, but I can see an error message `E-1001 (BAD_COLUMN_NAME): Glyph refers to nonexistent column name: close, datetime [renderer: GlyphRenderer(id='36333382-dbaa-455e-be05-0e8b97e3f554', ...)]` showing in the terminal

I have tried to isolate the problem but I am getting very confused.

Can anyone help me get rid of that error message?

Thanks a lot!

Vincent

--
You received this message because you are subscribed to the Google Groups "Bokeh Discussion - Public" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/75b75899-69e2-4695-b27c-a7383c2a616e%40continuum.io\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.