-
Notifications
You must be signed in to change notification settings - Fork 14.3k
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
Allow users to select color for big number #5694
Conversation
|
||
|
||
export const rgbToHex = function (color) { | ||
console.log(color); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oops
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can use d3-color
instead of writing a new module
@@ -1247,6 +1247,7 @@ export const visTypes = { | |||
['compare_lag', 'compare_suffix'], | |||
['y_axis_format', null], | |||
['show_trend_line', 'start_y_axis_at_zero'], | |||
['color', null], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was surprised to see that color isn't renderTrigger: true
, looks like color
isn't used anywhere, but color_picker
is and behaves as expected.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like it has the right default of brandPrimary too.
@@ -593,3 +593,12 @@ export function hexToRGB(hex, alpha = 255) { | |||
const b = parseInt(hex.slice(5, 7), 16); | |||
return [r, g, b, alpha]; | |||
} | |||
|
|||
|
|||
export const rgbToHex = function (color) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you meant to use rgbToHex
in BigNumber.jsx
@@ -237,6 +237,11 @@ function adaptor(slice, payload) { | |||
const formatValue = d3FormatPreset(formData.y_axis_format); | |||
const bigNumber = supportTrendline ? data[data.length - 1][1] : data[0][0]; | |||
|
|||
const { color } = formData; | |||
const userColor = '#' + ('0' + parseInt(color.r, 10).toString(16)).slice(-2) + |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use the function in colors.js
Codecov Report
@@ Coverage Diff @@
## master #5694 +/- ##
=========================================
- Coverage 63.49% 62.79% -0.7%
=========================================
Files 360 361 +1
Lines 22934 23535 +601
Branches 2555 2700 +145
=========================================
+ Hits 14562 14779 +217
- Misses 8357 8741 +384
Partials 15 15
Continue to review full report at Codecov.
|
@hughhhh Code looks good. One question is what is the default color then? If user did not set |
@kristw it comes from |
* allow user to choose color * add color control * remove rgbToHex reference * change to color picker control * add d3-color * remove module * use d3-colors * add semicolon (cherry picked from commit b92e730)
* allow user to choose color * add color control * remove rgbToHex reference * change to color picker control * add d3-color * remove module * use d3-colors * add semicolon (cherry picked from commit b92e730)
* allow user to choose color * add color control * remove rgbToHex reference * change to color picker control * add d3-color * remove module * use d3-colors * add semicolon
Added color picker control to BigNumber Viz
@kristw @williaster @mistercrunch @betodealmeida