zig-zag order of labels below hAxis

177 views
Skip to first unread message

Stjepan Brbot

unread,
Jul 17, 2012, 11:06:32 AM7/17/12
to google-visua...@googlegroups.com
By default my labels (figures) are ordered in zig-zag below hAxis. I changed font size and they fit horizontally but chart still represents them in zig-zag form.

How to make them ordered in the same horizontal line? 

asgallant

unread,
Jul 17, 2012, 12:15:20 PM7/17/12
to google-visua...@googlegroups.com
Try setting hAxis.maxAlternation to 1 and playing with the value of hAxis.minTextSpacing (defaults to a value equal to the font size).

Stjepan Brbot

unread,
Jul 18, 2012, 2:54:05 AM7/18/12
to google-visua...@googlegroups.com
Thank you @asgallant for your reply. That was the very exact answer and as you said with combination of hAxis.minTextSpacing:1 and hAxis.maxAlternation:1 I solved my problem.

Sushil Aggarwal

unread,
Aug 19, 2013, 11:39:43 AM8/19/13
to google-visua...@googlegroups.com

hi,

setting hAxis.maxAlternation to 1 and playing with the value of hAxis.minTextSpacing doesnot resolve the issue. image 1 is the actual data showing, image2 is result of setting above 2 values and images 3 is the actual result that i want to achieve.




 var options = {

                    hAxis: { title: 'Status', minTextSpacing:1,maxAlternation:1, titleTextStyle: { color: '#82cf00', fontName: '"Arial"', fontSize: 14 }, gridlines: { color: '#ffd265', count: -1 }, baselineColor: 'green', baseline: 0, textStyle: { color: 'black', fontSize: 12} },

                    vAxis: { title: 'Help Count', titleTextStyle: { color: '#82cf00', fontName: '"Arial"', fontSize: 14 }, gridlines: { color: '#ffd265', count: -1 }, baselineColor: 'orange', textStyle: { color: 'black', fontSize: 12 } },

                    height: 250,

                    width: width,

                    fontSize: 10,

                    fontName: '"Arial"',

                    tooltip: { textStyle: { fontName: '"Arial"', fontSize: 14 }, isHtml: true },

                    colors: ['#82cf00']

                };


thz in advance..

asgallant

unread,
Aug 19, 2013, 12:03:23 PM8/19/13
to google-visua...@googlegroups.com
Setting hAxis.maxAlternation to 1 forces the labels to be on the same line.  You want to set it to 2 for your chart.  You also want to set hAxis.maxTextLines to 1 so that the labels don't split into two lines.

var options = {
    hAxis: {
        title: 'Status',
        minTextSpacing:1,
        maxAlternation:2,
        maxTextLines:1,

Sushil Aggarwal

unread,
Aug 19, 2013, 12:39:50 PM8/19/13
to google-visua...@googlegroups.com
hi,

thanks for your reply..

sorry but while arranging images by mistake i interchange image 1 and image 3. i want complete text in 2 lines just below bar graph (in 1024x768 screen)

asgallant

unread,
Aug 19, 2013, 1:51:49 PM8/19/13
to google-visua...@googlegroups.com
Then you want to set the hAxis.maxAlternation option to 1 and the hAxis.maxTextLines option to 2 or higher.

Sushil Aggarwal

unread,
Aug 20, 2013, 2:38:09 AM8/20/13
to google-visua...@googlegroups.com
doing the same doesnot resolve the issue...

asgallant

unread,
Aug 20, 2013, 10:53:41 AM8/20/13
to google-visua...@googlegroups.com
I can't duplicate your problem.  By default, the axis labels should stack the way you want them.  I used your hAxis options and they still stacked like you want them: http://jsfiddle.net/asgallant/wy8Ns/.  Can you post a full code example that demonstrates the problem?
Reply all
Reply to author
Forward
0 new messages