JSFiddle - React, Tailwind, and code Playground
by katsukino
HTML
<!DOCTYPE HTML>
<html>
<head>
<script>
window.onload = function () {
var chart = new CanvasJS.Chart("chartContainer", {
zoomEnabled:true,
zoomType:"xy",
title:{
text: ""
},
axisX:{
valueFormatString: "MM/DD HH:mm",
gridThickness: 1,
labelMaxWidth: 40,
labelAutoFit: !0,
interval: 1,
},
axisY:{
title: "水位(TPm)",
lineColor: "#C24642",
tickColor: "#C24642",
includeZero: true,
minimum:0,
maximum:20,
titleFontSize:12,
},
axisY2: [{
title: "10分雨量(mm)",
lineColor: "#7F6084",
tickColor: "#7F6084",
includeZero: true,
minimum:0,
maximum:50,
titleFontSize:12,
},
{
title: "累加雨量(mm)",
lineColor: "#369EAD",
tickColor: "#369EAD",
includeZero: true,
minimum:0,
maximum:200,
titleFontSize:12,
}],
toolTip: {
shared: true
},
legend: {
cursor: "pointer",
itemclick: toggleDataSeries
},
dataPointMaxWidth: 8,
data: [{
type:"column",
name: "10分雨量",
color: "#0000a6",
axisYType: "secondary",
axisYIndex: 0,
showInLegend: true,
dataPoints: [
{ x: new Date(2020, 01, 01), y: 05 },
{ x: new Date(2020, 01, 02), y: 06 },
{ x: new Date(2020, 01, 03), y: 10 },
{ x: new Date(2020, 01, 04), y: 06 },
{ x: new Date(2020, 01, 05), y: 05 },
{ x: new Date(2020, 01, 06), y: 02 },
{ x: new Date(2020, 01, 07), y: 00 },
{ x: new Date(2020, 01, 08), y: 00 },
{ x: new Date(2020, 01, 09), y: 01 },
{ x: new Date(2020, 01, 10), y: 03 },
{ x: new Date(2020, 01, 11), y: 05 },
{ x: new Date(2020, 01, 12), y: 00 }
]
},
{
type: "line",
name: "水位",
color: "#369EAD",
showInLegend: true,
markerSize: 7,
lineColor: "rgba(0,115,230,1)",
markerBorderColor: "rgba(0,115,230,1)",
markerBorderThickness: 2,
markerColor: "rgba(230, 242, 255,1)",
dataPoints: [
{ x: new Date(2020, 01, 01), y: 15.5 },
{ x: new Date(2020, 01, 02), y: 15.6 },
{ x: new Date(2020, 01, 03), y: 16.0 },
{ x: new Date(2020, 01, 04), y: 15.6 },
{ x: new Date(2020,...