简体   繁体   English

Google图表工具 - 重叠标签

[英]Google Chart Tools - overlapping labels

I'm using Google Chart Tools to display a simple line graph for unknown reason the labels overlap no matter how I set the "legend" parameters. 我正在使用谷歌图表工具显示一个简单的折线图,原因不明,无论我如何设置“图例”参数,标签都会重叠。 In the screenshot below you can see the result for legend: {position: 'in', alignment:'center'} . 在下面的屏幕截图中,您可以看到legend: {position: 'in', alignment:'center'}的结果legend: {position: 'in', alignment:'center'} How to work around this? 如何解决这个问题? 标签重叠

"..when people generally complain about labels overlapping, that's due to attempting to draw in an invisible container. We currently do not support this, so you need to make sure that your container is not display:none when you draw the chart." “..当人们普遍抱怨标签重叠时,这是由于试图在一个看不见的容器中画画。我们目前不支持这个,所以你需要确保你的容器不显示:当你绘制图表时没有。” - Sergey - 谢尔盖

Link: https://groups.google.com/forum/#!topic/google-visualization-api/c-KpZk--8p0 链接: https//groups.google.com/forum/#!topic / google-visualization- api/ c-KpZk--8p0

I had a chart loading near the bottom of a pretty complex page and this issue started. 我在一个非常复杂的页面底部附近加载了一个图表,这个问题就开始了。 I decided to execute the creation of the chart after the page had loaded to give the parent div time to render. 我决定在页面加载后执行图表的创建,以便为父div提供渲染时间。 $(document).ready(function(){ makeChart(data); }) And the css for the parent div had a fixed height & width. $(document).ready(function(){ makeChart(data); })并且父div的css具有固定的高度和宽度。

Hope this helps! 希望这可以帮助!

I was rendering graphs on a popup, labels were overlapping. 我在弹出窗口上渲染图形,标签重叠。 I tried executing the rendering in $(document).ready() as well as $(window).load() - nothing worked out. 我尝试在$(document).ready()以及$(window).load()执行渲染 - 没有任何结果。

On a click event, the popup will appear. 在单击事件上,将显示弹出窗口。

$(document).ready(function()
{
    $('.view_graphs').click(function(){
        setTimeout(function(){
            renderGraph();
        },500)
    })
})

function renderGraph() {
    google.charts.setOnLoadCallback(column_chart);
    function column_chart() {
        var data = new google.visualization.arrayToDataTable(<?php echo $visitlang_json_data ?>); 
        var chart = new google.visualization.ColumnChart(document.getElementById('visit_lang_chart'));
        var options = {'title':'Report based on language',
                         'width':600,
                         'height':500
                     };
        chart.draw(data,options);
    }
}

Rendering it on a setTimeout function on click event worked for me 在click事件上的setTimeout函数上渲染它对我有用

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM