Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ArcElements should allow circular: false for flattened style #10357

Closed
4minus opened this issue May 17, 2022 · 5 comments
Closed

ArcElements should allow circular: false for flattened style #10357

4minus opened this issue May 17, 2022 · 5 comments

Comments

@4minus
Copy link

4minus commented May 17, 2022

Feature Proposal

The polar / radial scale, like used in radar charts, allows the option "circular: false" for a flat styling. It would be awesome, if ArcElements could understand this option as well, so it's possible to combine the non-circular styled scale with the polar area chart.

Possible Implementation

Here i attached a short sketch.

sectionalRadarChart

@LeeLenaleee
Copy link
Collaborator

LeeLenaleee commented May 17, 2022

You could already achieve something like this by using a radar chart with multiple datasets like so:

const options = {
  type: 'radar',
  data: {
    labels: ["Red", "Blue", "Yellow", "Green", "Purple", "Orange"],
    datasets: [{
        label: '# of Votes',
        data: [0, 19, 19, 0, 0, 0],
        backgroundColor: 'pink'
      },
      {
        label: '# of Votes',
        data: [0, 0, 0, 9, 9, 0],
        backgroundColor: 'orange'
      },
      {
        label: '# of Votes',
        data: [0, 0, 0, 0, 12, 12],
        backgroundColor: 'blue'
      },
      {
        label: '# of Votes',
        data: [4, 4, 0, 0, 0, 0],
        backgroundColor: 'green'
      },
      {
        label: '# of Votes',
        data: [0, 0, 6, 6, 0, 0],
        backgroundColor: 'red'
      },
      {
        label: '# of Votes',
        data: [12, 0, 0, 0, 0, 12],
        backgroundColor: 'purple'
      }
    ]
  },
  options: {}
}

const ctx = document.getElementById('chartJSContainer').getContext('2d');
new Chart(ctx, options);

https://jsfiddle.net/bf5ntagj/

@4minus
Copy link
Author

4minus commented May 17, 2022

You could already achieve something like this by using a radar chart with multiple datasets like so:

const options = {
  type: 'radar',
  data: {
    labels: ["Red", "Blue", "Yellow", "Green", "Purple", "Orange"],
    datasets: [{
        label: '# of Votes',
        data: [0, 19, 19, 0, 0, 0],
        backgroundColor: 'pink'
      },
      {
        label: '# of Votes',
        data: [0, 0, 0, 9, 9, 0],
        backgroundColor: 'orange'
      },
      {
        label: '# of Votes',
        data: [0, 0, 0, 0, 12, 12],
        backgroundColor: 'blue'
      },
      {
        label: '# of Votes',
        data: [4, 4, 0, 0, 0, 0],
        backgroundColor: 'green'
      },
      {
        label: '# of Votes',
        data: [0, 0, 6, 6, 0, 0],
        backgroundColor: 'red'
      },
      {
        label: '# of Votes',
        data: [12, 0, 0, 0, 0, 12],
        backgroundColor: 'purple'
      }
    ]
  },
  options: {}
}

const ctx = document.getElementById('chartJSContainer').getContext('2d');
new Chart(ctx, options);

https://jsfiddle.net/bf5ntagj/

Cool and creative workaround, thanks @LeeLenaleee! I'll definitely consider it, but i'm working in a webapp which generates those kind of charts generically, the number of "sides" varies a lot in a range between 2 or 3 up to 15-20, so filling up those different-sized-arrays with zeroes at the rights spots programmatically may become messy. Also i think there are some trade-offs regarding tooltip-bahaviour and label display.

I messed around with the ArcElement borderRadius trying to achive some similar style, but this is not the right way to do it...

@etimberg etimberg modified the milestones: Version 3.8.0, Version 3.9 May 22, 2022
@etimberg
Copy link
Member

I don't think we'll get to this before 3.8.0 releases, but I'm happy to look at a PR

@4minus
Copy link
Author

4minus commented Jun 1, 2022

Thanks @etimberg for the outlook. I'm not sure if i'm skilled enough to do it on my own, but maybe i'll give it a try.

@4minus
Copy link
Author

4minus commented Aug 3, 2022

awesome! thank you guys!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants