Handle width and height of chart js custom component via traits in grapes js #4538
Unanswered
Aadarsh4u-code
asked this question in
Q&A
Replies: 2 comments 1 reply
-
@Aadarsh4u-code I'm wondering why you don't simply rely on component styles?! That should also allow you to have responsive components based on the device. |
Beta Was this translation helpful? Give feedback.
0 replies
-
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Let's say I have a custom component of a line chart from ChartJS. While dropping the Line chart in the canvas of grapes js editor it is taking its default width and height which is very big as expected. I would like to handle its size with traits. but could not able to get how to handle it via trait setting of this component. Help, please.
`

//block
export const LineChartBlock = (bm, category,label, type) => {
bm.add(type, //lineChart
{
label, //lineChart
category, //charts
content: '',
});
};
//components
export default (dc, tm, label, type, config) => {
const defaultType = dc.getType('default');
const defaultView = defaultType.view;
dc.addType(type, {
model: {
defaults: {
traits: [
{
type: 'text',
label: 'Width',
placeholder: 'width in px',
name: 'width',
changeProp: 1,
},
{
type: 'text',
label: 'Height',
placeholder: 'height in px',
name: 'height',
changeProp: 1,
}
],
});
};
//editor

`
Beta Was this translation helpful? Give feedback.
All reactions