Notes
![]() ![]() Notes - notes.io |
<html lang="ja">
<head>
<meta charset="UTF-8">
<title>Chart.js Sample</title>
<script src="https://code.jquery.com/jquery-3.3.1.min.js" integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8="
crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.7.2/Chart.bundle.js"></script>
<!-- 参考URL:https://qiita.com/Haruka-Ogawa/items/59facd24f2a8bdb6d369 -->
<!-- 参考URL:https://misc.0o0o.org/chartjs-doc-ja/configuration/ -->
</head>
<body>
<!-- ↑↑↑◆領域無効化サンプル↑↑↑ -->
<!-- ↓↓↓◆グラフ種別サンプル↓↓↓ -->
<div style="width: 600px; height: 400px">
<h1>棒グラフ</h1>
<canvas id="myBarChart"></canvas>
<h1>折れ線グラフ</h1>
<canvas id="myLineChart"></canvas>
<h1>レーダーチャート</h1>
<canvas id="myRaderChart"></canvas>
<h1>相関グラフ(散布図)</h1>
<canvas id="myScatterChart"></canvas>
</div>
<!-- ↑↑↑◆グラフ種別サンプル↑↑↑ -->
</body>
<script>
/** ◆グラフ種別サンプル **/
// 色定義
let color_pink = "rgba(219,39,91,0.5)";
let color_green = "rgba(130,201,169,0.5)";
let color_orange = "rgba(255,183,76,0.5)";
// グラフ表示データ
this.chartData_ = {
// labels: 空間軸 =X軸
labels: ['メッシュA', 'メッシュB', 'メッシュC', 'メッシュD', 'メッシュE', 'メッシュF', 'メッシュG'],
datasets: [
// label: 品質項目 =凡例
// data : 空間軸ごとの品質値 =Y軸
{
label: '●●値',
data: [62, 65, 93, 85, 51, 66, 47],
backgroundColor: color_pink,
borderColor: color_pink,
fill: false, // not filling with background color
lineTension: 0, // draw straightline
}, {
label: '▲▲率',
data: [55, 45, 73, 75, 41, 45, 58],
backgroundColor: color_green,
borderColor: color_green,
fill: false, // not filling with background color
lineTension: 0, // draw straightline
}, {
label: '◆◆数',
data: [33, 45, 62, 55, 31, 45, 38],
backgroundColor: color_orange,
borderColor: color_orange,
fill: false, // not filling with background color
lineTension: 0, // draw straightline
}
]
};
// 棒グラフ
var ctxBar = document.getElementById("myBarChart");
var myBarChart = new Chart(ctxBar, {
type: 'bar',
data: this.chartData_,
options: {
title: {
display: true,
text: 'メッシュ集計'
},
scales: {
yAxes: [{
ticks: {
suggestedMin: 10,
suggestedMax: 120,
stepSize: 20,
callback: function (value, index, values) {
return value + ''
}
}
}]
},
}
});
// 折れ線グラフ
var ctxLine = document.getElementById("myLineChart");
var myLineChart = new Chart(ctxLine, {
type: 'line',
data: this.chartData_,
options: {
title: {
display: true,
text: 'メッシュ集計'
},
scales: {
yAxes: [{
ticks: {
suggestedMin: 0,
suggestedMax: 100,
stepSize: 10,
callback: function (value, index, values) {
return value + ''
}
}
}]
},
}
});
// レーダーチャート
var ctxRadar = document.getElementById("myRaderChart");
var myRadarChart = new Chart(ctxRadar, {
type: 'radar',
data: this.chartData_,
options: {
title: {
display: true,
text: 'メッシュ集計'
},
scale: {
ticks: {
suggestedMin: 0,
suggestedMax: 100,
stepSize: 10,
callback: function (value, index, values) {
return value + ''
}
}
}
}
});
// 相関グラフ(散布図)
var ctxScatter = document.getElementById("myScatterChart");
var myScatterChart = new Chart(ctxScatter, {
type: 'scatter',
data: this.chartData_,
data: {
datasets: [
// label: 空間軸 =凡例
// data : 空間軸ごとの{品質項目1, 品質項目2} ={X軸, Y軸}
{
label: 'メッシュA',
data: [{ x: 62, y: 47 }, { x: 65, y: 66 }, { x: 93, y: 51 }, { x: 85, y: 85 }, { x: 51, y: 93 }, { x: 66, y: 65 }, { x: 47, y: 62 }],
backgroundColor: color_pink,
},
{
label: 'メッシュB',
data: [{ x: 55, y: 58 }, { x: 45, y: 45 }, { x: 73, y: 41 }, { x: 75, y: 75 }, { x: 41, y: 73 }, { x: 45, y: 45 }, { x: 58, y: 55 }],
backgroundColor: color_green,
},
{
label: 'メッシュC',
data: [{ x: 33, y: 38 }, { x: 45, y: 45 }, { x: 62, y: 31 }, { x: 55, y: 55 }, { x: 38, y: 62 }, { x: 31, y: 45 }, { x: 45, y: 33 }],
backgroundColor: color_orange,
}
]
},
options: {
title: {
display: true,
text: '相関グラフ'
},
scales: {
xAxes: [{
scaleLabel: {
display: true,
labelString: '●●値'
},
ticks: {
suggestedMin: 0,
suggestedMax: 100,
stepSize: 10,
callback: function (value, index, values) {
return value + ''
}
}
}],
yAxes: [{
scaleLabel: {
display: true,
labelString: '▲▲率'
},
ticks: {
suggestedMin: 0,
suggestedMax: 100,
stepSize: 10,
callback: function (value, index, values) {
return value + ''
}
}
}]
}
}
});
</script>
</html>
![]() |
Notes is a web-based application for online taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000+ notes created and continuing...
With notes.io;
- * You can take a note from anywhere and any device with internet connection.
- * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
- * You can quickly share your contents without website, blog and e-mail.
- * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
- * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.
Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.
Easy: Notes.io doesn’t require installation. Just write and share note!
Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )
Free: Notes.io works for 14 years and has been free since the day it was started.
You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;
Email: [email protected]
Twitter: http://twitter.com/notesio
Instagram: http://instagram.com/notes.io
Facebook: http://facebook.com/notesio
Regards;
Notes.io Team