This is a migrated thread and some comments may be shown as answers.

Text won't center

3 Answers 95 Views
Diagram
This is a migrated thread and some comments may be shown as answers.
Yngve
Top achievements
Rank 1
Yngve asked on 09 Aug 2017, 09:08 AM

Hi,

 

I'm struggling to center my text inside a Diagram box. I followed this example, but it still doesn't work. Here's my code :

 

The diagram

The visualTemplate function

 

 

 

 

 

3 Answers, 1 is accepted

Sort by
0
Yngve
Top achievements
Rank 1
answered on 09 Aug 2017, 09:09 AM
And here's an example of how it looks
0
Yngve
Top achievements
Rank 1
answered on 09 Aug 2017, 09:11 AM

The file wouldnt attach. Trying again..with a link as well.

Image

0
Stefan
Telerik team
answered on 11 Aug 2017, 06:03 AM
Hello Yngve,

Thank you for the provided information.

After inspecting the used example and the real code, I can assume that the issue may occur due to the text length and the set width and height of the diagram box.

I can suggest setting only one of the TextFields instead of all of them to observe if there is only one item it will be centred:

layout.append(new dataviz.diagram.TextBlock({
            text: dataItem.TextFields[0],
            fontFamily: "DejaVu Sans",
            color: "black"


If the issue still occurs, please provide a runnable example, as this will help us inspect it locally and provide a suggestion best suited for it.

Regards,
Stefan
Progress Telerik
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
Diagram
Asked by
Yngve
Top achievements
Rank 1
Answers by
Yngve
Top achievements
Rank 1
Stefan
Telerik team
Share this question
or