[reportlab-users] Date format SimpleTimeSeriesPlot

Robin Becker robin at reportlab.com
Thu Aug 29 03:50:18 EDT 2019


On 28/08/2019 15:51, Maël JOURDAIN wrote:
> Hello Reportlab community,
> 
> I am using the class SimpleTimeSeriesPlot to create a graph.
> 
> I would like to change the date format on the X axis.
> 
> How can I set the date and the month in french ? Thank you for your help.
> 
> With the following command, I get the month in english :
> 
>          lc.xValueAxis.xLabelFormat = '{mmm}-{YY}'
> 
> 
> How can I set the date and the month in french ?
>
in my python 2.7 environment where utf8 is used I tried this

self.chart.xValueAxis.monthName  = '''Janvier Février Mars Avril Mai Juin Juillet
Aout Septembre Octobre Novembre Décembre'''.decode('utf8').split()

If you don't use unicode here then the truncation to first three characters goes wrong.

It might be better to use unicode directly eg

self.chart.xValueAxis.monthName  = [u'Janvier', u'F\xe9vrier', u'Mars', u'Avril', u'Mai', u'Juin', u'Juillet', u'Aout', 
u'Septembre', u'Octobre', u'Novembre', u'D\xe9cembre']

Unfortunately this is a global change so all NormalDate objects get these values. The NormalDate code is very old and 
probably needs a good deal of attention.

> Thank you for your help.
> 
> Best regards,
> 
> Mael
..........


-- 
Robin Becker


More information about the reportlab-users mailing list