Google barchart : marge between bar

36 views
Skip to first unread message

Lucie W

unread,
May 19, 2016, 3:29:03 AM5/19/16
to Google Visualization API

 Hi,

I have a google bar chart like you can see.
In fact the legend is illisible.
I would like put a marge between the bar to make it more readable.

How I can do that ?

Thank you to your help.

Lucie W

unread,
May 23, 2016, 3:41:18 AM5/23/16
to Google Visualization API
Hello again,

I still do not have found a way to my problem.

Nobody has a solution for me ?

Thank you.

Daniel LaLiberte

unread,
May 23, 2016, 6:50:52 AM5/23/16
to Google Visualization API
Hi Lucie,

You'll need to give us more clues about how you are getting that image.  Can you post enough code so we can reproduce it, or better, make a jsfiddle example that shows this.

If your legend is not visible, it might be that you have not given it enough space to show up.


--
You received this message because you are subscribed to the Google Groups "Google Visualization API" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-visualizati...@googlegroups.com.
To post to this group, send email to google-visua...@googlegroups.com.
Visit this group at https://groups.google.com/group/google-visualization-api.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-visualization-api/cc88b0ad-8da7-4f5b-a4bd-d782d076e3b4%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--

Lucie W

unread,
May 23, 2016, 8:00:13 AM5/23/16
to Google Visualization API
Thank you to your answer.

This is my code :


function drawChart() {
      //Pas forcément besoin du mois
      var tableau =[
          ['Weeks', 'Task1',{type: 'string', role: 'annotation'},  'Task2',{type: 'string', role: 'annotation'},  'Task3', {type: 'string', role: 'annotation'}, 'Task4', {type: 'string', role: 'annotation'}, 'Task5', {type: 'string', role: 'annotation'}, 'Task6', {type: 'string', role: 'annotation'}, 'Task7', {type: 'string', role: 'annotation'}, 'Task8', {type: 'string', role: 'annotation'}, 'Task9', {type: 'string', role: 'annotation'}, 'Task10', {type: 'string', role: 'annotation'}],
          ['Mars S11', 1, 'Task1 / 1h', 7, 'Task2 / 7h', 18.5, 'Task3 / 18.5h', 18.5, 'Task4 / 18.5h', 18.5, 'Task5 / 18.5h', 18.5, 'Task6 / 18.5h', 18.5, 'Task7 / 18.5h', 18.5, 'Task8 / 18.5h', 18.5, 'Task9 / 18.5h', 18.5, 'Task10 / 18.5h']
        ];
        var data = google.visualization.arrayToDataTable(tableau);
       
        var options = {
            chart: {
                title: 'Indicateur de temps par ressource',
                subtitle: 'Temps passé par ressource en tickets, projets et demandes: Mars S11 - Avril S14',
            },
            vAxis: {format: 'Decimal'},
            legend: {position: 'none'},
            annotations: {
                            alwaysOutside: true,
                            textStyle: {
                                fontSize: 12,
                                auraColor: 'none',
                                color: '#555'
                            },
                            boxStyle: {
                                stroke: '#ccc',
                                strokeWidth: 1,
                                gradient: {
                                    color1: '#f3e5f5',
                                    color2: '#f3e5f5',
                                    x1: '0%', y1: '0%',
                                    x2: '100%', y2: '100%'
                                }
                            }
                        }
        };
        var chart_div = document.getElementById('columnchart_material');
        var chart = new google.visualization.BarChart(chart_div);
       
        google.visualization.events.addListener(chart, 'ready', function () {
            chart_div.innerHTML = '<img src="' + chart.getImageURI() + '">';
            console.log(chart_div.innerHTML);
        });

        chart.draw(data, (options));
      }



As you can see, when you draw this chart there are space on top and bottom. To use this space and return a readable graph I would like put a space between the bars.


Daniel LaLiberte

unread,
May 23, 2016, 8:48:14 AM5/23/16
to Google Visualization API
Is this closer to what you want?  https://jsfiddle.net/dlaliberte/fLj4ohxe/

--
You received this message because you are subscribed to the Google Groups "Google Visualization API" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-visualizati...@googlegroups.com.
To post to this group, send email to google-visua...@googlegroups.com.
Visit this group at https://groups.google.com/group/google-visualization-api.

For more options, visit https://groups.google.com/d/optout.

Lucie W

unread,
May 23, 2016, 9:00:10 AM5/23/16
to Google Visualization API
Yes, that's it !

It's perfect !
Thank you very much.
Reply all
Reply to author
Forward
0 new messages