如何从 Google 条形图(又名图表 API)中删除两个轴

发布于 2024-09-03 08:16:00 字数 372 浏览 1 评论 0原文

我在图表 API 中找不到从条形图中删除任何轴的方法。例如:

cht=bvg
chs=410x150
chd=s:StackOverflow

简单条形图示例

如何删除灰色的 x 和 y 轴?

I can't find in the Chart API the way to remove any axis from a bar chart. For instance:

cht=bvg
chs=410x150
chd=s:StackOverflow

simple bar chart example

How to remove the gray x and y axis?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

囚你心 2024-09-10 08:16:00

我发现的只是这个技巧:覆盖它们带有白线,它可以工作

cht=bvg
chs=410x150
chd=s:StackOverflow
chm=r,FFFFFF,0,-0.01,0.01,1
    R,FFFFFF,0,-0.01,0.01,1

替代文本

...但有什么“更干净”的方法吗?

All I found is this trick: cover them with a white line and it works

cht=bvg
chs=410x150
chd=s:StackOverflow
chm=r,FFFFFF,0,-0.01,0.01,1
    R,FFFFFF,0,-0.01,0.01,1

alt text

...but any "cleaner" way?

吝吻 2024-09-10 08:16:00

(基于 Alexander Farber 的答案,但有一些小的改进)

您可以添加

chxt=x,y
chxs=0,,0,0,_|1,,0,0,_

解释:

chxt=x,y

要显示哪个轴。尽管 x 轴和 y 轴显示为默认值,但我们仍然需要指定它们才能使用 chxs 应用样式。

chxs=0,,0,0,_|1,,0,0,_

样式为两个轴,由管道分隔。用逗号分隔,我们有:

  • 轴索引。参考chxt. 0= 第一个 (x),1= 第二个 (y)
  • 标签颜色。由于我们将隐藏标签,因此我们可以将此
  • 标签字体大小保留为空。将其设置为 0 将隐藏标签,因此我们不需要使用 chxl
  • 标签对齐设置空标签。尽管我们不显示标签,但需要指定一个有效值。 0 没问题。
  • 显示轴和刻度线。 _ 将隐藏

https:// 的更多信息Developers.google.com/chart/image/docs/chart_params#axis_label_styles
图表

(based on Alexander Farber's answer, but with some minor improvements)

You can add

chxt=x,y
chxs=0,,0,0,_|1,,0,0,_

Explanation:

chxt=x,y

Which axis to show. Even though axis x and y are shown as default, we still need to specify those to be able to apply styling with chxs.

chxs=0,,0,0,_|1,,0,0,_

Styling for the two axis, separated by pipe. Separated by comma, we have:

  • Axis index. Reference to chxt. 0= first (x), 1= second (y)
  • Label color. Since we will hide the labels, we can leave this empty
  • Label font size. Setting this to 0 will hide the labels, and thus we don't need to set empty labels with chxl
  • Label alignment. Need to specify a valid value, although we don't display labels. 0 is fine.
  • Show axis and tick marks. _ will hide both

More info at https://developers.google.com/chart/image/docs/chart_params#axis_label_styles
chart

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文