【问题标题】:How do I turn the interactivity off with dc.js charts?如何关闭与 dc.js 图表的交互性?
【发布时间】:2016-10-11 02:24:38
【问题描述】:

鉴于此fiddle

如何关闭与 dc.js 图表的交互性? 例如,当单击图表上的任何位置时,我不希望发生任何事情。

我想保持 on:hover 选项有效,即当您将鼠标悬停在图表上时,会出现一个带有基础值的标签

我尝试过.turnOnControls(true),但没有快乐,还有.brushOn

    yearRingChart
        .width(200).height(200)
        .dimension(yearDim)
        .group(spendPerYear)
        .turnOnControls(true)
        .innerRadius(50);

注意我似乎不太擅长阅读documentation,所以这里的任何指针都将不胜感激。


编辑1

我已经尝试过.brushOn(false),但我在控制台中得到了.brushOn is not a function。可能我用的不对?

    yearRingChart
        .width(200).height(200)
        .dimension(yearDim)
        .group(spendPerYear)
        .brushOn(false) 
        .innerRadius(50);

编辑2

这是答案fiddle,基本上必须在每个图表中添加这个yearRingChart.filter = function() {};,取自这个重复的question

yearRingChart
    .width(200).height(200)
    .dimension(yearDim)
    .group(spendPerYear)
    .innerRadius(50);
    yearRingChart.filter = function() {};
spenderRowChart
    .width(250).height(200)
    .dimension(nameDim)
    .group(spendPerName)
    .elasticX(true);
dc.renderAll();
spenderRowChart.filter = function() {};

【问题讨论】:

  • 大部分是.brushOn(false)
  • @Gordon tks 但我已经尝试过了并得到了.brushOn is not a function,请参阅上面有问题的edit1。
  • 好点是坐标网格方法。也许它应该适用于所有图表。关于禁用点击 dc.js pie 的搜索怎么样。
  • @Gordon 是的,那是它看到我的编辑 2,我该如何接受或关闭它,选项似乎已消失,将其作为重复项.tks

标签: dc.js crossfilter


【解决方案1】:

编辑2

这是答案fiddle,基本上必须在每个图表中添加这个yearRingChart.filter = function() {};,取自这个重复的question

yearRingChart
    .width(200).height(200)
    .dimension(yearDim)
    .group(spendPerYear)
    .innerRadius(50);
    yearRingChart.filter = function() {};
spenderRowChart
    .width(250).height(200)
    .dimension(nameDim)
    .group(spendPerName)
    .elasticX(true);
dc.renderAll();
spenderRowChart.filter = function() {};

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-01-22
    • 2015-04-10
    • 2012-02-18
    • 2012-08-01
    • 2011-08-19
    相关资源
    最近更新 更多