Skip to content

Unexpected behaviour is_stock_chart = True #67

@R2boot3r

Description

@R2boot3r

Hello @hcpchris,

I wanted to open the issue as i have found what seems to be some strange behaviour with the is_stock_chart = True variable.

Here are 3 cases:

First case generates no issue:

import pandas as pd
import numpy as np
from highcharts_stock.chart import Chart

start_date = '2020-01-01'
end_date = '2024-01-01'
            
df = pd.DataFrame(pd.date_range(start = start_date, end = end_date))
df = df.rename(columns = {0: "date"} )
df['number'] = 1

#df['date'] = df['date'].astype(np.int64) // 10**6
chart.is_stock_chart = True
chart = Chart.from_pandas(df, series_type = 'line', property_map = {
                                 'x': 'date',
                                 'y': "number"
                             },
                          options_kwargs = chart_options )
#chart.is_stock_chart = True
chart.display() 

Second case generates an issue:

import pandas as pd
import numpy as np
from highcharts_stock.chart import Chart

start_date = '2020-01-01'
end_date = '2024-01-01'
            
df = pd.DataFrame(pd.date_range(start = start_date, end = end_date))
df = df.rename(columns = {0: "date"} )
df['number'] = 1

#df['date'] = df['date'].astype(np.int64) // 10**6
#chart.is_stock_chart = True
chart = Chart.from_pandas(df, series_type = 'line', property_map = {
                                 'x': 'date',
                                 'y': "number"
                             },
                          options_kwargs = chart_options )

chart.is_stock_chart = True
chart.display()

I get the following generic error:
Something went wrong with the Highcharts.js script. It should have been automatically loaded, but it did not load for over 5 seconds. Check your internet connection, and then if the problem persists please reach out for support. (You can also check your browser's console log for more details.)

Detailed Error Message:
x[p] is undefined

Third case no issue:

import pandas as pd
import numpy as np
from highcharts_stock.chart import Chart

start_date = '2020-01-01'
end_date = '2024-01-01'
            
df = pd.DataFrame(pd.date_range(start = start_date, end = end_date))
df = df.rename(columns = {0: "date"} )
df['number'] = 1

df['date'] = df['date'].astype(np.int64) // 10**6
#chart.is_stock_chart = True
chart = Chart.from_pandas(df, series_type = 'line', property_map = {
                                 'x': 'date',
                                 'y': "number"
                             },
                          options_kwargs = chart_options )

chart.is_stock_chart = True
chart.display()

I believe there might be some sort of edge case not delt correctly somewhere in the code.

Screenshot 2024-07-25 at 23 03 14

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions