frappe / charts

Simple, responsive, modern SVG Charts with zero dependencies
https://frappe.io/charts
MIT License
14.94k stars 718 forks source link

showLegend is not configureable #159

Open t47io opened 6 years ago

t47io commented 6 years ago

Expected Behaviour

The new showLegend option in 1.1.0 should be customizable.

Actual Behaviour

It's always on and cannot be turned off when there is more than 1 dataset

Steps to Reproduce:

NOTE: Add a GIF/Screenshot if required.

Frappé Charts version: 1.1.0

pratu16x7 commented 6 years ago

An oversight on my part. Legends were a long-missing key element, but you are right that on the web in the presence of tooltips they are redundant, as they were before.

t47io commented 6 years ago

The new legend is a good addition, but just should be optional and user-controllable. I think I can make a PR to add an option showLegend that overrides the internal logic. Does that sound good?

vespadj commented 2 years ago

Option showLegend: 0 doesn't work yet. Please, consider this. Thanks

MellenIO commented 2 years ago

fwiw: I created PR #389 to address this as it's functionality I need for what I'm working on.

Unfortunately, the legend for pie/donut charts have no configuration options at all - we're looking to implement legends on the RHS of the chart, stacked vertically rather than horizontally.

As a workaround, we're kinda cheating this...

<div class="grid cols-2 gap-4 w-full">
    <div>
        <div id="chart"></div>
    </div>
    <div>
        <div class="flex flex-col items-center">
            <!-- add custom legend here -->
        </div>
    </div>
</div>
let chart = new Chart('#chart', ...);
.frappe-chart .chart-legend {
    display: none;
}

However, it does get a bit annoying as the legend itself takes some space on the SVG - so you're not getting "full height" charts still.

Daijobou commented 1 year ago

After 5 years showLegend: 0 still not work :(