Skip to content

Commit

Permalink
fix: add watermark for chart
Browse files Browse the repository at this point in the history
  • Loading branch information
SarjuHansaliya committed Mar 18, 2024
1 parent 635a707 commit 4f44a99
Show file tree
Hide file tree
Showing 3 changed files with 124 additions and 68 deletions.
157 changes: 92 additions & 65 deletions superset-frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions superset-frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,7 @@
"react-test-renderer": "^16.9.0",
"redux-mock-store": "^1.5.4",
"sinon": "^9.0.2",
"source-map": "^0.7.4",
"source-map-support": "^0.5.21",
"speed-measure-webpack-plugin": "^1.5.0",
"storybook-addon-jsx": "^7.3.14",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ import { slicePropShape, chartPropShape } from '../../util/propShapes';

import { isFilterBox } from '../../util/activeDashboardFilters';
import getFilterValuesByFilterId from '../../util/getFilterValuesByFilterId';
import watermarkImage from '../../../assets/images/ortege-logo-horiz.png';

const propTypes = {
id: PropTypes.number.isRequired,
Expand Down Expand Up @@ -119,6 +120,29 @@ const ChartOverlay = styled.div`
z-index: 5;
`;


const ChartWaterMark = styled.div`
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
max-width: min(50%,20rem);
max-height: min(25%,20rem);
margin: auto;
pointer-events: none;
opacity: .2;
display: flex;
justify-content: center;
align-items: center;
`;

const WatermarkImage = styled.img`
max-width: 100%;
max-height: 100%;
`;


const SliceContainer = styled.div`
display: flex;
flex-direction: column;
Expand Down Expand Up @@ -424,9 +448,9 @@ class Chart extends React.Component {
const isOverflowable = OVERFLOWABLE_VIZ_TYPES.has(slice.viz_type);
const initialValues = isFilterBox(id)
? getFilterValuesByFilterId({
activeFilters: filters,
filterId: id,
})
activeFilters: filters,
filterId: id,
})
: {};

return (
Expand Down Expand Up @@ -504,6 +528,10 @@ class Chart extends React.Component {
/>
)}

<ChartWaterMark>
<WatermarkImage src={watermarkImage} />
</ChartWaterMark>

<ChartContainer
width={width}
height={this.getChartHeight()}
Expand Down

0 comments on commit 4f44a99

Please sign in to comment.