0
   

Line plot on Canvas using Jquery slider

 
 
duddled
 
Reply Mon 8 Jul, 2013 06:43 pm
I am tying to use a jquery slider to plot a line on a canvas when I click a button. I dont know how and where to make the value from the slider a variable that changes with the slider, it just stays with the initial slider value.

$(function() {
$( "#slider" ).slider({
value:100,
min: 0,
max: 500,
step: 50,
slide: function( event, ui ) {
$( "#amount" ).val( "$" + ui.value );
}
});
$( "#amount" ).val( "$" + $( "#slider" ).slider( "value" ) );
a=$( "#slider" ).slider( "value" );
});

</script>
</head>

<body>
<script>

function myFunction()
{
var c=document.getElementById("myCanvas");
var ctx=c.getContext("2d");
ctx.moveTo(a,50);
ctx.lineTo(b,0);
ctx.stroke();
}
  • Topic Stats
  • Top Replies
  • Link to this Topic
Type: Question • Score: 0 • Views: 1,285 • Replies: 0
No top replies

 
 

Related Topics

 
  1. Forums
  2. » Line plot on Canvas using Jquery slider
Copyright © 2019 MadLab, LLC :: Terms of Service :: Privacy Policy :: Page generated in 0.16 seconds on 11/22/2019 at 03:11:01