javascript - Issue on Drawing Points(Circles) Along a Specific Line -


Can you please take a look at this example and tell me how I can get point value from an existing array Display this example as data [] and point as the dot on top of each row?

Then I have 5 element array:

  var data = [200, 20820, 32, 99 99955, 7580]; There are 5 lines in the form of   

and Line1, Line2, Line3, Line4, and Line5 , therefore the value for Line1 = 200 and the value of Line5 would be 7850. I know there are some things that are out of this thing like Highcharges. Jays but since I have a large number of units from Decimal for each line, I have to do a new rebirth.

  $ (function () {var c = document.getElementById ("myCanvas"); var ctx = c.getContext ("2d"); var data = [200, 20820, 32, 99 9955, 7580]; ctx.beginPath (); ctx.moveTo (200, 200); ctx.lineTo (200, 50); ctx.moveTo (200, 200); ctx.lineTo (342, 154); ctx. MoveTo (200, 200); ctx.lineTo (288, 321); ctx.moveTo (200, 200); ctx.lineTo (112, 321); ctx.moveTo (200, 200); ctx.lineTo (59, 154) Ctx.stroke (); ctx.font = "12px aerial"; ctx.fillText ("line 1", 185, 30); ctx.fillText ("line2", 360, 155); ctx.fillText (" Line 3 ", 300, 355); ctx.fillText (" row 4 ", 90, 355); ctx.fillText (" row5 ", 10, 155);});   

thanks

In which you move in the chart to the right, as prices increase.

A common example of the magnitude chart is the relator scale that measures the seismic activity.

Here is an example of the data value plotted on a charts rising from a magnitude of 10x for each color area on the chart.

A demo:

Enter image details here

Example Code:

  & lt ;; Doctype html & gt; & Lt; Html & gt; & Lt; Top & gt; & Lt; Link rel = "stylesheet" type = "text / css" media = "all" href = "css / reset.css" /> & Lt ;! - Reset CSS - & gt; & Lt; Style & gt; Body {background color: ivory; } Canvas {boundary: 1 px solid red;}  = 0; i -) {ctx.beginPath (); Ctx.moveTo (0150); Ctx.lineTo (XS [i], 150-A * 5); Ctx.lineTo (XS [i], 175 + i * 5); Ctx.lineTo (0175); Ctx.closePath (); Ctx.fillStyle = randomcolor (); Ctx.fill (); Ctx.stroke (); } Ctx.restore (); For (var i = 0; i <8; i ++) {ctx.beginPath (); Ctx.moveTo (XS [i], 180 + i * 5); Ctx.lineTo (XS [i], 190 + i * 5); Ctx.stroke (); Ctx.fillText (scale [i], xs [i], 200 + i * 5); } Plot (); Function plot () {for (var d = 0; d & lt; data.length; d ++) {var value = data [D]; N = 0; While (value / nScale [n]> 10) {n ++; } Var pct = value / nscale [n + 1]; Var x = parseInt (xs [n] + pct * scaleWidth); Ctx.beginPath (); Ctx.arc (x, 162,3,0, Math.PI * 2); Ctx.closePath (); Ctx.fillStyle = "black"; Ctx.fill (); Ctx.beginPath (); Ctx.moveTo (X, 162); Ctx.lineTo (X, 150-60-D * 15); Ctx.strokeStyle = "black"; Ctx.stroke (); Ctx.fillText (value, x + 5,150-54-D * 15); }} Function Random Collar () {Return ('#' + Math. Floor (Math.Rendam) * 16777215) .ststring (16)); }}; // End $ (function () {}); & Lt; / Script & gt; & Lt; / Head & gt; & Lt; Body & gt; & Lt; Canvas id = "canvas" width = 400 height = 300 & gt; & Lt; / Canvas & gt; & Lt; / Body & gt; & Lt; / Html & gt;    

Comments

Popular posts from this blog

ios - Adding an SKSpriteNode to SKScene from a child SKSpriteNode -

Matlab transpose a table vector -

c# - Textbox not clickable but editable -