Adds padding property to charts widget (#2029)

* added padding property to charts widget

* working on padding problem

* Changed default padding value
This commit is contained in:
Muhsin Shah C P 2022-01-31 21:47:33 +05:30 committed by GitHub
parent 0a253ef0c3
commit 0869fb06fb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 1 deletions

View file

@ -9,7 +9,7 @@ const Plot = createPlotlyComponent(Plotly);
export const Chart = function Chart({ width, height, darkMode, properties, styles }) {
const [loadingState, setLoadingState] = useState(false);
const { visibility, disabledState } = styles;
const { padding, visibility, disabledState } = styles;
const { title, markerColor, showGridLines, type, data, jsonDescription, plotFromJson } = properties;
useEffect(() => {
@ -55,11 +55,19 @@ export const Chart = function Chart({ width, height, darkMode, properties, style
showgrid: showGridLines,
showline: true,
color: fontColor,
automargin: true,
},
yaxis: {
showgrid: showGridLines,
showline: true,
color: fontColor,
automargin: true,
},
margin: {
l: padding,
r: padding,
b: padding,
t: padding,
},
};

View file

@ -188,6 +188,7 @@ export const componentTypes = [
},
events: {},
styles: {
padding: { type: 'code', displayName: 'Padding' },
visibility: { type: 'code', displayName: 'Visibility' },
disabledState: { type: 'code', displayName: 'Disable' },
},
@ -235,6 +236,7 @@ export const componentTypes = [
},
events: [],
styles: {
padding: { value: '50' },
visibility: { value: '{{true}}' },
disabledState: { value: '{{false}}' },
},