LoginSignup
0
1

Python-ganttのガントチャートの月表示変更

Posted at

いきさつ

Pythonでガントチャートを作る主流はどうもPlotlyらしく、Python-ganttモジュールについてはあまり情報がない。
にもかかわらず果敢に作成している(後日公開)途上だが、月表示がJanuary,February...とフルの英語表示なのは何とかして直したいと思い、インストールされたモジュールのgantt.pyを開いて月の書式を規定している部分を探した。

strftimeを探す

1722-1724行目にこんな項目があった。

# Month name
if jour.day == 1:
    vlines.add(svgwrite.text.Text('{0}'.format(jour.strftime("%B")),

この%Bというのを%m月に直したら、数字の月表示になった。

(変更後)

# Month name
    if jour.day == 1:
        vlines.add(svgwrite.text.Text('{0}'.format(jour.strftime("%m月")),

ほぼ同じ行が1745-1747あたりにもあるので、同じ様に変更する。

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1