小编Reb*_*ltz的帖子

nvd3.js带有多个图表的工具提示位置

我正在使用nvd3的v1.7.1。我有一个页面,在其中渲染具有相同配置但数据不同的图表行。我在多线图上使用交互式工具提示选项。工具提示正确呈现,但是当您向下滚动页面时,将鼠标悬停在该行上时,工具提示将呈现在页面顶部的同一位置。看起来前几行将工具提示显示在适当的位置,但是当您向下滚动时,工具提示将消失。我尝试使用tooltipContent(似乎是可用的api)来操纵位置,但这是行不通的。如下所示:

var chartOffset = $(id + ' svg').offset(),
        x = chartOffset.left,
        y = chartOffset.top;
      //chart.tooltip.position({"top":top,"left":left});
      //chart.interactiveLayer.tooltip.fixedTop(null);
     chart.tooltipContent(function (key, x, y, e) {
        if (e.value >= 0) {
          return '<h3>' + key + '</h3>' +
            '<p>' + y + ' at ' + x + '</p>';
        } else {
          return '';
        }
      });
Run Code Online (Sandbox Code Playgroud)

我也尝试过设置.nvtooltip边距样式,但没有找到解决方法。在此处输入图片说明

下图显示了工具提示如何与您要移动的线断开连接

有任何解决此问题的提示吗?

以下是完整的nvd3图表选项:

var chart = nv.models.lineChart()
        .height(height)
        .width(width)
        .forceY([0, 1])
        .x(function (d) {
          return new Date(d[0]);
        })
        .y(function (d) {
          return d[1];
        })
        .color(chartcolors)
        .useInteractiveGuideline(true)
        .tooltips(true); …
Run Code Online (Sandbox Code Playgroud)

d3.js nvd3.js

7
推荐指数
2
解决办法
4842
查看次数

如何使用unicode解析python服务中的JSON?SyntaxError:意外的令牌u

我正在使用angular js 从http://pythond3jsmashup.appspot.com/chart加载json

$http.get('http://pythond3jsmashup.appspot.com/chart');
Run Code Online (Sandbox Code Playgroud)

我从一个如何使用python将Google BigQuery数据作为服务获取的示例中获得了此服务(http://code.tutsplus.com/tutorials/data-visualization-app-using-gae-python-d3js-and-google -bigquery - cms-22175).

Angular在使用unicode的json解析时遇到问题.有没有任何解决方法与Angular,或者你是否必须修改你的python以省略unicode字符?

我正在使用角度1.3

angular.js:11607语法错误:意外的令牌我可以看到它在JSON.parse失败了

数据看起来像是从python服务回来的:

{u'kind':u'bigquery#queryResponse',u'rows':[{u'f':[{u'v':u'brave'}]},{u'f':[{u' v':u'forfeits'}]},{u'f':[{u'v':u'holding'}]},{u'f':[{u'v':u'profession'} ]},{u'f':[{u'v':u'Condemn'}]},{u'f':[{u'v':u"fear'st"}]},{u' f':[{u'v':u'answered'}]},{u'f':[{u'v':u'religion'}]},{u'f':[{u'v ':你'你是'}}},{u'f':[{u'v':你'代理}}}},{u'f':[{u'v':u'heed' }}},{u'f':[{u'v':u'generation'}]},{u'f':[{u'v':u'Boldly'}]},{u'f ':[{u'v':u"'"}]},{u'f':[{u'v':u'told'}]},{u'f':[{u'v' :u'answer'}]},{u'f':[{u'v':u'regard'}]},{u'f':[{u'v':u'Touching'}]} ,{u'f':[{u'v':u'meet'}]},{u'f':[{u'v':u"o'er"}]},{u'f' :[{u'v':u'dawn'}]},{u'f':[{u'v':u'authorities'}]},{u'f':[{u'v': u'Mended'}]},{u'f':[{u'v':u'quality'}]},{u'f':[{u'v':u'lusty'}]}, {u'f':[{u'v':u'forbid'}]},{u'f':[{u'v':u'instruments'}]},{u'f':[{ u'v':u'A'}]},{u'f':[{u'v':u'dreadfully'}]},{u'f':[{u'v':u'accordingly '}]},{u'f':[{u'v':

python unicode json angularjs google-bigquery

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

标签 统计

angularjs ×1

d3.js ×1

google-bigquery ×1

json ×1

nvd3.js ×1

python ×1

unicode ×1