tdの上でいくつかの計算を実行した後、円を描画しようとしています。次のコードを実行すると、機能します。
$('#priority_one').width($('#learning_streams').width());
$('#priority_one').height($('#learning_streams').height());
var priority_one_paper = new Raphael('priority_one', $('#priority_one').width(), $('#priority_one').height());
var priority_one_circle = priority_one_paper.circle((pos.left).toFixed(0), (pos.top).toFixed(0), (width/2).toFixed(0));
priority_one_circle.attr('stroke','#000000');
しかし、動的にしようとすると(ユーザーの入力に応じてtdが変化します)、機能しなくなります。コード:
function circlePriorityOne() {
//priority_one is a div absolutely positioned over a table called learning_streams
//sets size of priority_one based off the table learning_streams
$('#priority_one').width($('#learning_streams').width());
$('#priority_one').height($('#learning_streams').height());
//creates the 'paper' to draw the circle on
var priority_one_paper = new Raphael('priority_one', $('#priority_one').width(), $('#priority_one').height());
var main = getMax(priority_one_count); //returns the id of the td to circle
var pos = $('#'+main).position();
var width = $('#'+main).width();
//using toFixed() to get rid of decimals
var priority_one_circle = priority_one_paper.circle((pos.left).toFixed(0), (pos.top).toFixed(0), (width/2).toFixed(0));
priority_one_circle.attr('stroke','#000000');
}
これに何か問題がありますか?ありがとう。