-
Notifications
You must be signed in to change notification settings - Fork 185
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: enable chart grid enable option #761
Conversation
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.
we should probably allow individual grid enablement flags...
e.g. x is active but y is disabled
@@ -15,7 +15,7 @@ export class Grid extends Component { | |||
const gridEnable = Tools.getProperty( |
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.
const gridEnable = Tools.getProperty( | |
const isGridEnabled = Tools.getProperty( |
@@ -15,7 +15,7 @@ export class Grid extends Component { | |||
const gridEnable = Tools.getProperty( | |||
this.model.getOptions(), | |||
"grid", | |||
"enable" | |||
"enabled" | |||
); | |||
if (!gridEnable) { |
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.
if (!gridEnable) { | |
if (!gridEnable) { |
packages/core/src/configuration.ts
Outdated
@@ -62,7 +62,7 @@ const legend: LegendOptions = { | |||
*/ | |||
export const grid: GridOptions = { | |||
// set enable to false will not draw grid and stroke of grid backdrop | |||
enable: true, | |||
enabled: false, |
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.
grid cannot be disabled by default
} @else { | ||
fill: $ui-background; | ||
} | ||
} |
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.
why do we need this extra classname?
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.
The reason why we need chart-grid-backdrop-no-stroke
classname is because we don't want to apply stroke around the chart when there is no grid line.
x grid and y grid can now be enabled or disabled separately |
packages/core/src/configuration.ts
Outdated
// set enable to false will not draw grid and stroke of grid backdrop | ||
xGridEnabled: true, | ||
yGridEnabled: true, | ||
|
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 this should go within the x and y configurations like this
grid:{
x: {
enabled: true,
numberOfTicks: 15
},
y: {
enabled: true,
numberOfTicks: 15
}
}
or maybe "visible" is a better word... since its still enabled/functional
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.
Based on @theiliad 's input. I will use "enabled".
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.
Hi 👋
Please include some more demos and screenshots so we can see this in action when reviewing, thanks.
@@ -85,9 +85,11 @@ export interface ThresholdOptions { | |||
|
|||
export interface GridOptions { | |||
y?: { | |||
yGridEnabled?: boolean; |
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.
again, we always will want to keep things consistent by using enabled
"rect.chart-grid-backdrop" | ||
this.isXGridEnabled || this.isYGridEnabled | ||
? "rect.chart-grid-backdrop.stroke" | ||
: "rect.chart-grid-backdrop" |
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.
seems like stroke should be a separate configurable no?
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.
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.
actually I think stroke might be something we'd always want to keep unless overriden
@jeanservaas could you please chime in?
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.
Hi @theiliad and @jeanservaas,
There is the situation when we don't want to show the stroke.
@@ -7,6 +7,8 @@ | |||
} @else { | |||
fill: $ui-background; | |||
} | |||
} | |||
rect.stroke { |
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.
rect.stroke { | |
rect.chart-grid-backdrop.stroked { |
@@ -231,7 +243,9 @@ export class Ruler extends Component { | |||
this.backdrop = DOMUtils.appendOrSelect(svg, "svg.chart-grid-backdrop"); | |||
const backdropRect = DOMUtils.appendOrSelect( | |||
this.backdrop, | |||
"rect.chart-grid-backdrop" | |||
this.isXGridEnabled || this.isYGridEnabled | |||
? "rect.chart-grid-backdrop.stroke" |
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.
? "rect.chart-grid-backdrop.stroke" | |
? "rect.chart-grid-backdrop.stroked" |
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.
again my feedback here still applies. seems like Ruler
doesn't need to style the backdrop, just needs to grab it.
this piece seems to be in there by mistake from our previous commits.
Are you able to remove all the styling pieces for the backdrop from Ruler
and test whether things still work? We should remove any of it that doesn't break charts.
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.
Removing the code for styling backdrop in Ruler
component has already been done in #765
@@ -197,7 +218,9 @@ export class Grid extends Component { | |||
this.backdrop = DOMUtils.appendOrSelect(svg, "svg.chart-grid-backdrop"); | |||
const backdropRect = DOMUtils.appendOrSelect( | |||
this.backdrop, | |||
"rect.chart-grid-backdrop" | |||
isXGridEnabled || isYGridEnabled | |||
? "rect.chart-grid-backdrop.stroke" |
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.
? "rect.chart-grid-backdrop.stroke" | |
? "rect.chart-grid-backdrop.stroked" |
…to ruler-option * 'master' of https://github.com/JennChao/carbon-charts: v0.36.4 Merge pull request carbon-design-system#761 from JennChao/sparkline Merge pull request carbon-design-system#793 from hlyang397/update-initial-zoom-domain fix the defect of label tooltip not showing when using custom tooltip (carbon-design-system#787) v0.36.3 Merge pull request carbon-design-system#785 from sophiiae/skeleton-with-data
…to scatter-option * 'master' of https://github.com/JennChao/carbon-charts: v0.36.4 Merge pull request carbon-design-system#761 from JennChao/sparkline Merge pull request carbon-design-system#793 from hlyang397/update-initial-zoom-domain fix the defect of label tooltip not showing when using custom tooltip (carbon-design-system#787) v0.36.3 Merge pull request carbon-design-system#785 from sophiiae/skeleton-with-data
…to linearGradient * 'master' of https://github.com/JennChao/carbon-charts: v0.36.4 Merge pull request carbon-design-system#761 from JennChao/sparkline Merge pull request carbon-design-system#793 from hlyang397/update-initial-zoom-domain fix the defect of label tooltip not showing when using custom tooltip (carbon-design-system#787) v0.36.3 Merge pull request carbon-design-system#785 from sophiiae/skeleton-with-data
…to axis-option * 'master' of https://github.com/JennChao/carbon-charts: v0.36.4 Merge pull request carbon-design-system#761 from JennChao/sparkline Merge pull request carbon-design-system#793 from hlyang397/update-initial-zoom-domain fix the defect of label tooltip not showing when using custom tooltip (carbon-design-system#787) v0.36.3 Merge pull request carbon-design-system#785 from sophiiae/skeleton-with-data
…to tooltip-option * 'master' of https://github.com/JennChao/carbon-charts: v0.37.1 Merge pull request carbon-design-system#800 from metonym/fix-svelte-base-chart v0.37.0 Merge pull request carbon-design-system#780 from natashadecoste/fix-meter-max-val feat: enable or disable scatter dot on charts except scatter chart (carbon-design-system#769) feat: create options for tick rotation (carbon-design-system#770) v0.36.4 Merge pull request carbon-design-system#761 from JennChao/sparkline Merge pull request carbon-design-system#793 from hlyang397/update-initial-zoom-domain fix the defect of label tooltip not showing when using custom tooltip (carbon-design-system#787) v0.36.3 Merge pull request carbon-design-system#785 from sophiiae/skeleton-with-data
* feat: enable chart grid enable option * refactor: rename grid option * refactor: rename gridEnabled to isGridEnabled * fix: enable grid as default setting * feat: enable or disable x and y grid separately * refactor: interface modification for xGridEnabled and yGridEnabled * refactor: rename grid option * refactor: rename class Co-authored-by: Fei Z <[email protected]>
Updates
Sometimes user might not want to see chart grid. This PR provide the option of showing or not showing chart grid.
Demo screenshot or recording
Review checklist (for reviewers only)