env.js的Highcharts边界框问题 [英] Highcharts boundingbox issue with env.js

查看:104
本文介绍了env.js的Highcharts边界框问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在有关使用Export Server和PhantomJS在服务器端使用Highcharts的新功能文章中,提到了与Env.js(与Rhino一起使用)中的边界框有关的问题.您能否发布一个示例,该示例由于SVG问题的边界框而导致图表显示不正确?有没有可能发生的特定模式?

In the new feature article on Highcharts for the serverside using Export Server and PhantomJS, issues related to bounding box in Env.js (used with Rhino) is mentioned. Could you please post an example where the chart is rendered incorrectly due to the bounding box for SVG issue? Is there any specific pattern in which it could happen?

推荐答案

我在自动定位X轴标签时遇到问题.旋转文本的位置将是一个不错的起点. 给你一个例子,什么是行不通的-这是我发现的用于模拟getBBox()功能的函数:

I had Problems with the automatic positioning of X-Axis labels. Positioning of rotated Text would be a good place to start. To give you an example what would not work - here is the function I found for simulating the getBBox() functionality:

 ep = Element.prototype;

 ep.getBBox = function() {
 var w = 10;
 if (ep.tagName == "TEXT" && ep.firstChild) {
   var s = ep.firstChild.innerHTML;
   w = s.length * 5;
 }

 return {
   x : ep.offsetLeft ? ep.offsetLeft : 0,
   y : ep.offsetTop ? ep.offsetTop : 0,
   width : w,
   height : 16
 };
};

如您所见,这简直是准系统-仅近似于Textlength,否则返回默认的宽度和高度.

As you see it is pretty barebones - just approximates Textlength and returns a default width and height otherwise.

这篇关于env.js的Highcharts边界框问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆