Re: Date format SimpleTimeSeriesPlot

Robin Becker <[email protected]>
Newsgroups gmane.comp.python.reportlab.user
Message-ID <[email protected]>
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
_______________________________________________
reportlab-users mailing list
[email protected]
https://pairlist2.pair.net/mailman/listinfo/reportlab-users
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.