Sign on axis

13 views
Skip to first unread message

raphael...@audyx.com

unread,
Jul 23, 2014, 6:49:34 AM7/23/14
to google-visua...@googlegroups.com
How to show "+" or "-" Sign on X and Y Axis before values...???

Andrew Gallant

unread,
Jul 23, 2014, 7:27:34 PM7/23/14
to google-visua...@googlegroups.com
Use the vAxis.format option.  The format option takes an ICU number pattern, which separates out positive and negative formats with a semicolon, so you could have, as an example:

vAxis: {
    format: '+#;-#'
}

which would format 3 as "+3" and -7 as "-7".

Raphael Boukara

unread,
Jul 24, 2014, 2:02:05 AM7/24/14
to google-visua...@googlegroups.com
Than a lot :) 
But for "0" it's not working => "+0" ?


--
You received this message because you are subscribed to a topic in the Google Groups "Google Visualization API" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/google-visualization-api/gHsWGdGfLxI/unsubscribe.
To unsubscribe from this group and all its topics, send an email to google-visualizati...@googlegroups.com.
To post to this group, send email to google-visua...@googlegroups.com.
Visit this group at http://groups.google.com/group/google-visualization-api.
For more options, visit https://groups.google.com/d/optout.

Andrew Gallant

unread,
Jul 24, 2014, 2:14:30 PM7/24/14
to google-visua...@googlegroups.com
The ICU pattern format groups 0 in with the positive values, there is no way (using the format option) to treat 0 differently.  If you need to format it differently, you need to use the vAxis.ticks option, which takes an array of values or objects.  Values specify the values to put a tick mark at.  Objects have "v" and "f" properties, where the "v" property is the value to place the tick mark at and the "f" property is the string to use for the label.

vAxis: {
    ticks: [{v: -3, f: '-3'}, {v: -2, f: '-2'}, {v: -1, f: '-1'}, {v: 0, f: '0'}, {v: 1, f: '+1'}, {v: 2, f: '+2'}, {v: 3, f: '+3'}]
}

Using the ticks option overrides all of the default tick mark calculations, so you must specify all of your tick marks on the option.


On Thursday, July 24, 2014 2:02:05 AM UTC-4, Raphael Boukara wrote:
Than a lot :) 
But for "0" it's not working => "+0" ?
On Thu, Jul 24, 2014 at 2:27 AM, Andrew Gallant <agal...@google.com> wrote:
Use the vAxis.format option.  The format option takes an ICU number pattern, which separates out positive and negative formats with a semicolon, so you could have, as an example:

vAxis: {
    format: '+#;-#'
}

which would format 3 as "+3" and -7 as "-7".


On Wednesday, July 23, 2014 6:49:34 AM UTC-4, raphael...@audyx.com wrote:
How to show "+" or "-" Sign on X and Y Axis before values...???

--
You received this message because you are subscribed to a topic in the Google Groups "Google Visualization API" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/google-visualization-api/gHsWGdGfLxI/unsubscribe.
To unsubscribe from this group and all its topics, send an email to google-visualization-api+unsub...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages