Skip to content

feat: support for overriding color for a data point using a method #902

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

Merged
merged 9 commits into from
Jun 4, 2021

Conversation

arjunlalb
Copy link
Contributor

Description

support for overriding color for a data point using a method

Testing

Manually tested. UTs added.

Checklist:

  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • Any dependent changes have been merged and published in downstream modules

@arjunlalb arjunlalb requested a review from a team as a code owner June 4, 2021 06:43
@codecov
Copy link

codecov bot commented Jun 4, 2021

Codecov Report

Merging #902 (11ade91) into main (89cf9f1) will decrease coverage by 0.00%.
The diff coverage is 50.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #902      +/-   ##
==========================================
- Coverage   85.38%   85.38%   -0.01%     
==========================================
  Files         803      803              
  Lines       16492    16496       +4     
  Branches     2067     2069       +2     
==========================================
+ Hits        14082    14085       +3     
- Misses       2378     2379       +1     
  Partials       32       32              
Impacted Files Coverage Δ
.../components/cartesian/cartesian-chart.component.ts 75.80% <0.00%> (-1.25%) ⬇️
...rvability/src/shared/components/cartesian/chart.ts 100.00% <ø> (ø)
...nents/cartesian/d3/data/series/cartesian-column.ts 75.75% <60.00%> (+1.15%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 89cf9f1...11ade91. Read the comment docs.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

context.fill();
context.stroke();
context.resetTransform();
});
}

private getColorForDatum(datum: TData): string {
return this.series.getColor ? this.series.getColor(datum) : this.series.color;
Copy link
Contributor

Choose a reason for hiding this comment

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

this can shorten with optional function access, but a broader question - wouldn't it make more sense to support specifying a color on the data object rather than a lookup function? that is: {x, y, color}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it is possible, but the actual contents of the series is generic. Doing it that way would be much more intrusive and may have a broader impact across cartesians.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

updated to use optional function access.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@arjunlalb arjunlalb merged commit 00dc01c into main Jun 4, 2021
@arjunlalb arjunlalb deleted the chart-color-per-data-point branch June 4, 2021 13:42
@github-actions
Copy link

github-actions bot commented Jun 4, 2021

Unit Test Results

    4 files  ±0  257 suites  ±0   15m 54s ⏱️ +27s
926 tests +1  926 ✔️ +1  0 💤 ±0  0 ❌ ±0 
932 runs  +1  932 ✔️ +1  0 💤 ±0  0 ❌ ±0 

Results for commit 00dc01c. ± Comparison against base commit 89cf9f1.

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