谷歌条形图:向上移动零轴,将负值涂成红色

发布于 2024-10-04 14:50:14 字数 1049 浏览 3 评论 0原文

我有以下图表,用于在每周游戏锦标赛中显示“虚拟货币”(玩家货币为深蓝色,而最佳玩家货币值为浅蓝色):

alt text

http://chart.apis.google.com/图表?chs=700x280&cht=bvo&chco=4D89F9,C6D9FD&chd=t:713,-647,-1202,-1830|3927,6133,8053,2576&chxl=0:|2010-44|2010- 45|2010-46|2010-47&chxt=x,y&chxr=1,-1830,8053&chds=-1830,8053&chbh=140&chm=N,,0,,12|N,,1 ,,12

1) 有没有办法让 X 轴向上一点, 以便负的深蓝色条出现在其下方?

2) 有没有办法在值后面附加“$”(而不是在前面加上cUSD)?

3)有没有办法将仅负值涂成红色?在文档中找不到此内容,我只看到如何使用 N,FF0000,0,,12 将它们全部变成红色

谢谢! 亚历克斯

I have the following chart for displaying "virtual money" in a weekly game tournament (player money is dark blue, compared to best player money values in light blue):

alt text

http://chart.apis.google.com/chart?chs=700x280&cht=bvo&chco=4D89F9,C6D9FD&chd=t:713,-647,-1202,-1830|3927,6133,8053,2576&chxl=0:|2010-44|2010-45|2010-46|2010-47&chxt=x,y&chxr=1,-1830,8053&chds=-1830,8053&chbh=140&chm=N,,0,,12|N,,1,,12

1) Is there please a way to the X-axis up a bit,
so that the negative dark blue bars appear below it?

2) Is there a way to append a "$" to the values (instead of prepending with cUSD)?

3) Is there a way to paint only negative values red? Can't find this in the doc, I only see how to make them all red with N,FF0000,0,,12

Thank you!
Alex

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

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

发布评论

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

评论(3

小傻瓜 2024-10-11 14:50:14

零线可以添加为穿过 y=0 的水平标记线,您仍然会在图表底部看到奇怪的“x 轴”,但这至少对我来说是可以接受的。

只需添加一个额外的数据系列 chd=[您的数据]|0 和一个额外的标记 chm=[您的标记]|H,000000,2,1,1 [ H =水平线,000000=黑色的十六进制,2=最后一个数据系列的索引,1=1px的宽度,1=1的z索引(在堆叠条形图的前面)]

所以最终的图表如下所示:
Voila!

PS:我知道这是一个相当老的问题你可能已经继续前进了,但是当我自己寻找 1) 和 3) 的答案时,我遇到了这个问题,尼克的答案解决了 3) [谢谢尼克],但 1) 没有得到回答。所以这只是针对像我一样遇到这个问题的其他人。

The zero line can be added as horizontal marker line going through y=0, you'll still get the odd 'x-axis' on the bottom of the graph, but this was acceptable for me at least.

Just add an additional data series chd=[your data]|0 and an additional marker chm=[your markers]|H,000000,2,1,1 [ H=horizontal line, 000000=hexadecimal for black, 2=the index of the last data series, 1=width of 1px, 1=z-index of 1 (in front of stacked bars) ]

so the final chart looks like this:
Voila!

PS: I know this is a rather old question and you have probably moved on, but I came accross this question when I myself was looking for answers to 1) and 3), Nick's answer took care of 3) [thanks Nick] but 1) wasn't answered. So this is just for anyone else stumbling accross this question as I did.

抚你发端 2024-10-11 14:50:14

您只能使用 chco 列出单个数据集颜色,因此您当然可以将底部数据集设置为红色(就像您对蓝色所做的那样),但不仅仅是负面成员。我对将负数成员设置为红色的建议是制作第三个负数数据集与正数数据集重叠,其中值非负数时为 _,这样您就不会绘制条形(___ 表示缺失值,具体取决于您的编码类型)。您可能会遇到类似的情况:

chd=t:713,_,_,_|_,-647,-1202,-1830|3927,6133,8053,2576
chco=4D89F9,FF0000,C6D9FD

您可能需要稍微调整一下顺序和数据样式属性,以使颜色和标签达到您想要的方式。

据我所知,无法将图表上的 X 轴移动到零(它只能位于顶部或底部),但您可以使用 chxschxs< 使其不可见(同时仍保留标签) /code>,这可能会让你看得更清楚。

You can only list the individual dataset colors with chco, so you can certainly make the bottom dataset red (as you've done with the blue), but not just the negative members. My suggestion for making the negative members red is making a 3rd negative data set overlapping the positive data set, where the values are _ when they're not negative so you don't draw a bar (_ or __ indicates a missing value, depending on your encoding type). You'd have something like:

chd=t:713,_,_,_|_,-647,-1202,-1830|3927,6133,8053,2576
chco=4D89F9,FF0000,C6D9FD

You'll probably have to play with the ordering a bit and the data style attributes in order to get the colors and labels to be the way you want them.

As far as I know there's no way to move the X axis up to zero on the chart (it can only go on either top or bottom), but you can make it invisible (while still leaving the labels) using chxs, which might give you a better look.

初心 2024-10-11 14:50:14

我已经设法在 $ 后面附加 N**$

alt text

I've managed to append $ with N**$

alt text

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