javascript - d3.js x3dom : How to freeze camera position and get an axis?

标签 javascript d3.js x3dom

我看到了3d bar chart d3 和另一个 3d example 的示例,我想做的一件事就是能够拥有静态的相机位置。尝试了视点 fieldOfView,但它似乎不起作用。任何人都可以帮忙将相机固定在固定位置吗?我不希望用户能够旋转 3d 场景。

此外,我无法弄清楚他们如何在屏幕上显示 x、y 和 x 轴。是否有教程或 API 引用可供我了解如何在 d3.js 中使用 x3dom?我想知道命令和语法是什么。

最佳答案

x3dom 没有禁用旋转的选项。但你可以添加修改他们的源代码来做到这一点。我为我的一个项目这样做了:

// add disableRotation option
var validParams = array_to_object([
  // ...
  'disableRotation',
  // ...
]);

// disable rotation onDrag
x3dom.Viewarea.prototype.onDrag = function (x, y, buttonState) {
  // ...
  if (this._doc.properties.getProperty('disableRotation', 'false') === 'true' && buttonState === 1) {
    return;
  }
}

// append this to your x3d tag
x3d.append("param")
   .attr("name", "disableRotation")
   .attr("value", "false");

请参阅此示例了解如何在屏幕上绘制轴:

http://bl.ocks.org/hlvoorhees/5986172

关于javascript - d3.js x3dom : How to freeze camera position and get an axis?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22477631/

相关文章:

javascript - Discord.js/JS - 如果每个字符串都有指定的数字(级别排行榜),则按降序对字符串数组进行排序

javascript - 在 Force Directed Graph d3 中引入 Arrow(directed)

javascript - 使用 Crossfilter 和 D3 重绘直方图

html - 为什么不能在 X3DOM 中加载图像纹理?

javascript - 是什么原因导致 "inline method not to work for chrome browser"?

javascript - 我如何声明以便在 jquery 移动 UI 中突出显示默认选项卡

javascript - 使用鼠标在 html5 canvas 中水平和垂直倾斜绘图

javascript - 如何使用 Jquery 或 Javascript 打印多个 Div?

javascript - 使用 D3.js 和 Immutable.js

php - 从 blender 导出的 .X3D 文件具有黑色背景,我无法更改