1

我正在尝试使用滑块控制图表中条形的高度。这是基于此处找到的滑块示例。我在从滑块中获取值时遇到问题。我创建了一个 JSfiddle 来演示这一点

问题出在函数refeshGraph()中

function refreshGraph() {
var jan = $("slider1").slider("option","value"),
feb = $("slider2").slider("option","value"),
mar = $("slider3").slider("option","value"),
apr = $("slider4").slider("option","value"),
may = $("slider5").slider("option","value");

console.log(feb)

sliderData = new Array(
        [jan,'Jan','#222222'],
        [feb,'Feb','#7D252B'],
        [mar,'Mar','#EB9781'],
        [apr,'Apr','#FFD2B5'],
        [may,'May','#4A4147']
    );


$('.exampleSimpleColors').show();
$('#exampleSimple').html('');
$('#exampleSimple').jqbargraph({ data: sliderData});

}

我没有将值存储在变量中,而是得到了整个滑块对象。我知道这个 StackOverflow 帖子,其中 OP 有同样的问题。我试图应用答案,但没有成功。

4

1 回答 1

4

You forget # in slider declaration

in your code $("slider1").slider("option","value"),
but should be $("#slider1").slider("option","value"),

Fix that and It will work.

于 2013-02-01T19:38:31.717 回答