Coder Social home page Coder Social logo

Comments (10)

guimeira avatar guimeira commented on August 17, 2024 1

I'm glad you like it! I'll be happy to write a few tests and send a pull request soon :)

from chartist-plugin-legend.

tarekis avatar tarekis commented on August 17, 2024

No, this is not implemented. What is your use case?

from chartist-plugin-legend.

surendarviki avatar surendarviki commented on August 17, 2024

i need to show expectation and actual as two line chart for multiple users, If i have one legend for each user it will be helpful instead of having 2 legend for each user.

from chartist-plugin-legend.

tarekis avatar tarekis commented on August 17, 2024

If you have a strict alternation in your datasets you can do that with custom functions, which let one legend act for two datasets and CSS.
If not, I do not see a solution, nor a proposable API for this kind of grouping.

from chartist-plugin-legend.

guimeira avatar guimeira commented on August 17, 2024

I have a similar use case. We had to plot two different prices for the same product, one of them as a solid line and the other as a dashed line of the same color. In that case, it makes sense to have a single legend item representing both series.

I forked the project and implemented this feature using the legendNames option. Now, it also takes an object containing the name property (the text of the legend item) and the series property, which is an array of integers containing the indexes of the series associated with this legend item.

This feature can be used like this:

new Chartist.Line('.ct-chart-line-multipleseries', {
   labels: ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday'],
   series: [
       [12, 9, 7, 8, 5],
       [2, 1, 3.5, 7, 3],
       [1, 3, 4, 5, 6]
   ]
}, {
   fullWidth: true,
   chartPadding: {
      right: 40
   },
   plugins: [
       Chartist.plugins.legend({
          legendNames: [{name: 'Red-ish', series: [0,1]}, {name: 'Yellow', series: [2]}],
       })
   ]
});

Do you think this feature could be added to the main repository? If so, is this API ok?

from chartist-plugin-legend.

SpaceK33z avatar SpaceK33z commented on August 17, 2024

@guimeira, wow, that looks nice. Yeah, the API is fine I think. I would really appreciate a PR :). Note that you'll need to add one or more tests, since the code is a bit too tricky to go untested.

I'm fairly busy these days so it can take some days for me to review.

from chartist-plugin-legend.

amichair avatar amichair commented on August 17, 2024

This can be closed, no?

from chartist-plugin-legend.

surendarviki avatar surendarviki commented on August 17, 2024

Happy this feature is now available. Thank you ppl.

from chartist-plugin-legend.

tarekis avatar tarekis commented on August 17, 2024

Ugh well, yeah that is actually available on master, but not on npm yet. I wanted to update the repo with a .npmignore file and release it properly.. if you need this right now please use the commit sha as version, but I will check if can release this today.

from chartist-plugin-legend.

SpaceK33z avatar SpaceK33z commented on August 17, 2024

I wanted to update the repo with a .npmignore file

This is not necessary, in the package.json there already is a files property which is a whitelist of files to be uploaded to npm instead of a blacklist.

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.