angular - 如何为 Plotly modeBar 设置默认选择
问题描述
我正在使用 Plotly.js 在 Angular 6 中构建一个应用程序来绘制散点图。
我需要将默认 modeBar 选择设置为“在悬停时显示最接近的数据”(文档中的 hoverClosestCartesian)。
我能够从 modeBar 中删除选项,并使用 [config] 选项删除了所有我不想要的选项。至于设置活动选项,我不知道如何改变它。
一些文档可以在这里找到==> https://github.com/plotly/plotly.js/blob/master/src/components/modebar/buttons.js
MyConfig = {
scrollZoom: true,
displayLogo: false,
modeBarButtonsToRemove:['sendDataToCloud', 'select2d', 'lasso2d', 'hoverCompareCartesian', 'toggleSpikelines']
};
解决方案
试试layout.hovermode = 'closest'
(https://plot.ly/javascript/reference/#layout-hovermode)。
推荐阅读
- powershell - 在 azure devops CI 管道中使用 Run PsScriptanalyzer
- r - 根据 if + else if + else 改变值
- python - 在 Pandas DataFrame 中将天数转换为年数
- r - 用非 nlme 包模型绘制半变异函数
- regex - Google Apps 脚本表单 textValidationBuilder 无法识别正则表达式模式
- azure - Azure API for FHIR 使用 Generate Id 创建新资源
- javascript - 浏览器前后按钮无法正常工作
- html - 显示 flex 没有正确对齐
- asp.net-mvc - 使用 windows 和 Form base 身份验证实现 MVC 5 App
- jenkins - 运行 jenkinsfile 时 docker.sock 权限被拒绝