谷歌条形图:向上移动零轴,将负值涂成红色
我有以下图表,用于在每周游戏锦标赛中显示“虚拟货币”(玩家货币为深蓝色,而最佳玩家货币值为浅蓝色):
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):
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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
零线可以添加为穿过 y=0 的水平标记线,您仍然会在图表底部看到奇怪的“x 轴”,但这至少对我来说是可以接受的。
只需添加一个额外的数据系列
chd=[您的数据]|0
和一个额外的标记chm=[您的标记]|H,000000,2,1,1
[ H =水平线,000000=黑色的十六进制,2=最后一个数据系列的索引,1=1px的宽度,1=1的z索引(在堆叠条形图的前面)]所以最终的图表如下所示:
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 markerchm=[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:
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.
您只能使用 chco 列出单个数据集颜色,因此您当然可以将底部数据集设置为红色(就像您对蓝色所做的那样),但不仅仅是负面成员。我对将负数成员设置为红色的建议是制作第三个负数数据集与正数数据集重叠,其中值非负数时为
_
,这样您就不会绘制条形(_
或__
表示缺失值,具体取决于您的编码类型)。您可能会遇到类似的情况:您可能需要稍微调整一下顺序和数据样式属性,以使颜色和标签达到您想要的方式。
据我所知,无法将图表上的 X 轴移动到零(它只能位于顶部或底部),但您可以使用 chxs
chxs< 使其不可见(同时仍保留标签) /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: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.我已经设法在 $ 后面附加 N**$
I've managed to append $ with N**$