小编Pri*_*iya的帖子

JQUERY:未捕获错误:语法错误,无法识别的表达式

console.log($('"#'+d+'"'));
Run Code Online (Sandbox Code Playgroud)

在html我有

<div id="2013-10-23">
    <h1>5</h1>
    <p>eeeeeeeeeeee</p>
</div>
Run Code Online (Sandbox Code Playgroud)

它抛出错误:

未捕获错误:语法错误,无法识别的表达式:"#2013-10-23"

在上面的代码中,我有一个div,id="2013-10-23"当得到该id时,它会引发语法错误

jquery

26
推荐指数
5
解决办法
15万
查看次数

倒数与序数规模

有没有办法找到序数尺度的倒置?

我在x轴上使用字符串值,这是使用序数比例而我在鼠标移动时我想找到x轴的反转以找到鼠标位置的哪个字符串?

有没有办法找到这个?

var barLabels = dataset.map(function(datum) {
    return datum.image;
});
console.log(barLabels);
var imageScale = d3.scale.ordinal()
        .domain(barLabels)
        .rangeRoundBands([0, w], 0.1);
// divides bands equally among total width, with 10% spacing.
console.log("imageScale....................");
console.log(imageScale.domain());

 .
 .
var xPos = d3.mouse(this)[0];
xScale.invert(xPos);
Run Code Online (Sandbox Code Playgroud)

d3.js

21
推荐指数
2
解决办法
9597
查看次数

比较两个日期的指令

我使用了以下代码来比较两个日期(引用自定义表单验证指令来比较两个字段)

define(['./module'], function(directives) {
'use strict';
directives.directive('lowerThan', [
 function() {

   var link = function($scope, $element, $attrs, ctrl) {
   ctrl.$setValidity('lowerThan', false);
   var validate = function(viewValue) {
    var comparisonModel = $attrs.lowerThan;                

    /*if(!viewValue || !comparisonModel){
      // It's valid because we have nothing to compare against
      //console.log("It's valid because we have nothing to compare against");
      ctrl.$setValidity('lowerThan', true);
    }*/

    // It's valid if model is lower than the model we're comparing against
    //ctrl.$setValidity('lowerThan', parseInt(viewValue, 10) <    parseInt(comparisonModel, 10) );        
    if(comparisonModel){       
        var to = …
Run Code Online (Sandbox Code Playgroud)

angularjs angularjs-directive

6
推荐指数
1
解决办法
1万
查看次数

想要在谷歌饼图的图例中显示百分比数据

我在我的代码中使用谷歌图表API特定饼图我想显示图表内显示的百分比也传说 在此输入图像描述

如何在传奇中显示29.2%的睡眠?

google-visualization

4
推荐指数
1
解决办法
9702
查看次数

禁用javascript时,React事件不起作用

我指的是Node和React的以下示例:https://github.com/yldio/react-example

在Chrome中启用javascript后,我可以为数组添加一本书.当我在Chrome中禁用javascript时,我无法向该阵列添加图书.

有什么方法可以解决这个问题吗?

javascript node.js reactjs

4
推荐指数
1
解决办法
5778
查看次数

d3.js:垂直移动线与线图的交点

我正在使用d3库绘制线图.

以下是我生成折线图的代码.

<html>
<head>
    <title>Simple Line Graph using SVG and d3.js</title>
    <script src="http://mbostock.github.com/d3/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;
        }

        .axis {
            shape-rendering: crispEdges;
        }

        .x.axis line {
            stroke: lightgrey;
        }

        .x.axis .minor {
            stroke-opacity: .5;
        }

        .x.axis path {
            display: none;
        }

        .y.axis line, .y.axis path {
            fill: none;
            stroke: #000;
        }
    </style>
</head>
<body>


    <div id="graph" class="aGraph" style="position:absolute;top:0px;left:0; float:left;"></div> …
Run Code Online (Sandbox Code Playgroud)

javascript jquery d3.js

3
推荐指数
1
解决办法
3513
查看次数

reactJs:两个不同组件之间的通信

我是反应灵的新手.我希望在两个独立组件之间进行通信.

这些组件没有任何父子关系.

我找到了这段代码.

我不知道如何使用它 https://medium.com/react-zine/how-to-communicate-between-components-in-react-cc1ee986523a

reactjs

2
推荐指数
1
解决办法
3474
查看次数