我有一个像
<select id="sel1">
<option label="l1" value="1">Cool</option>
<option label="l2" value="2">Hot</option>
</select>
Run Code Online (Sandbox Code Playgroud)
现在我想在更改 jQuery 中所选项目的值时获取值应该是 Cool 还是 Hot。我正在尝试,querySource = $("#querySource").val();但这显示为1or 2。
怎么做?
如何在nvd3.js中创建日期格式 例如:
data1 = [{
"values": [{
"x": 1374561814000,
"y": 2
}],
"key": "x-axis"
}]
Run Code Online (Sandbox Code Playgroud)
1374561814000 这是什么意思,它是如何从约会转换的?
我使用nvd3.js来显示带有3个不同键的图形.在那些3,1中有这么多的坐标,其余的2 s只有一个坐标.现在这些单一的坐标是不正确的.我的代码是这样的:
nv.addGraph(function () {
var chart = nv.models.lineChart().margin({
top: 30,
right: 20,
bottom: 50,
left: 45
}).showLegend(true).tooltipContent(function (key, y, e, graph) {
return '<h3>' + key + '</h3>' + '<p>' + e + '% at ' + y + '</p>'
});
chart.xAxis.tickFormat(function (d) {
return d3.time.format('%x')(new Date(d))
});
d3.select('#lineChart svg')
.datum(data)
.transition().duration(500)
.call(chart);
nv.utils.windowResize(chart.update);
return chart;
});
data = [{
"values": [{
"x": 1025409600000 ,
"y": 2
}, {
"x": 1028088000000 ,
"y": 4
}, {
"x": 1030766400000 , …Run Code Online (Sandbox Code Playgroud)