GithubHelp home page GithubHelp logo

Comments (4)

sgratzl avatar sgratzl commented on June 9, 2024

can you clarify? when I enable the plugin and define a label for the dataset it works just fine.

window.onload = () => {
  const ctx = document.getElementById("canvas").getContext("2d");
  window.myBar = new Chart(ctx, {
    type: 'funnel',
    data: {
      labels: ['Step 1', 'Step 2', 'Step 3'],
      datasets: [{
        label: 'Dataset 1',
        data: [1, 0.75, 0.5]
      }]
    },
    options: {
      indexAxis: 'y',
      plugins: {
        title: {
        display: true,
          text: 'Chart.js Funnel Chart'
        },
        legend: {
          display: true
        }
      }
    },
    plugins: [ChartDataLabels],
  });

};

from chartjs-chart-funnel.

Toli97 avatar Toli97 commented on June 9, 2024

can you clarify? when I enable the plugin and define a label for the dataset it works just fine.

window.onload = () => {
  const ctx = document.getElementById("canvas").getContext("2d");
  window.myBar = new Chart(ctx, {
    type: 'funnel',
    data: {
      labels: ['Step 1', 'Step 2', 'Step 3'],
      datasets: [{
        label: 'Dataset 1',
        data: [1, 0.75, 0.5]
      }]
    },
    options: {
      indexAxis: 'y',
      plugins: {
        title: {
        display: true,
          text: 'Chart.js Funnel Chart'
        },
        legend: {
          display: true
        }
      }
    },
    plugins: [ChartDataLabels],
  });

};

Isn't there any way to use the labels as legends instead of the datasets?
In your example the legend is for Dataset 1. Can the legends be Step 1; Step 2 and Step 3 with each corresponding color?

Thank you for your response.

from chartjs-chart-funnel.

sgratzl avatar sgratzl commented on June 9, 2024

you are asking about a categorical color legend?

similar to https://github.com/sgratzl/chartjs-chart-geo
image
bottom right color legend but for the categories (Step 1, Step 2, Step 3)?

AFAIK there is no chartjs plugin that currently implements something like this. This plugin implements a funnel chart using a single dataset consisting of multiple data points. Not sure whether it could be swapped the other way around, since internally different datasets are handled independently making the stepping effect quite difficult.

from chartjs-chart-funnel.

Toli97 avatar Toli97 commented on June 9, 2024

you are asking about a categorical color legend?

similar to https://github.com/sgratzl/chartjs-chart-geo image bottom right color legend but for the categories (Step 1, Step 2, Step 3)?

AFAIK there is no chartjs plugin that currently implements something like this. This plugin implements a funnel chart using a single dataset consisting of multiple data points. Not sure whether it could be swapped the other way around, since internally different datasets are handled independently making the stepping effect quite difficult.

Yeah, i figured.

I'll see what I can do but I appreciate your answer. Thank you for the help.

Cheers.

from chartjs-chart-funnel.

Related Issues (3)

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.