我正在学习d3.我想用json数据制作折线图.我使用的数据是:
var data = [
{ "at": "2014-11-18T07:29:03.859Z", "value": 0.553292},
{ "at": "2014-11-18T07:28:53.859Z", "value": 0.563292},
{ "at": "2014-11-18T07:28:43.859Z", "value": 0.573292},
{ "at": "2014-11-18T07:28:33.859Z", "value": 0.583292},
{ "at": "2014-11-18T07:28:13.859Z", "value": 0.553292},
{ "at": "2014-11-18T07:28:03.859Z", "value": 0.563292}];
Run Code Online (Sandbox Code Playgroud)
我希望x轴上的"at"和y轴上的"value".另外,我需要解析"at"只作为时间.请指点我将如何进一步.到目前为止我已经实现的代码如下.我试图为此寻找文档,但没有找到.
<html>
<head>
<title>line chart on json</title>
<script src="http://d3js.org/d3.v2.js"></script>
<style>
/* tell the SVG path to be a thin blue line without any area fill */
path {
stroke: steelblue;
stroke-width: 1;
fill: none;
}
</style>
</head>
<body>
<script>
var width = 400;
var height …Run Code Online (Sandbox Code Playgroud) 我有一个int类型的排序数组.我想在java中获取第一个索引,其值大于O(1)中的目标.
例如:int arr [] = {1,4,7,9,15,30} target = 10我的函数应返回4,索引为15.