-
Notifications
You must be signed in to change notification settings - Fork 72
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
[CCI] Revert changes to chart themes #831
Merged
joshuarrrr
merged 3 commits into
opensearch-project:main
from
andreymyssak:810-revert-chart-themes-changes
Jul 5, 2023
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,3 +20,4 @@ | |
|
||
// Elastic charts | ||
@import '~@elastic/charts/dist/theme'; | ||
@import '../../src/themes/charts/theme'; |
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 |
---|---|---|
|
@@ -20,3 +20,4 @@ | |
|
||
// Elastic charts | ||
@import '~@elastic/charts/dist/theme'; | ||
@import '../../src/themes/charts/theme'; |
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 |
---|---|---|
|
@@ -19,3 +19,4 @@ | |
|
||
// Elastic charts | ||
@import '~@elastic/charts/dist/theme'; | ||
@import '../../src/themes/charts/theme'; |
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 |
---|---|---|
|
@@ -19,3 +19,4 @@ | |
|
||
// Elastic charts | ||
@import '~@elastic/charts/dist/theme'; | ||
@import '../../src/themes/charts/theme'; |
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 |
---|---|---|
@@ -0,0 +1,16 @@ | ||
/*! | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* The OpenSearch Contributors require contributions made to | ||
* this file be licensed under the Apache-2.0 license or a | ||
* compatible open source license. | ||
* | ||
* Modifications Copyright OpenSearch Contributors. See | ||
* GitHub history for details. | ||
*/ | ||
|
||
// There should be a good default in EC too | ||
.echAnnotation { | ||
font-size: $ouiFontSizeXS; | ||
font-weight: $ouiFontWeightBold; | ||
} |
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,229 @@ | ||
/* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* The OpenSearch Contributors require contributions made to | ||
* this file be licensed under the Apache-2.0 license or a | ||
* compatible open source license. | ||
* | ||
* Modifications Copyright OpenSearch Contributors. See | ||
* GitHub history for details. | ||
*/ | ||
|
||
/* | ||
* Licensed to Elasticsearch B.V. under one or more contributor | ||
* license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright | ||
* ownership. Elasticsearch B.V. licenses this file to you under | ||
* the Apache License, Version 2.0 (the "License"); you may | ||
* not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
||
import { ouiPaletteColorBlind } from '../../services/color/oui_palettes'; | ||
import { DEFAULT_VISUALIZATION_COLOR } from '../../services/color/visualization_colors'; | ||
import { | ||
PartialTheme, | ||
LineAnnotationStyle, | ||
PartitionConfig, | ||
} from '@elastic/charts'; | ||
|
||
import { RecursivePartial } from '../../components/common'; | ||
|
||
// @ts-ignore typescript doesn't understand the webpack loader | ||
import lightColors from '!!sass-vars-to-js-loader!../../global_styling/variables/_colors.scss'; | ||
// @ts-ignore typescript doesn't understand the webpack loader | ||
import darkColors from '!!sass-vars-to-js-loader!../../themes/oui/oui_colors_dark.scss'; | ||
|
||
const fontFamily = `'Inter UI', -apple-system, BlinkMacSystemFont, | ||
'Segoe UI', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'`; | ||
|
||
export interface OuiChartThemeType { | ||
lineAnnotation: LineAnnotationStyle; | ||
theme: PartialTheme; | ||
partition: RecursivePartial<PartitionConfig>; | ||
} | ||
|
||
function createTheme(colors: any): OuiChartThemeType { | ||
return { | ||
lineAnnotation: { | ||
line: { | ||
strokeWidth: 1, | ||
stroke: colors.ouiColorDarkShade.rgba, | ||
opacity: 1, | ||
}, | ||
details: { | ||
fontSize: 10, | ||
fontFamily: fontFamily, | ||
fill: colors.ouiColorDarkShade.rgba, | ||
padding: 0, | ||
}, | ||
}, | ||
partition: { | ||
fontFamily: fontFamily, | ||
minFontSize: 8, | ||
maxFontSize: 16, | ||
fillLabel: { | ||
textInvertible: false, | ||
valueFont: { | ||
fontWeight: 700, | ||
}, | ||
}, | ||
linkLabel: { | ||
maxCount: 5, | ||
fontSize: 11, | ||
textColor: colors.ouiColorDarkestShade.rgba, | ||
}, | ||
outerSizeRatio: 1, | ||
circlePadding: 4, | ||
sectorLineStroke: colors.ouiColorEmptyShade.rgba, | ||
sectorLineWidth: 1.5, | ||
}, | ||
theme: { | ||
background: { | ||
color: colors.ouiColorEmptyShade.rgba, | ||
}, | ||
chartMargins: { | ||
left: 0, | ||
right: 0, | ||
top: 0, | ||
bottom: 0, | ||
}, | ||
lineSeriesStyle: { | ||
line: { | ||
strokeWidth: 2, | ||
}, | ||
point: { | ||
fill: colors.ouiColorEmptyShade.rgba, | ||
strokeWidth: 2, | ||
radius: 3, | ||
}, | ||
}, | ||
areaSeriesStyle: { | ||
area: { | ||
opacity: 0.3, | ||
}, | ||
line: { | ||
strokeWidth: 2, | ||
}, | ||
point: { | ||
visible: false, | ||
fill: colors.ouiColorEmptyShade.rgba, | ||
strokeWidth: 2, | ||
radius: 3, | ||
}, | ||
}, | ||
barSeriesStyle: { | ||
displayValue: { | ||
fontSize: 8, | ||
fontFamily: fontFamily, | ||
fill: colors.ouiColorDarkShade.rgba, | ||
}, | ||
}, | ||
scales: { | ||
barsPadding: 0.25, | ||
histogramPadding: 0.05, | ||
}, | ||
axes: { | ||
axisTitle: { | ||
fontSize: 12, | ||
fontFamily: fontFamily, | ||
fill: colors.ouiColorDarkestShade.rgba, | ||
padding: { | ||
inner: 10, | ||
outer: 0, | ||
}, | ||
}, | ||
axisLine: { | ||
stroke: colors.ouiColorChartLines.rgba, | ||
}, | ||
tickLabel: { | ||
fontSize: 10, | ||
fontFamily: fontFamily, | ||
fill: colors.ouiColorDarkShade.rgba, | ||
padding: { | ||
outer: 8, | ||
inner: 10, | ||
}, | ||
}, | ||
tickLine: { | ||
visible: false, | ||
stroke: colors.ouiColorChartLines.rgba, | ||
strokeWidth: 1, | ||
}, | ||
gridLine: { | ||
horizontal: { | ||
visible: true, | ||
stroke: colors.ouiColorChartLines.rgba, | ||
strokeWidth: 1, | ||
opacity: 1, | ||
dash: [0, 0], | ||
}, | ||
vertical: { | ||
visible: true, | ||
stroke: colors.ouiColorChartLines.rgba, | ||
strokeWidth: 1, | ||
opacity: 1, | ||
dash: [4, 4], | ||
}, | ||
}, | ||
}, | ||
colors: { | ||
vizColors: ouiPaletteColorBlind({ sortBy: 'natural' }), | ||
defaultVizColor: DEFAULT_VISUALIZATION_COLOR, | ||
}, | ||
crosshair: { | ||
band: { | ||
fill: colors.ouiColorChartBand.rgba, | ||
}, | ||
line: { | ||
stroke: colors.ouiColorDarkShade.rgba, | ||
strokeWidth: 1, | ||
dash: [4, 4], | ||
}, | ||
crossLine: { | ||
stroke: colors.ouiColorDarkShade.rgba, | ||
strokeWidth: 1, | ||
dash: [4, 4], | ||
}, | ||
}, | ||
}, | ||
}; | ||
} | ||
|
||
export const OUI_CHARTS_THEME_LIGHT: OuiChartThemeType = createTheme( | ||
lightColors | ||
); | ||
export const OUI_CHARTS_THEME_DARK: OuiChartThemeType = createTheme(darkColors); | ||
|
||
export const OUI_SPARKLINE_THEME_PARTIAL: PartialTheme = { | ||
lineSeriesStyle: { | ||
point: { | ||
visible: false, | ||
strokeWidth: 1, | ||
radius: 1, | ||
}, | ||
}, | ||
areaSeriesStyle: { | ||
point: { | ||
visible: false, | ||
strokeWidth: 1, | ||
radius: 1, | ||
}, | ||
}, | ||
}; | ||
|
||
/* OUI -> EUI Aliases */ | ||
export interface EuiChartThemeType extends OuiChartThemeType {} | ||
export const EUI_CHARTS_THEME_LIGHT = OUI_CHARTS_THEME_LIGHT; | ||
export const EUI_CHARTS_THEME_DARK = OUI_CHARTS_THEME_DARK; | ||
export const EUI_SPARKLINE_THEME_PARTIAL = OUI_SPARKLINE_THEME_PARTIAL; | ||
/* End of Aliases */ |
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.
Note to self - open issue to look into migrating/removing elastic chart usage from OUI itself.