How to change the color of selected node - Family Tree JS |
|
|||||||||
How to change the color of selected node - Family Tree JSThis is step by step tutorial on how to change the color of selected node and BLUR nodes that are not part of tree of the selected family member. This is step by step tutorial on how to change the color of selected node and BLUR nodes that are not part of hierarchy of the selected node. You will learn how to find and iterate all parent, children and partners nodes of the selected family memeber. Step 1 - InstallationIf you are already familiar with BALKAN FamilyTreeJS you can skip this step. There are two installation options: standalone or using npm standalone installation See our getting started page npm installation
Step 2 - Create BALKAN FamilyTreeJS instance
The code above will create family tree instance in mode dark, with disabled Edit Form and nodeBinding property indicates that the fields 'name', 'birthDate' and 'photo' will be visible in the node boxes. Step 3 - Add event listenersThe family tree will listen for 'click' and 'prerender' events.
The code above will add 'selected' tag to clicked node element and you can apply css style to that node. Here you can learn more how to customize foamily tree with CSS. The next step is to add iteration methods to set 'blurred' tags for the nodes that are not part of the selected node. To do that we will need to iterate all parents, partners and children of the selected node.
Step 4 - Add CSS style to blur and highlight selected family member
Filter 'blur' will blur nodes with 'blurred' tag, other filters that you can use. The color of the selected not will be yellow. Click one of the nodes below to see the effect Tell us if you have any questions in the comments below. Instantly create interactive, intuitive flowcharts in secondsJavaScript Hierarchy ChartMermaid js alternativeCreate Flowcharts in Seconds with Flow Chart JS: Your New Favorite JavaScript LibraryCustomizing Filter UI - Code of The WeekZoom Slider - Code of The WeekBookmarks - Code of The WeekCustomizing Search Results - Code of The WeekIntroducing Undo Redo - Code Of The WeekPrice adjustment announcementThe price will increase for new customersButtons for adding family members to a family tree - Code of The WeekLevels - Code of The WeekChange node color from a button in the Edit Form - Code of The WeekFilter and Highlight Nodes - Code of The WeekUp Expanding - Code Of The WeekProgrammatically move the chart - Code of The WeekSiblings in Family Tree JS - Code of The WeekPurple template - Code of The WeekAssistant With Children - Code of The WeekConditional Layout - Code of The WeekConditional Color - Code of the WeekSriniz Family Tree Template - Code of The WeekColor Picker - Code of The WeekAdd company logo as watermark in exported PDF documents - Code of The WeekMind map - Code of The WeekCreate relationship with circle menu - Code of The WeekAnimated Photos - Code of the WeekGrouped Dotted Lines - Code Of The WeekDotted Lines - Code Of The WeekDepartment Dynamic Title - Code Of The WeekAdd expand button for partners - Code of the WeekChange the sub levels with Drag and Drop - Code of The WeekCustom Edit From using Popover - Code of the WeekSub levels tag option - Code of the WeekHighlights search results directly on Org Chart nodes - Code of the WeekCode of the Week/Relationship maps and Business process diagramsSearch using field name abbreviations - Code of the WeekDynamic Template - Code of the WeekRead and Write local CSV file using File API and Org Chart JS - Code of The WeekOrganizational Chart Path Highlighting and SelectionModern Template - Org Chart JSPerformance - Org Chart JSSingle parent is supported in Family Tree JSHow To Develop a Flowchart Maker with Org Chart JSHow to upload a photo to Family Tree JS in .NET coreFamily Tree with live tiles |