carbon-design-system / carbon-charts

:bar_chart: :chart_with_upwards_trend:⠀Robust dataviz framework implemented using D3 & typescript
https://charts.carbondesignsystem.com
Apache License 2.0
901 stars 184 forks source link

Allow removal of legends/labels in charts and removal of '%' labels at the outer of donut charts #379

Closed jagdishkumar1 closed 1 year ago

jagdishkumar1 commented 4 years ago

I am submitting a...

charts version: 0.16.8

Issue description

I am trying to achieve something like below:

image

what I am able to achieve with current carbon-charts is below: image

so , what can I do to closely match with the expected behaviour shown in first snapshot ?

1) How can I use to reduce the gap between the donut chart and labels on the right ? 2) How can I use to remove the labels (%) displayed at the outer of donut chart ? 3) What config can I use to remove labels displayed on the right ? 4) How can I remove the grid in bar chart ? 5) Labels/legends should always appear to the right of donut chart, and not like whats shown in second snapshot with + sign at the top right of donut chart

theiliad commented 4 years ago

This is mostly up for @cameroncalder's review. Would we want to allow for any of those customizations?

scottdickerson commented 4 years ago

@theiliad with the new legend options in 0.16.24 version, can we just add a "disabled" legend option to achieve?

theiliad commented 4 years ago

@theiliad with the new legend options in 0.16.24 version, can we just add a "disabled" legend option to achieve?

yeah we could, it's just a matter of design approval for disabling legends

jagdishkumar1 commented 4 years ago

Similar requirement on line chart as well ..

Expectation:

image

Current support:

image

Requirements: 2) Removal of grid and Y-axis line 3) legends positioned to the right of charts

jagdishkumar1 commented 4 years ago

Is there any config which can support the positioning on legends (top / right / left / bottom) in any chart ?

Expectation :

image

Here, legends are expected to be positioned at the bottom of bar chart

cameroncalder commented 4 years ago

@theiliad @jagdishkumar1 Many of the points above are quite acceptable and should allow for configuration. Particularly the following:

Removing the legend has appropriate use cases. For example, if there is only a single data category being visualized and the title of the chart provides enough context.

The option to remove labels on a donut/pie chart is reasonable as well. Or making the labels numbers to the whole instead of percentages. If labels are removed though, I recommend leveraging the Carbon charts legend style instead of the style shown in the example.

pcoccoli commented 4 years ago

I also need to remove the legend (since there's only a single data category in my charts). This is required for my 1Q release. @cameroncalder does your comment above count as design approval?

theiliad commented 4 years ago

Is there any config which can support the positioning on legends (top / right / left / bottom) in any chart ?

Expectation :

image

Here, legends are expected to be positioned at the bottom of bar chart

You can position the legend using this config in the chart options:

{
  legend: {
    position: "top" | "left" | "bottom" | "right"
  }
}
jagdishkumar1 commented 4 years ago

@cameroncalder @theiliad let me know if the features requested as part of this issue are in place, so that we can start leveraging them ? Thanks

zhenwan commented 4 years ago

I also need to remove the labels (%) displayed at the outer of donut chart, is this feature already available in latest version ?

natashadecoste commented 3 years ago

PR #927 should provide the option to enable/disable the labels on pie/donut

daniel-m-s commented 2 years ago

@cameroncalder, you wrote above "Or making the labels numbers to the whole instead of percentages. ". Is that already possible or will be for the donut chart ? Also would it be possible to choose to display the whole numbers next to the legend color squares as shown in the initial screenshot from @jagdishkumar1 at the top of this discussion ?

theiliad commented 2 years ago

@cameroncalder, you wrote above "Or making the labels numbers to the whole instead of percentages. ". Is that already possible or will be for the donut chart ? Also would it be possible to choose to display the whole numbers next to the legend color squares as shown in the initial screenshot from @jagdishkumar1 at the top of this discussion ?

Hi @daniel-m-s, This is really something for @jeanservaas to chime in now

jeanservaas commented 2 years ago

@daniel-m-s

Sorry, took me a second to realize what was going on here. Cameron is OG Charts and has approval rights. He's giving approval on:

But to your question above daniel, i think what he's saying is to use Carbon styling if the whole numbers are removed from the donut chart and used instead IN the legend next to the label.

Here's an example from our guidance of how we do that: the percentage comes after the label in semibold. @cameroncalder is this what you meant?

image

daniel-m-s commented 2 years ago

Thanks @jeanservaas ! Your screenshot shows what we need, just with the option to display absolute values instead of percentages. @theiliad, if you have an outlook when you'll be able to implement this, let me know please.