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

How to change the font size of the shapes in Telerik RadDiagram

1 Answer 223 Views
Diagram
This is a migrated thread and some comments may be shown as answers.
Ned
Top achievements
Rank 1
Ned asked on 16 Jun 2016, 04:19 PM
I am using RadDiagram. It looks like the control doesn't offer the ability of changing font sizes for the texts in shapes. Is there any workaround to change font sizes?
 

1 Answer, 1 is accepted

Sort by
0
Vessy
Telerik team
answered on 17 Jun 2016, 02:08 PM
Hi Nedim,

There are several possible ways to control the font size of the text content inside a shape:
  • You can utilize the Html property of the control, allowing you to embed and style standard html elements inside a shape:
    <telerik:RadDiagram ID="diagram1" runat="server">
        <ShapesCollection>
            <telerik:DiagramShape Id="Shape1" Width="150" Type="Rectangle">
                <ContentSettings Html="<div style='font-size:24px;'>Text content</div>" />
            </telerik:DiagramShape>
        </ShapesCollection>
    </telerik:RadDiagram>
  • You can configure the font size of a TextBlock object, added to the shape's content through the diagram's Visual template functionality:
    var visualTemplate = function (options) {
        var diagram = kendo.dataviz.diagram;
     
        var group = new diagram.Group({
            autoSize: true
        });
     
        var circle = new diagram.Rectangle({
            width: 200,
            height: 100,
            fill: "#32CD32"
        });
        group.append(circle);
     
        var textBlock1 = new diagram.TextBlock({
            text: "Text content",
            color: "#ffffff",
            fontSize: 16,
            x: 28,
            y: 32
        });
        group.append(textBlock1);
     
        return group;
    };
Regards,
Vessy
Telerik
Tags
Diagram
Asked by
Ned
Top achievements
Rank 1
Answers by
Vessy
Telerik team
Share this question
or