canvas
<style>
canvas {
border: 1px solid #ccc;
}
</style>
<canvas width="600" height="400"></canvas>
起步——start
<script>
var myCanvas = document.querySelector('canvas');
var ctx = myCanvas.getContext('2d');
var lineChart=function (ctx) {
this.ctx=ctx||document.querySelector('canvas').getContext('2d');
this.canvasWidth=this.ctx.canvas.width;
this.canvasHeight=this.ctx.canvas.height;
this.gridSize=10;
this.space=20;
this.arrowSize=10;
this.x0=this.space;
this.y0=this.canvasHeight-this.space;
this.dottedSize=6;
};
lineChart.prototype.init=function (data) {
this.drawGrid();
this.drawAxis();
this.drawDotted(data)