highcharts - Highcharts 在旧版本中查看全屏
问题描述
我正在使用 highcharts 版本 6.1.0,我看到查看全屏选项仅在 highcharts 版本 7 0r 7+ 中可用。有没有办法在之前的版本中获得这个全屏视图功能?提前致谢。
解决方案
您可以使用以下功能定义自己的上下文菜单按钮onclick
:
exporting: {
menuItemDefinitions: {
viewFullscreen: {
onclick: function() {
var container = this.renderTo;
if (container.requestFullscreen) {
container.requestFullscreen();
} else if (container.mozRequestFullScreen) {
container.mozRequestFullScreen();
} else if (container.webkitRequestFullscreen) {
container.webkitRequestFullscreen();
} else if (container.msRequestFullscreen) {
container.msRequestFullscreen();
}
},
text: 'View in full screen'
}
},
buttons: {
contextButton: {
menuItems: ["viewFullscreen", "printChart", "separator", "downloadPNG", "downloadJPEG", "downloadPDF", "downloadSVG"]
}
}
}
现场演示:http: //jsfiddle.net/BlackLabel/oyz836v7/
API 参考: https ://api.highcharts.com/highcharts/exporting.menuItemDefinitions
推荐阅读
- amazon-web-services - 使用自定义资源 Lambda 运行 Crawler
- java - Azure Functions 无法访问 Java 中 eventthub 触发器中的分区上下文
- c# - 如何使用 iText7 获取 PDF 的书签页码
- c# - 通过 Linq Select 语句将泛型类型转换/转换为其他类型
- mongoose - Mongoose:更新 1 个键并删除同一对象中的另一个键
- php - 在codeigniter中编译插入
- javascript - 如何在Javascript中翻译特殊字符
- ruby-on-rails - Rails 应用程序中的 Capistrano 部署错误
- python - 如何在rasa的handle_text中传递额外的参数?
- javascript - 折叠手风琴时,边框会在这段时间内消失,当手风琴折叠时边框如何可见?