-
Notifications
You must be signed in to change notification settings - Fork 32
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: Add option to disable WebGL rendering #2134
Merged
Merged
Changes from 2 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
73431ca
feat: Add option to disable WebGL rendering
mofojed 9059965
Add override to add contrast to Switch component when off
mofojed ba01275
Address review comments
mofojed da98278
Move to theme-*-components.css instead
mofojed c477869
Update packages/components/src/theme/theme-light/theme-light-componen…
dsmmcken File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -681,17 +681,22 @@ class ChartUtils { | |
* Converts the Iris plot style into a plotly chart type | ||
* @param plotStyle The plotStyle to use, see dh.plot.SeriesPlotStyle | ||
* @param isBusinessTime If the plot is using business time for an axis | ||
* @param allowWebGL If WebGL is allowedd | ||
*/ | ||
getPlotlyChartType( | ||
plotStyle: DhType.plot.SeriesPlotStyle, | ||
isBusinessTime: boolean | ||
isBusinessTime: boolean, | ||
allowWebGL: boolean | ||
): PlotType | undefined { | ||
const { dh } = this; | ||
switch (plotStyle) { | ||
case dh.plot.SeriesPlotStyle.SCATTER: | ||
case dh.plot.SeriesPlotStyle.LINE: | ||
// scattergl mode is more performant, but doesn't support the rangebreaks we need for businessTime calendars | ||
return !isBusinessTime && IS_WEBGL_SUPPORTED ? 'scattergl' : 'scatter'; | ||
// scattergl mode is more performant (usually), but doesn't support the rangebreaks we need for businessTime calendars | ||
// In some cases, WebGL is less performant (like in virtual desktop environments), so we also allow the option of the user explicitly disabling it even if it's supported | ||
return !isBusinessTime && IS_WEBGL_SUPPORTED && allowWebGL | ||
? 'scattergl' | ||
: 'scatter'; | ||
case dh.plot.SeriesPlotStyle.BAR: | ||
case dh.plot.SeriesPlotStyle.STACKED_BAR: | ||
return 'bar'; | ||
|
@@ -871,7 +876,8 @@ class ChartUtils { | |
series: DhType.plot.Series, | ||
axisTypeMap: AxisTypeMap, | ||
seriesVisibility: boolean | 'legendonly', | ||
showLegend: boolean | null = null | ||
showLegend: boolean | null = null, | ||
allowWebGL = true | ||
): Partial<PlotData> { | ||
const { | ||
name, | ||
|
@@ -888,7 +894,7 @@ class ChartUtils { | |
const isBusinessTime = sources.some( | ||
source => source.axis?.businessCalendar | ||
); | ||
const type = this.getChartType(plotStyle, isBusinessTime); | ||
const type = this.getChartType(plotStyle, isBusinessTime, allowWebGL); | ||
const mode = this.getPlotlyChartMode( | ||
plotStyle, | ||
isLinesVisible ?? undefined, | ||
|
@@ -1019,7 +1025,8 @@ class ChartUtils { | |
|
||
getChartType( | ||
plotStyle: DhType.plot.SeriesPlotStyle, | ||
isBusinessTime: boolean | ||
isBusinessTime: boolean, | ||
allowWebGL: boolean | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should this be mentioned as a BREAKING CHANGE? |
||
): PlotType | undefined { | ||
const { dh } = this; | ||
switch (plotStyle) { | ||
|
@@ -1028,7 +1035,7 @@ class ChartUtils { | |
// plot.ly to calculate the bins and sum values, just convert it to a bar chart | ||
return 'bar'; | ||
default: | ||
return this.getPlotlyChartType(plotStyle, isBusinessTime); | ||
return this.getPlotlyChartType(plotStyle, isBusinessTime, allowWebGL); | ||
} | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
70 changes: 70 additions & 0 deletions
70
packages/code-studio/src/settings/AdvancedSectionContent.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
import React, { useCallback } from 'react'; | ||
import { useDispatch, useSelector } from 'react-redux'; | ||
import { | ||
Content, | ||
ContextualHelp, | ||
Heading, | ||
Switch, | ||
Text, | ||
} from '@deephaven/components'; | ||
import { | ||
getWebGL, | ||
getWebGLEditable, | ||
RootState, | ||
updateSettings, | ||
} from '@deephaven/redux'; | ||
|
||
function AdvancedSectionContent(): JSX.Element { | ||
const dispatch = useDispatch(); | ||
const webgl = useSelector<RootState>(getWebGL) as boolean; | ||
mofojed marked this conversation as resolved.
Show resolved
Hide resolved
|
||
const webglEditable = useSelector<RootState>(getWebGLEditable) as boolean; | ||
|
||
const handleWebglChange = useCallback( | ||
newValue => { | ||
dispatch(updateSettings({ webgl: newValue })); | ||
}, | ||
[dispatch] | ||
); | ||
|
||
const helpText = webglEditable ? ( | ||
<Text> | ||
WebGL in most cases has significant performance improvements, particularly | ||
when plotting large datasets. However, in some environments (such as | ||
remote desktop environments), WebGL may not use hardware acceleration and | ||
have degraded performance. If you are experiencing issues with WebGL, you | ||
can disable it here. | ||
</Text> | ||
) : ( | ||
<Text> | ||
WebGL is disabled by your system administrator. Contact your system | ||
administrator to enable. | ||
</Text> | ||
); | ||
|
||
return ( | ||
<> | ||
<div className="app-settings-menu-description"> | ||
Advanced settings here. Be careful! | ||
</div> | ||
|
||
<div className="form-row mb-3 pl-1"> | ||
<Switch | ||
isSelected={webgl} | ||
isDisabled={!webglEditable} | ||
onChange={handleWebglChange} | ||
marginEnd="size-0" | ||
> | ||
Enable WebGL | ||
</Switch> | ||
<ContextualHelp variant="info" marginTop="size-50"> | ||
<Heading>Enable WebGL</Heading> | ||
<Content> | ||
<Text>{helpText}</Text> | ||
</Content> | ||
</ContextualHelp> | ||
</div> | ||
</> | ||
); | ||
} | ||
|
||
export default AdvancedSectionContent; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Should this be mentioned as a BREAKING CHANGE?
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'll just default it to
true
to avoid making it a breaking change. I wanted to make sure I caught all the places where it was called from though.