-
Notifications
You must be signed in to change notification settings - Fork 15
Closed
Labels
questionFurther information is requestedFurther information is requested
Description
Hi there,
Is it possible to provide an example of using this framework with plotLines
for the case where x
is a time series of datetime
from highcharts_core.chart import Chart
from highcharts_core.options.series.area import LineSeries
from highcharts_core.global_options.shared_options import SharedOptions
import pandas as pd
import datetime as dt
df = pd.DataFrame({'date':[dt.datetime(2023,1,1), dt.datetime(2023,1,2)], 'sales': [10,20]})
my_chart = Chart.from_pandas(df,
property_map = {
'x': 'date',
'y': 'sales',
},
series_type = 'line')
my_chart.options.title = {
'text': 'Ticker'
}
my_chart.options.subtitle = {
'text': 'Ticker'
}
my_chart.options.plot_options: {
'series': {
'marker': {
'enabled': False,
'radius': 5.5
}
}
}
my_chart.options.x_axis = {
'type': 'datetime',
'dateTimeLabelFormats': {
'month': '%e. %b',
'year': '%b'
},
'title': {
'text': 'Date'
},
'plotLines': [{
'color': '#FF0000',
'width': 2,
#'value': dt.datetime(2023,1,1) this fails with: CannotCoerceError: value (2023-01-01 00:00:00) is not a numeric type, was <class 'datetime.datetime'>
}]
}
my_chart.options.y_axis = {
'title': {
'text': 'Growth'
},
},
my_chart.display()
With the above, if I uncomment 'value': dt.datetime(2023,1,1)
I get CannotCoerceError: value (2023-01-01 00:00:00)
Your Environment:
- OS: Windows, Jupyter Lab (notebook).
- Python Version: 3.11
- Highcharts Version: Installed Highcharts Python using pip install highcharts-core command.
highcharts-core 1.1.1 pypi_0 pypi
Metadata
Metadata
Assignees
Labels
questionFurther information is requestedFurther information is requested