How set Italian date (day mounth year ) in the figure(.. x_axis_type='datetime',..)

I would like to be able to define a date in the Italian format (yyyy/mmdd)

p=figure(name=nomeOggetto,x_axis_type=‘datetime’,y_range=listaItemDistinct,
x_range=Range1d(dataFrame.Start_dt.min(),dataFrame.End_dt.max()),
tools=[hover,toolsDef])

KInd regards
Mauro

All of the scales of DatetimeTickFormatter can be configured using the format codes listed in the docs:

https://docs.bokeh.org/en/latest/docs/reference/models/formatters.html#bokeh.models.DatetimeTickFormatter

It seems like you’d want a format string like "%Y/%m%d"

Thanks YOU, this works very fine:
p.xaxis.formatter = DatetimeTickFormatter(microseconds = ‘%fus’
,milliseconds = ‘%3Nms’
,seconds = ‘%Ss’
,minsec = ‘:%M:%S’
,minutes = ‘:%M’
,hourmin = ‘%H:%M’
,hours = ‘%Hh’
,days = ‘%d/%b’
,months = ‘%b/%Y’
,years = ‘%Y’)
Only one things: the name of the mounths is in English, can I translate in Italian?
Kind regards
Mauro

1 Like

Bokeh uses the timezone library internally to process the format:

It appears that timezone might support different localizations. I am not sure if that support is always built-in or requires additional resource bundles to function. Either way, we could potentially expose the locale property and pass it to timezeone but that would be future development. I’d encourage you to open a GitHub Issue about it.

In the mean time, I think you would need to use CustomJSHover to format manually for now. (Note, if you try this route, that datetime axis values are represented as floating point milliseconds-since-epoch).

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.