Git Product home page Git Product logo

Comments (6)

devzing avatar devzing commented on September 25, 2024

Affecting me as well. Using ct-major-tenth

from chartist-plugin-legend.

tarekis avatar tarekis commented on September 25, 2024

Well, chartist-plugin-legend places the ul element inside of the chart container, either before or after the svg chart, depending on your options.

If you want the ul to be placed, this has to be done with JS, probably the best approach ist to fork and implement a position option for flexibilty:

chart.on('created', function (data) {
    // Append the legend element to the DOM
    switch (options.position) {
        case 'top':
            chart.container.insertBefore(legendElement, chart.container.childNodes[0]);
            break;

        case 'bottom':
            chart.container.insertBefore(legendElement, null);
            break;

        case 'outertop':
            // Some logic to place the chart outside of the chart container
            break;
        }
});

How good that is and if that should be PR'd into the master sometimes, i can't say really; you might run into some unexpected styling problems because the legend is now somewhere outside the container, depending on your implementation.

from chartist-plugin-legend.

SpaceK33z avatar SpaceK33z commented on September 25, 2024

We could also allow the position option to take a DOM element. If a DOM element is given it attaches to that element instead of inside the chart. A PR is welcome for this, don't have the time myself atm.

from chartist-plugin-legend.

tarekis avatar tarekis commented on September 25, 2024

That sounds sweet too, might look into it sometime soon.

from chartist-plugin-legend.

tarekis avatar tarekis commented on September 25, 2024

Works as of 0.6.0. You can now enter any HTMLElement into the position option.

from chartist-plugin-legend.

tarekis avatar tarekis commented on September 25, 2024

I'm closing this as this should be resolved as of 0.6.0. If this issue remains, feel free to reopen it.

from chartist-plugin-legend.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.