How to use html5 Code to draw Line Chart
In this issue, the editor will bring you about how to use html5 code to draw a broken line diagram. The article is rich in content and analyzes and describes for you from a professional point of view. I hope you can get something after reading this article.
XML/HTML Code copies content to the clipboard
(function () {window.addEventListener ("load", function () {var data = [100dltel 1000je 0700]; / / get the context var a_canvas = document.getElementById ('astatcanvasa'); var context = a_canvas.getContext ("2d") / / draw the background var gradient = context.createLinearGradient (0re0 e0e0e0 0300); / / gradient.addColorStop (0, "# ffffff"); / / gradient.addColorStop (1, "# ffffff"); context.fillStyle = gradient; context.fillRect / / draw the border var grid_cols = data.length + 1; var grid_rows = 4; var cell_height = a_canvas.height / grid_rows; var cell_width = a_canvas.width / grid_cols; context.lineWidth = 1; context.strokeStyle = "# a0a0a0" / / end border drawing context.beginPath (); / / prepare to draw horizontal lines / * for (var col = 0; col)