我将解释我在实际项目中遇到的问题.我正在使用一个Web服务,这会给我返回点x,y.我正在使用settimeout模拟Web服务.我想在这些坐标中放一个圆圈,对于每个圆圈,我想画一条连接它们的线.像这样:
我想在圆圈之间添加一条线但显示动画.像这样:
http://bl.ocks.org/duopixel/4063326
例如这个动画,但一点一点
当我运行我的应用程序时,我希望该行具有从初始循环到结束的动画.如果我添加一个新的圆圈,我想要创建一条线并为圆圈制作动画.我该怎么做?
var svg = d3.select('svg');
var dataSet = [10, 20, 30, 40];
function display(data){
var circle = svg.selectAll('circle')
.data(data)
.enter()
.append('circle')
.attr({
r:function(d){ return d },
cx:function(d, i){ return i * 100 + 50 },
cy:50,
fill: 'red'
});
}
display(dataSet);
setTimeout(function(){
display([5]);
},2000)
Run Code Online (Sandbox Code Playgroud) 我正在使用一个 ion-select,我正在启用该multiple属性来选择几个选项.如果已经检查了3个选项,我找不到实时禁用其余选项的方法.我目前正在使用该ionSelect事件,但它仅在选中选项时有效.我怎样才能解决我的问题?我怎样才能解决我的问题?我想知道我是如何知道我已经标记了多少选项并实时获得它们的价值.
这是我的代码:https: //stackblitz.com/edit/ionic-8wewvd?file = pages/home/home.ts
页/家
<ion-label>Select a person</ion-label>
<ion-select [(ngModel)]="person" multiple="true">
<ion-option *ngFor="let item of options; let i = index"
[value]="item.id" (ionSelect)="fn_checkOptions()" >
{{item.name}}
</ion-option>
</ion-select>
export class HomePage {
public options:object=[];
constructor(public navCtrl: NavController) {
this.options=
[
{"name":"pedro","id":1},
{"name":"juan","id":2},
{"name":"maria","id":3},
{"name":"velez","id":4},
{"name":"yaya","id":4}
]
}
fn_checkOptions(){
alert("hey")
}
}
Run Code Online (Sandbox Code Playgroud) 我有一个使用动画制作的矩形,.transition()它需要 5 秒 ( .duration(5000))。我想知道是否有任何方法可以指定这 5 秒内的百分比,因此动画是从该百分比开始执行的。
例如,持续时间为 5 秒,如果指定值为50%,我希望动画从对应于 2.5 秒(5 的 50%)的值开始。那可能吗?
这是我的代码:
d3.select("#visualization").append('svg');
var vis = d3.select("svg").attr("width", 800).attr("height", 614).style("border", "1px solid red");
var rectangle = vis.append("rect").attr("width", 100).attr("height", 70).attr("x", 0).attr("y", 50);
rectangle
.transition()
.duration(5000)
.attr("x", 250)
.attr("width", 100)
.attr("height", 100)
.attr("opacity", 0.5)
.attr("fill", "red");Run Code Online (Sandbox Code Playgroud)
<script src="https://cdnjs.cloudflare.com/ajax/libs/d3/5.7.0/d3.min.js"></script>
<div id="visualization"></div>Run Code Online (Sandbox Code Playgroud)
我有一个代码,使用jquery显示带有此代码的模态:
$('#myModal').modal({'show':true});
Run Code Online (Sandbox Code Playgroud)
但是angular.js不起作用.什么是$('#myModal')使用angular.js 的等价物 ?
// not works for me
angular.element("#myModal")
Run Code Online (Sandbox Code Playgroud) 我试图制作一个告诉我坐标是否包含在中的应用程序circle。
为此,每次我在地图上单击一个点时,都会得到坐标。我想知道新坐标是否包含在圆内
我也想知道如何使一个圆占据距坐标5米的位置。在我的示例中,半径为:50000但是我不知道如何执行转换以将值设置为米。
这是我的代码:
http://plnkr.co/edit/OI4sjcuS526rFYxPnvDv?p=preview
function initMap() {
var map = new google.maps.Map(document.getElementById('map'), {
center: {lat:4.624335 , lng: -74.063644 },
zoom: 5,
});
//circle coordinates
var circle = new google.maps.Circle({
map: map,
radius: 50000,
fillColor: '#FFFFFF',
opacity:0,
center:{lat:4.624335 , lng: -74.063644 }
});
google.maps.event.addListener(map, 'click', function(e) {
//I get new coordinates ( e.latLng)
});
}
Run Code Online (Sandbox Code Playgroud)
谢谢!
更新
他们已将此问题标记为具有此解决方案的重复问题(http://jsfiddle.net/kaiser/wzcst/embedded/result/)
但这并不能真正满足我的问题,因为如您在图像中所见,解决方案失败了。
我正在使用.net core 3.1。在docker的帮助下,我将代码上传到了heroku。但是当我发出 Web 请求时,我的所有端点都出现405错误。(我看不到错误的更多细节)
使用Get:
http://xxxx.herokuapp.com/api/pqrs/test/1315315
Run Code Online (Sandbox Code Playgroud)
从 Visual Studio 代码和本地从我的 IIS 一切正常。但是当我部署到我的服务器时会出现问题。
我究竟做错了什么?这是我的控制器的代码:
using System;
using System.Collections.Generic;
using System.IdentityModel.Tokens.Jwt;
using System.Linq;
using System.Security.Claims;
using System.Text;
using System.Threading.Tasks;
using apiPQR.Contexts;
using apiPQR.Entities;
using apiPQR.Models;
using Microsoft.AspNetCore.Authentication.JwtBearer;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Configuration;
using Microsoft.IdentityModel.Tokens;
namespace apiPQR.Controllers
{
[ApiController]
[Route("api/[controller]")]
public class Pqrs : Controller
{
private readonly AppDbContext context;
private readonly IConfiguration configuration;
public Pqrs(AppDbContext context, IConfiguration configuration) …Run Code Online (Sandbox Code Playgroud) 我想在数组中标记我的单词.
$scope.arrayFilter=["mom","is","beautifull"];
Run Code Online (Sandbox Code Playgroud)
但它只适用于我,如果我按照它们出现的顺序排列的话.我希望无论这些单词的顺序如何,如果它们匹配,都会标记.如果我向数组添加一个新单词,它也应该被标记.
https://jsfiddle.net/1x7zy4La/
<li ng-repeat="item in data ">
<span ng-bind-html="item.title | highlight:arrayFilter"></span>
</li>
$scope.arrayFilter=["mom","is","beautifull"];
$scope.data = [{
title: "mom is beautifull"
}, {
title: "my mom is great"
}, {
title: "I hate the matematics"
}];
});
app.filter('highlight', function($sce) {
return function(text, arrayFilter) {
var stringToDisplay = '';
angular.forEach(arrayFilter,function(key,value){
if(text.includes(key)){
stringToDisplay = stringToDisplay.concat(key).concat(" ");
}
})
stringToDisplay = stringToDisplay.substring(0, stringToDisplay.length - 1);
return $sce.trustAsHtml(text.replace(new RegExp(stringToDisplay, 'gi'), '<span class="highlightedText">$&</span>'));
}
});
Run Code Online (Sandbox Code Playgroud)
我正在学习d3.js和系统的力量.我有一个阻止因为我无法添加文本而且它完全位于圆圈中心.我试图创建,<text>但它不起作用.我怎样才能实现它?
在这篇文章中,我尝试创建一个文本元素,但它不起作用.
var node = g.append("g")
.attr("class", "nodes")
.selectAll("circle")
.data(graph.nodes)
.enter()
.append("circle")
.attr("r", 20)
.attr("fill", function(d){
return colorNode(d.group);
})
.style("stroke", function(d){
return colorNode(d.group);
})
Run Code Online (Sandbox Code Playgroud)
更新 我知道我必须以某种方式在ag元素中制作它,这个内容是圆形和文本,但我无法使它工作.显然,我也不知道如何将文本置于圆圈内.我的结果是圆圈出现在力图之外.我试过这个,但没有用:
var node = g.append("g")
.attr("class", "nodes")
.selectAll("g")
.data(graph.nodes)
.enter()
.append("g");
node.append("circle")
.attr("r", 20)
.attr("fill", function(d){
return colorNode(d.group);
})
.style("stroke", function(d){
return colorNode(d.group);
})
Run Code Online (Sandbox Code Playgroud)
这是我的完整代码:
我只是想制作一个动画来移动 x 轴上的箭头。我想将箭头从左向右移动。但使用时:
-webkit-transform: translateX(4%);
Run Code Online (Sandbox Code Playgroud)
它还在 Y 轴上移动。为什么会发生这种情况,我该如何解决?
<div class='contenedor_flecha_prev'>
<i class="fa fa-chevron-left flecha_izqu" ></i>
</div>
.contenedor_flecha_prev{
position: fixed;
height: 80%;
width: 8%;
background: black;
bottom: 10%;
min-width: 35px;
left: 0px;
z-index: 90;
opacity:0.5;
cursor:pointer;
-webkit-transition: all 0.4s ease-in-out;
-moz-transition: all 0.4s ease-in-out;
transition: all 0.4s ease-in-out;
}
.fa.fa-chevron-left.flecha_izqu{
font-size: 55px;
color: white;
position: absolute;
top: 50%;
left: 50%;
-webkit-transform: translate(-50%,-50%);
transform: translate(-50%,-50%);
-moz-transform: translate(-50%,-50%);
opacity: 1;
}
.contenedor_flecha_prev:hover .fa.fa-chevron-left.flecha_izqu {
-webkit-animation: flecha_izquierda 1.5s infinite; /* Safari 4+ */ …Run Code Online (Sandbox Code Playgroud) 我正在尝试获取"validacion"HTML 元素的属性。
console.log (element[0]);
Run Code Online (Sandbox Code Playgroud)
这让我返回:
<input class="estilo_input_text ng-pristine ng-untouched ng-valid ng-empty" id="asunto" name="asunto" ng-model="asunto" placeholder="Asunto" type="text" validacion="required">
Run Code Online (Sandbox Code Playgroud)
我如何访问该"validacion"房产?
javascript ×6
d3.js ×3
angularjs ×2
svg ×2
arrays ×1
asp.net-core ×1
c# ×1
css ×1
docker ×1
dom ×1
google-maps ×1
heroku ×1
html ×1
ionic2 ×1
ionic3 ×1