Poll
Poll closed Question: how to use custom font in mindfusion org chart ?
bars   pie
*** This poll has now closed ***


in sample.css filr    
  1 (100.0%)
in jquery-ui.min.css file    
  0 (0.0%)
in jquery-ui.structure.min.css file    
  0 (0.0%)
or in jquery-ui.theme.min.css file    
  0 (0.0%)




Total votes: 1
« Created by: Surhar on: Nov 24th, 2017 at 8:33am »
Page Index Toggle Pages: [1] 2 3  Send TopicPrint
Very Hot Topic (More than 25 Replies) custom fonts in org chart (Read 17137 times)
Surhar
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 32
Joined: Nov 23rd, 2017
custom fonts in org chart
Nov 24th, 2017 at 8:33am
Print Post  
i want to create family tree website using mindfusion orgchart structure.. but i want to use custom fonts in it. i used

@font-face {
font-family: 'Kimberley Bl';
src: url('C:/users/admin/fonts/terafont-chandan.ttf') format('truetype');
}

and then use it in the *.js with the diagram objects:

this.getCell(1, 1).setFont(
new Font("Kimberley Bl", 3.5, true /*bold*/, false /*italic*/));
this.getCell(2, 1).setFont(
new Font("Kimberley Bl", 3.5, true /*bold*/, false /*italic*/));

but i cant understand in which css file i should write css code for custom font... Please Reply
  
Back to top
 
IP Logged
 
Lyubo
God Member
*****
Offline


MindFusion team

Posts: 511
Joined: Jun 17th, 2010
Re: custom fonts in org chart
Reply #1 - Nov 24th, 2017 at 9:10am
Print Post  
Hello,

The problem in your case is caused by the fact that the font can't be accessed by using an absolute path URI like 'C:/users/admin/fonts/terafont-chandan.ttf'. You should put the font in a path your webserver can access and use e relative path URI. For example, if your directory structure is like this:
Code
Select All
.\index.html
.\css\style.css
.\fonts\terafont-chandan.ttf 

you should reference the font in the css file like this (note the relative path):
Code (CSS)
Select All
@font-face {
  font-family: 'Kimberley Bl';
  src: url('../fonts/terafont-chandan.ttf') format('truetype');
} 



Regards,
Lyubo
  
Back to top
 
IP Logged
 
Surhar
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 32
Joined: Nov 23rd, 2017
Re: custom fonts in org chart
Reply #2 - Nov 24th, 2017 at 10:48am
Print Post  
i need some more help i used i used 'this.getCell(0, 0).setTextAlignment(Alignment.Center);' for set node text center of the node but whats happen right side margin automatically incressed and some cherectors hided in left side text crosed border of node and result is some text cut out... for exaple if text is 'AKSHAY'A and K is hided loft side and only 'SHAY' displaying and still not in center...please reply early
  
Back to top
 
IP Logged
 
Lyubo
God Member
*****
Offline


MindFusion team

Posts: 511
Joined: Jun 17th, 2010
Re: custom fonts in org chart
Reply #3 - Nov 24th, 2017 at 11:21am
Print Post  
Hi,

Can you post a screenshot here that shows the problem?

Regards,
Lyubo
  
Back to top
 
IP Logged
 
Surhar
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 32
Joined: Nov 23rd, 2017
Re: custom fonts in org chart
Reply #4 - Nov 24th, 2017 at 12:16pm
Print Post  
i attached image i used indian language 'Gujarati' Font when i write code for set text center 'this.getCell(0, 0).setTextAlignment(Alignment.Center);' some text cut from left side i want to text should be wraped when word contain to many charecters please reply..
  

FamilyTree.jpg ( 122 KB | 139 Downloads )
FamilyTree.jpg
Back to top
 
IP Logged
 
Surhar
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 32
Joined: Nov 23rd, 2017
Re: custom fonts in org chart
Reply #5 - Nov 24th, 2017 at 12:28pm
Print Post  
here is project files you can find the problem.. check attached files
  

My_Project_Files.zip ( 7 KB | 140 Downloads )
Back to top
 
IP Logged
 
Lyubo
God Member
*****
Offline


MindFusion team

Posts: 511
Joined: Jun 17th, 2010
Re: custom fonts in org chart
Reply #6 - Nov 24th, 2017 at 1:13pm
Print Post  
Hi,

The OrgChartEditor sample uses custom nodes, which inherit from the TableNode class, which represents a table-like grid with a header.

The text is clipped, because there are two more columns inside the node and they occupy the space to the right. If you don't need the grid capabilities of TableNode, you may achieve better results by using ShapeNode. Alternatively, you can redefine the tables to have only one column, or make use of the columnSpan property.

In your project, in the OrgChartNode constructor, initialize the table with only one column:
Code (Javascript)
Select All
// set up table cells
this.redimTable(1, 4); 

or you can use the columnCount property (you will need v3.2):
Code (Javascript)
Select All
this.setColumnCount(1); 



Regards,
Lyubo
  
Back to top
 
IP Logged
 
Surhar
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 32
Joined: Nov 23rd, 2017
Re: text alignment in orgchart js
Reply #7 - Nov 24th, 2017 at 1:22pm
Print Post  
thack you for reply.. i wrote 'this.redimTable(1, 1);' the result is all nodes are hided..may be some other problem with my code..please check my orgchart.js file and give your suggestion..
  

My_Project_Files_003.zip ( 7 KB | 269 Downloads )
Back to top
 
IP Logged
 
Lyubo
God Member
*****
Offline


MindFusion team

Posts: 511
Joined: Jun 17th, 2010
Re: custom fonts in org chart
Reply #8 - Nov 24th, 2017 at 1:42pm
Print Post  
Hi,

This sample is made with a (3,4), that's why you may be getting errors, which prevent the nodes to draw correctly.

In your example I changed: this.redimTable(3, 4); to this.redimTable(1, 4); and commented out the call to the configureCellsmethod (as it assumes (3,4) grid): //this.configureCells(); and the text is now centered in the nodes.

I would again suggest you look into using ShapeNodes, as it appears that you don't need the functionality that TableNodes provide.

Regards,
Lyubo
  
Back to top
 
IP Logged
 
Surhar
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 32
Joined: Nov 23rd, 2017
Re: text alignment in orgchart js
Reply #9 - Nov 24th, 2017 at 5:32pm
Print Post  
Thank you so much, its working but in long words some word still cut off from both side you can check by using my custom-font download from bellow or you can check by increase font size..if shape node is batter option please explain me how can i use it...
  

Fonts.zip ( 56 KB | 234 Downloads )
Back to top
 
IP Logged
 
Surhar
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 32
Joined: Nov 23rd, 2017
Re: custom fonts in org chart
Reply #10 - Nov 25th, 2017 at 6:50am
Print Post  
Hey Lyudo Please reply i need it so much..
  
Back to top
 
IP Logged
 
Surhar
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 32
Joined: Nov 23rd, 2017
Re: custom fonts in org chart
Reply #11 - Nov 26th, 2017 at 10:49am
Print Post  
The text is in center now but but texts are cut offs in long word names please help me I am eating for your reply
  
Back to top
 
IP Logged
 
Surhar
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 32
Joined: Nov 23rd, 2017
Re: custom fonts in org chart
Reply #12 - Nov 26th, 2017 at 10:50am
Print Post  
The text is in center now but but texts are cut offs in long word names please help me I am eating for your reply
  
Back to top
 
IP Logged
 
Surhar
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 32
Joined: Nov 23rd, 2017
Re: custom fonts in org chart
Reply #13 - Nov 26th, 2017 at 4:01pm
Print Post  
Please reply if you have any idea or if you have no idea Pls suggest me how can I idea for this is there are any other forum for find solutions or any other person in this forum Pls help me...
  
Back to top
 
IP Logged
 
Lyubo
God Member
*****
Offline


MindFusion team

Posts: 511
Joined: Jun 17th, 2010
Re: custom fonts in org chart
Reply #14 - Nov 27th, 2017 at 8:20am
Print Post  
Hi,

As I said earlier, the OrgChart sample assumes table nodes with (3,4) cells grid and will be difficult to customize if you don't need the table features.

To use ShapeNodes, call the diagram Factory's createShapeNode method, set the text, then call risizeToFitText. Add the links between nodes and then arrange the diagram with the TreeLayout.

Information and tutorials on how to use JsDiagram can be found in the chm file supplied with the package and online at https://www.mindfusion.eu/onlinehelp/jsdiagram/index.htm - namely in the Programming Interface Overview and Tutorials topics.

A simple example on how to add shape nodes to the diagram and arrange them using the tree layout:
Code (Javascript)
Select All
var Alignment = MindFusion.Diagramming.Alignment;
var FitSize = MindFusion.Diagramming.FitSize;
var Rect = MindFusion.Drawing.Rect;

//...

var shapeNode1 = diagram.getFactory().createShapeNode(new Rect(0, 0, 10, 5));
shapeNode1.setText("Hello from ShapeNode 1!");
shapeNode1.resizeToFitText(FitSize.Ratio);

var shapeNode2 = diagram.getFactory().createShapeNode(new Rect(0, 0, 10, 5));
shapeNode2.setText("Hello from ShapeNode 2!");
shapeNode2.resizeToFitText(FitSize.Ratio);

var shapeNode3 = diagram.getFactory().createShapeNode(new Rect(0, 0, 10, 5));
shapeNode3.setText("Hello from ShapeNode 3!");
shapeNode3.resizeToFitText(FitSize.Ratio);

diagram.getFactory().createDiagramLink(shapeNode1, shapeNode2);
diagram.getFactory().createDiagramLink(shapeNode1, shapeNode3);

var layout = new MindFusion.Graphs.TreeLayout();
layout.direction = MindFusion.Graphs.LayoutDirection.TopToBottom;
layout.linkType = MindFusion.Graphs.TreeLayoutLinkType.Cascading;

diagram.arrange(layout); 



Regards,
Lyubo
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: [1] 2 3 
Send TopicPrint