AnsweredAssumed Answered

Custom Vision symbol resize help

Question asked by ydim on Aug 16, 2019
Latest reply on Aug 16, 2019 by ydim

Hey team,

 

I've developed a custom symbol that uses the XY graph from the amcharts library and need some help handling resize events. I'd like the symbol to keep its aspect ratio (square) as it is resized in Vision. 

 

In the symbol definition variable I've set 
resizerMode: 'RetainAspectRatio' 
but this didn't change the resize behaviour as the symbol can still be resized in any direction, width and height independently in the vision window. 
I haven't set a callback resize function to this.onResize because I'm not sure the right way to tackle it. 
Some of the resize function prototypes I've come across on the OSI github go something like this for the highcharts library

 

function resize(width,height){
   chart.setSize(width, height);    
}
From what i can see, amcharts does not have a helper function like this for resizing the symbol,

so i guess my questions are, is there a way to force the symbol so it only allows resize dragging "diagonally" inside the vision window? 

and if not, I'd need to tackle this through a resize callback function. I'm not too worried about the specific logic of the function, but I'm not sure where the width and height parameters being sent from, and what property of the chart object or scope.config needs to be set inside the resize function to manually set the width and height? 
For example, in the configuration change function, to change the colour of the background we would do something like:
chartObject.backgroundColor = scope.config.backgroundColor; 
However these properties have a handle to the array that defines the amchats graph ("type": "xy", "backgroundColor": scope.config.backgroundColor and so on... ) whereas the width and height are not defined here. 

 

Thanks, 

 

 

YD

Outcomes