I can't use percentages for width and height

17 views
Skip to first unread message

abdelkader didouh

unread,
May 29, 2014, 4:29:43 AM5/29/14
to google-visua...@googlegroups.com
Hi all
This must probably seem like a stupid question but how can i use % in stead of px when dealing with a chart width and height? because using px causes problems for different resolution.
this doesnt seem to work:

var chart = new google.visualization.ChartWrapper({
        chartType: 'LineChart',
        containerId: 'line_div',
        dataTable: data,
        options: {
backgroundColor:{ fill:'transparent' },
            title: 'The crime in your area by category',
            width: '15%',
            height:'6%'
        }
    });

Kins regards 

Andrew Gallant

unread,
May 29, 2014, 9:27:51 AM5/29/14
to google-visua...@googlegroups.com
To use percents, you have to style the container div instead of setting them in the chart's options.  You could add this to your CSS:

#line_div {
    width: 15%;
    height: 6%;
}

abdelkader didouh

unread,
May 29, 2014, 10:20:20 AM5/29/14
to google-visua...@googlegroups.com
Thanks very much for your quick response however i have already did that but that doesnt seem to work :(


--
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/B6OliFdj7-o/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,
May 29, 2014, 8:37:44 PM5/29/14
to google-visua...@googlegroups.com
The only potential hangup I can see is with using a % for height, but that is an issue with CSS/HTML, not with the Visualization API.  Can you share demo code demonstrating the problem?
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