question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Suggestion: Scaling the chart down when there is overlap with the legend

See original GitHub issue

I used to work with Highcharts, but switched to ECharts. And even with Chinese documentation, it’s way easier to use, so nice job!

Though there is one function I miss in ECharts, and that is setting the legend to not overlap the chart, by automatically scaling the chart down when there is overlap.

I’ve created a jsfiddle to illustrate what I mean: http://jsfiddle.net/gw7gwyqv/2/

See what happens when you resize the chart window? The chart gets larger/smaller to prevent overlapping with the legend. This is a really nice feature I think.

I don’t know if this will be easy to implement (probably not…), but maybe you can add something like: options.legend.overlap: (boolean)


Also, the legend overlaps with the toolbox too, which should not happen in any case, right?

legend-overlap

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:1
  • Comments:14 (4 by maintainers)

github_iconTop GitHub Comments

6reactions
pissangcommented, Apr 15, 2016

Hi Jeffery, glad to hear you like echarts and can work with it easily. We will have English doc soon.

About the overlapping problem, we knew it’s really annoying. And we have discussed if there is a way to get the layout done automatically to avoid overlap. Not only between the chart and legend, but also many other components like toolbox. But sadly we haven’t found a elegant way to achieve that.

And I think the chart is the most important in the view so it is not a good way to avoid overlapping by scaling the chart. Maybe it’s better to render the legend outside with html and let css do the complicate layout job. Like the following code

option: {
    legend: {
        // Not show the legend, instead rendering it with html
        show: false,
        data: ['Quatro', 'Esmee'],
        selected: {
            'Quatro': true,
            'Esmee': true
        }
    }
};

$el1.click(function () {
    chart.setOption({
        legend: {
            selected: {
                Quatro: false
            }
        }
    });
})
2reactions
pissangcommented, Apr 16, 2016

Yes, agree with that it has a lot of work that developer should not concern. Maybe we can provide a legend extension which is rendered with HTML and CSS instead of canvas

Read more comments on GitHub >

github_iconTop Results From Across the Web

Scaling the chart down when there is overlap with the legend ...
Though there is one function I miss in ECharts, and that is setting the legend to not overlap the chart, by automatically scaling...
Read more >
Legend overlap problem - Excel Help Forum
When you create a new chart the legend has a property that says 'Show legend without overlapping chart'. If you select legend position...
Read more >
Chart.JS DataLabels overlap with Chart Legend
On my graph I have datalabels overlapping with the legend on the top of the chart. enter image description here. Here is my...
Read more >
Why does my legend overlap with my chart when I add the ...
Excel version. Go to File > Account > Product information including About (remember to mask your personal information. If it is convenient to ......
Read more >
How to prevent bars from overlapping with the lege... - 1517197
Hi,. The problem is that the legend is placed within the chart itself, so there is no way you can avoid that unless...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found