无论如何,是否可以垂直对齐谷歌组织图表可视化中的框
我正在使用 Google 组织结构图可视化 API,我想要将垂直对齐设置为单元格的顶部。 (我在每个组织结构图框中显示多个人员,因此我希望每个“级别”与顶部而不是中间对齐。因此,在示例中,Alice 垂直居中。i想要它 valign="top" 可以使用 google 可视化 api 来实现吗?
i am using google org chart visualization API and i want to have the vertical alignment set to top on the cells. (i am showing multiple people in each org chart box so i want every "level" to align to the top instead of the middle. So in the example, where you have Alice which is vertically centered. i want it to valign="top". is this possible to do using the google visualization api ??
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
我不确定是否有一种简单的方法可以使用 Google API 来实现这一点,但您可以使用简单的 CSS 来实现;
而不是
编写“
您也可以编写 JavaScript 代码来计算该单元格的高度并将其分配给该单元格的 div 标签,
如果需要”。 编辑:如果你想垂直对齐TD元素,你可以编写自定义CSS;
I'm not sure if there is a simple way to do that with Google API but you can achieve that with simple CSS;
Instead of
you can write
If you want, you can also write a JavaScript code to calculate that cell's height and assign it to that cell's div tag.
EDIT: If you want to vertically align the TD element, you can write a custom CSS;
Elzo 有一个建议,但不要使用 valign: top;你需要使用
垂直对齐:顶部
就像下面的
data.setProperty(0, 0, "style", "vertical-align:top;");
Elzo had a suggestion but instead of using valign: top; you need to use
vertical-align: top
like below
data.setProperty(0, 0, "style", "vertical-align:top;");
您可以使用 setProperty 函数按单元格调整 CSS:
You can adjust CSS by cell with setProperty function:
您可以设置组织结构图中元素的样式。
我是这样做的...
我一开始的错误是在 Google Javascript 代码上方添加 css 块。一旦我把它移下来,我就可以改变几乎任何视觉属性。
You can style the elements within the Org Chart.
Here's how I did it...
My mistake at first was to add the css block above the Google Javascript code. Once I moved it down, I could change pretty much any visual property.
对于那些寻找简单、开源 Javascript 组织图表库的人:
我刚刚发布了 lib_gg_orgchart。它使用 JSON 输入并使用 Raphael 绘制图表。
查看该网站的一些示例并下载:
http://www.fluxus.com.ve /gorka/lib_gg_orgchart
如果您觉得有用,请告诉我。
For those looking for a simple, open-source Javascript Organizational Chart library:
I've just published lib_gg_orgchart. It uses a JSON input and draws the chart using Raphael.
Take a look at the site for some examples and download:
http://www.fluxus.com.ve/gorka/lib_gg_orgchart
If you find it useful, please let me know.