我正在寻找一种非常快速,干净和有效的方法来获取以下JSON切片中的最大"y"值:
[
{
"x": "8/11/2009",
"y": 0.026572007
},
{
"x": "8/12/2009",
"y": 0.025057454
},
{
"x": "8/13/2009",
"y": 0.024530916
},
{
"x": "8/14/2009",
"y": 0.031004457
}
]
Run Code Online (Sandbox Code Playgroud)
for循环是唯一可行的方法吗?我热衷于某种方式使用Math.max.
更新时间2017年6月2日:我们解决了问题,但没有解决这里的答案.如果我发现它,我会尝试添加我们的解决方案.我们还切换到了angular-nvd3哪些用途d3.
编辑1:backgroundColor在选项中添加,仍然无法正常工作.不确定我是否把它放在正确的位置.
在这里使用示例.如何使颜色填充100%?
JS:
$scope.labels = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday'];
$scope.type = 'StackedBar';
$scope.series = ['2015', '2016'];
//$scope.colors = ['#AA1921', '#18AF5C'];
$scope.options = {
scales: {
xAxes: [{
stacked: true,
}],
yAxes: [{
stacked: true
}]
},
title: {
display: true,
text: 'My First Bar Chart'
},
// added as suggested
backgroundColor: ['rgba(170, 25, 33, 1)', 'rgba(170, 25, 33, 1)']
};
$scope.data = [
[65, 59, 90, …Run Code Online (Sandbox Code Playgroud) 我有两个数组。我想将它们合并到同一个键 AND 值上。如果它们相同,ur_user_id则将它们合并。array2只为 提供一些额外的数据array1,所以new_array.length= array1.length。array1只是从array2.
$array1 =
array(
array('ur_user_id'=> 1,'ur_fname'=>'PerA','ur_lname'=>'SonA'),
array('ur_user_id'=> 2,'ur_fname'=>'PerB','ur_lname'=>'SonB'),
array('ur_user_id'=> 3,'ur_fname'=>'PerC','ur_lname'=>'SonC'),
);
$array2 =
array(
array('ur_user_id' => 5,'ur_code' => 'EE','ur_user_role' => 'testE'),
array('ur_user_id' => 4,'ur_code' => 'DD','ur_user_role' => 'testD'),
array('ur_user_id' => 6,'ur_code' => 'FF','ur_user_role' => 'testF'),
array('ur_user_id' => 3,'ur_code' => 'CC','ur_user_role' => 'testC'),
array('ur_user_id' => 1,'ur_code' => 'AA','ur_user_role' => 'testA'),
array('ur_user_id' => 2,'ur_code' => 'BB','ur_user_role' => 'testB'),
);
Run Code Online (Sandbox Code Playgroud)
那么新数组必须如下所示。这将有两个从价值观array1和array2。
$new_array …Run Code Online (Sandbox Code Playgroud) 我们的应用程序下载了一个zip文件,但响应是二进制的.
所以我做的是将其转换为base64.它适用于大小87.7KB但响应大小为时发生错误183KB.
错误是 Uncaught RangeError: Maximum call stack size exceeded
这条线是
btoa(String.fromCharCode.apply(null, new Uint8Array(blob)))
Run Code Online (Sandbox Code Playgroud)
根据这个答案,String.fromCharCode.apply()必须更换TextEncoder.
所以我改成了
btoa(new TextDecoder('utf-8').decode(new Uint8Array(blob)))
Run Code Online (Sandbox Code Playgroud)
但是我收到了一个错误.
Uncaught DOMException: Failed to execute 'btoa' on 'Window': The string to be encoded contains characters outside of the Latin1 range.
我使用此答案的最顶部片段再次更改了它
新代码现在
btoa(unescape(encodeURIComponent(new TextDecoder('utf-8').decode(new Uint8Array(blob)))))
Run Code Online (Sandbox Code Playgroud)
下载现在可以使用,但下载zip文件已损坏.
整个代码可以在这里看到
\n\n\n当完成的功能和修复已准备好发布时,它们会合并回开发分支
\n
据我了解,这意味着当开发人员对自己的工作充满信心时,功能就会被合并以进行开发。
\n\n\n\n\n当需要发布版本时,会从开发中创建发布分支
\n
在这条线上,开发分支中的功能预计将被发布。
\n\n以上一切都很好,直到某个功能被 QA 测试确定尚未“准备好”发布,或者可能快到了该功能可以移至下一个版本的发布日期。
\n\n我知道做一个git revert可以对此有所帮助。我碰巧很久以前就经历过这种情况(不过我已经忘记了那段时间我做了什么),但我一直在使用实验性的自定义工作流程来防止类似的情况发生。
实验性自定义工作流程Worlflow 1
\n\n我正在试验的流程几乎与 gitflow 相同,除了“功能合并以开发”部分之外。在此实验工作流程中,它被替换为“合并待开发的已验证功能”
\n\n流程变成这样:
\n\n它对我来说工作正常,但有一个小问题。它会在每次变基时创建重复的提交。我已经尝试过cherry-pick,merge(与 ff),但pull --rebase结果都是相同的。
我计划测试另一种方法,以避免每次变基时重复提交,但我认为它还会存在另一组问题。
\n\n和上面的工作流程几乎一样
\n\n工作流程2
\n\n所有要发布或由 QA 测试的功能都合并 …
我想在脚本中创建一个别名来创建pull-requests使用hub.
我打算创建这样的函数.
# PR
function pr --description 'hub pr'
hub pull-request -b $argv[0] -m $argv[1];
end
Run Code Online (Sandbox Code Playgroud)
该-m部分可以是可选的.
所以我可以这样 pr 'branch here' 'message here'
但我得到一个错误说Array index out of bounds.
我想隐藏最接近点击按钮的跨度,并隐藏按钮.
html就是这样的
<!-- the div will be looped using php -->
<!-- this will only be a general idea of the code as the actual is very long and messy -->
<div>
<form><!-- This is like the head section -->
<div>
<div> <!-- some divs -->
<button class="btn"></button> <!-- where i want it to work -->
<div></div><!-- make this 5 times -->
<span>content to hide</span>
</div>
</div>
</form>
<div><!-- Comments to the head are here -->
<button class="btn"></button><!-- button where …Run Code Online (Sandbox Code Playgroud)