0
0

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 1 year has passed since last update.

chartjs-subtitleを使ってみた

Last updated at Posted at 2023-06-13

チャートに付加情報を書き込みたいと思って探したらありました。

こんな感じになります。

filename(25).png

内容はjsonを読んで表示するようにしました。jsonは以下で作っています。

#!/bin/sh

sysinfo() {
# delete last piriod for jquery pasererror workaround
VAL=`ntpq -crv $1 | awk -F\" '/^v/{ver=$2};/^s/{sys=$2} END{print "{\"system\":\"" sys "\",\"version\":\"" ver "\"}"}'`
if [ -n "${VAL}" ]; then
  echo -n ${VAL} >> $2
fi
}

JSON="/root/htdocs/json/sysinfo.json"

echo -n "[" > ${JSON}
sysinfo 10.0.1.22 ${JSON}
echo -n "," >> ${JSON}
sysinfo 10.0.1.20 ${JSON}
echo -n "," >> ${JSON}
sysinfo 10.0.1.19 ${JSON}
echo -n "," >> ${JSON}
sysinfo 10.0.1.8 ${JSON}
echo -n "]" >> ${JSON}

chart.jsはv2を使っていて、新しいのは入っているのかもしれません。

0
0
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
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?