gradient problem


Hi,

I want set a gradient color in hierechiecal tree

But, in your example


I can set the gradient color, but when the background color can not be gradient, so its ugly.

And if I remove the margin, I can't set the height of node

    if (linearGradient) {
      obj.style = { gradient: linearGradient };
      obj.backgroundColor = 'inherit';
    } else {
      obj.style = { fill: backgroundColorstrokeColor: 'none'color: 'white'strokeWidth: 2  };
      obj.backgroundColor = backgroundColor;
    }

     (obj.shape as TextModel).margin = { left: 5right: 5bottom: 5top: 5 };


1 Reply 1 reply marked as answer

GG Gowtham Gunashekar Syncfusion Team February 17, 2021 01:07 PM UTC

Hi Manolo, 

On our further analysis of the shared link, the margin for the text node has added, that cause the backgroundColor is applied as like node border. The gradient is only applicable for the node and the node had the margin “5px” in each side that cause the background color appeared a border. 

It’s the behavior of the diagram, we suggest you to remove the margin and apply width and height of the node or else use some other node instead of text node. We have added the sample link to demonstrate how to render text node and apply gradient. 
 


Regards, 
Gowtham  


Marked as answer
Loader.
Up arrow icon