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

feat: allow styling bar chart series' labels #10958

Closed
wants to merge 6 commits into from

Conversation

joaoviana
Copy link
Contributor

@joaoviana joaoviana commented Aug 1, 2024

Closes:

Description:

WIP:

change-label.mov

Reviewer actions

  • I have manually tested the changes in the preview environment
  • I have reviewed the code
  • I understand that "request changes" will block this PR from merging

@owlas owlas requested a deployment to feat/allow-styling-bar-chart-series - jaffle_db_pg_13 PR #10958 August 1, 2024 13:18 — with Render Abandoned
@owlas owlas deployed to feat/allow-styling-bar-chart-series - headless-browser PR #10958 August 1, 2024 13:18 — with Render Active
Copy link

netlify bot commented Aug 1, 2024

Deploy Preview for peaceful-bassi-cbf284 canceled.

Name Link
🔨 Latest commit 3463265
🔍 Latest deploy log https://app.netlify.com/sites/peaceful-bassi-cbf284/deploys/66ab8d138fe797000842047c

@owlas owlas temporarily deployed to feat/allow-styling-bar-chart-series - lightdash PR #10958 August 1, 2024 13:19 — with Render Destroyed
@owlas owlas temporarily deployed to feat/allow-styling-bar-chart-series - lightdash PR #10958 August 1, 2024 13:19 — with Render Destroyed
@owlas owlas deployed to feat/allow-styling-bar-chart-series - headless-browser PR #10958 August 1, 2024 13:19 — with Render Active
@owlas owlas deployed to feat/allow-styling-bar-chart-series - headless-browser PR #10958 August 1, 2024 13:26 — with Render Active
Comment on lines 201 to 207
// Remove series styling if only one y axis field left
if (
state.config.fieldConfig.y.length === 1 &&
state.config.display?.series
) {
state.config.display.series = undefined;
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does this make sense to you @owlas?
So when there's only one y axis, then there's no extra fields, so we can clear the series styling. LMK if you want this somewhere else

@@ -25,6 25,31 @@ export class BarChartDataTransformer<TBarChartLayout, TPieChartConfig> {

const DEFAULT_X_AXIS_TYPE = 'category';

const series = transformedData?.seriesColumns.map(
(seriesColumn, index) => {
const seriesLabel = Object.values(display?.series || {}).find(
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is where I'm a bit confused if I should do it this way @owlas

We want to get the label, we know the series is an object where the key is a reference and the values include yAxisIndex
Would you do this differently or potentially change the structure of series? 🤔

seriesColumn,
],
type: 'bar',
name: seriesLabel || friendlyName(seriesColumn),
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@owlas I'm not sure what to do with this seriesColumn because when there's no label applied, we default to this which is like "Sum of Customer id", but on the Styling panel we don't have access to that seriesColumn, so we default to reference, which will be something like customer_id - what would you do here?
Would you keep this friendlyName(seriesColumn) and keep the input empty if no override on the styling panel?

@owlas owlas temporarily deployed to feat/allow-styling-bar-chart-series - headless-browser PR #10958 August 4, 2024 17:08 — with Render Destroyed
@owlas owlas temporarily deployed to feat/allow-styling-bar-chart-series - lightdash PR #10958 August 4, 2024 17:08 — with Render Destroyed
@joaoviana
Copy link
Contributor Author

Closing due to lack of capacity

@joaoviana joaoviana closed this Aug 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants