Jump to content

Line plot on Canvas using Jquery slider


grabbitmedia
 Share

Recommended Posts

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("www.grabbitmedia.com");
var ctx=c.getContext("2d");
ctx.moveTo(a,50);
ctx.lineTo(b,0);
ctx.stroke();
}

Link to comment
Share on other sites

  • 3 weeks later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...