3
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

amCharts4の月を数字にしたい&日本語化(vue3)

Last updated at Posted at 2021-03-24

参考リンク:
https://qiita.com/shogo452/items/d6d771a32d9225274e32
https://www.amcharts.com/docs/v4/concepts/locales/
https://github.com/amcharts/amcharts4/blob/master/src/lang/ja_JP.ts
上記の記事を参考にさせていただきました。🙏


この記事は
「月(month)」の日本語化について残しておこうという趣旨で書いています。

スクリーンショット 2021-03-24 22.53.32.png

#日本語化

vue.js
/* amChartインポート */
import * as am4core from "@amcharts/amcharts4/core";
import * as am4charts from "@amcharts/amcharts4/charts";
import am4themes_animated from "@amcharts/amcharts4/themes/animated";
am4core.useTheme(am4themes_animated);

/* amChart日本語化 */
import am4lang_ja_JP from "@amcharts/amcharts4/lang/ja_JP";

chart.dateFormatter.language = new am4core.Language(); //標準の翻訳設定
chart.dateFormatter.language.locale = am4lang_ja_JP; //標準の翻訳設定
chart.language.locale["_date_day"] = "M/dd"; // 独自ルールで上書き
chart.language.locale["_date_year"] = "yyyy"; // 独自ルールで上書き

#解説:月(month)の日本語化

vue.js
chart.language.locale["_date_day"] = "M/dd";

についてですが、
特に月(month)の日本語化で手間取りましたので
メモしておきます。

vue.js

chart.language.locale["_date_day"] = "M/dd"; // 3/21

chart.language.locale["_date_day"] = "MM/dd"; // 03/21

chart.language.locale["_date_day"] = "M月dd日"; // 3月21日

chart.language.locale["_date_day"] = "MMMdd"; // May21

amChartsの使い方については↓

vue3でamCharts4を使いたい→使えた
https://qiita.com/AyakoKataoka/items/e1aa99bc3a092700195e

3
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
3
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?