Search

Right to Left Text

Advanced

See how ReGraph supports international languages.

Right to Left Text
View live example →

ReGraph supports multiple international languages and writing systems including right-to-left (RTL) and bidirectional (BIDI).

When RTL characters are detected, ReGraph will automatically apply rules to correctly display any RTL and BIDI content.

See also

import React from "react";
import { createRoot } from "react-dom/client";

import { Chart } from "regraph";

import { items, positions } from "./data";

export const Demo = () => (
  <Chart
    items={items}
    options={{ navigation: false, overview: false }}
    positions={positions}
    onDragStart={({ setDragOptions, type }) => {
      if (type === "node") {
        setDragOptions({ type: "pan" });
      }
    }}
  />
);

const root = createRoot(document.getElementById("regraph"));
root.render(<Demo />);
import { style } from "@ci/theme/rg/js/storyStyles";

const items = {
  5: {
    label: { text: "민준\nMin-jun", fontSize: 11, ...style.darkLabel },
    size: 1.2,
    ...style.cat00,
  },
  6: {
    label: { text: "서준\nSeo-jun", fontSize: 11, ...style.darkLabel },
    size: 1.2,
    ...style.cat00,
  },
  7: {
    label: { text: "하준\nHa-joon", fontSize: 11, ...style.darkLabel },
    size: 1.2,
    ...style.cat00,
  },
  8: {
    label: { text: "도윤\nDo-yun", fontSize: 11, ...style.darkLabel },
    size: 1.2,
    ...style.cat00,
  },
  9: {
    label: { text: "주원\nJoo-won", fontSize: 11, ...style.darkLabel },
    size: 1.2,
    ...style.cat00,
  },
  10: {
    label: { text: "서윤\nSeo-yun", fontSize: 11, ...style.darkLabel },
    size: 1.2,
    ...style.cat00,
  },
  11: {
    label: { text: "서연\nSeo-yeon", fontSize: 11, ...style.darkLabel },
    size: 1.2,
    ...style.cat00,
  },
  12: {
    label: { text: "지우\nJi-woo", fontSize: 11, ...style.darkLabel },
    size: 1.2,
    ...style.cat00,
  },
  13: {
    label: { text: "지유\nJi-yoo", fontSize: 11, ...style.darkLabel },
    size: 1.2,
    ...style.cat00,
  },
  14: {
    label: { text: "하윤\nHa-yoon", fontSize: 11, ...style.darkLabel },
    size: 1.2,
    ...style.cat00,
  },
  15: {
    label: { text: "Noam\nנעם", fontSize: 11, ...style.darkLabel },
    size: 1.2,
    ...style.cat02,
  },
  16: {
    label: { text: "Ori\nאורי", fontSize: 11, ...style.darkLabel },
    size: 1.2,
    ...style.cat02,
  },
  17: {
    label: { text: "David\nדוד", fontSize: 11, ...style.darkLabel },
    size: 1.2,
    ...style.cat02,
  },
  18: {
    label: { text: "Yosef\nיוסף", fontSize: 11, ...style.darkLabel },
    size: 1.2,
    ...style.cat02,
  },
  19: {
    label: { text: "Eitan\nאיתן", fontSize: 11, ...style.darkLabel },
    size: 1.2,
    ...style.cat02,
  },
  20: {
    label: { text: "Noa\nנועה", fontSize: 11, ...style.darkLabel },
    size: 1.2,
    ...style.cat02,
  },
  21: {
    label: { text: "Tamar\nתמר", fontSize: 11, ...style.darkLabel },
    size: 1.2,
    ...style.cat02,
  },
  22: {
    label: { text: "Shira\nשירה", fontSize: 11, ...style.darkLabel },
    size: 1.2,
    ...style.cat02,
  },
  23: {
    label: { text: "Maya\nמאיה", fontSize: 11, ...style.darkLabel },
    size: 1.2,
    ...style.cat02,
  },
  24: {
    label: { text: "Yael\nיעל", fontSize: 11, ...style.darkLabel },
    size: 1.2,
    ...style.cat02,
  },
  25: {
    label: { text: "Mohammad\nمحمد", fontSize: 9, ...style.darkLabel },
    size: 1.2,
    ...style.cat02,
  },
  26: {
    label: { text: "Fahd\nفهد‎‎", fontSize: 11, ...style.darkLabel },
    size: 1.2,
    ...style.cat02,
  },
  27: {
    label: { text: "Abdullah\nعبد الله", fontSize: 11, ...style.darkLabel },
    size: 1.2,
    ...style.cat02,
  },
  28: {
    label: { text: "Abdulrahman\nعبد الرحمن", fontSize: 8, ...style.darkLabel },
    size: 1.2,
    ...style.cat02,
  },
  29: {
    label: { text: "Turki\nتركي‎‎", fontSize: 11, ...style.darkLabel },
    size: 1.2,
    ...style.cat02,
  },
  30: {
    label: { text: "Fatima\nفاطمة", fontSize: 11, ...style.darkLabel },
    size: 1.2,
    ...style.cat02,
  },
  31: {
    label: { text: "Aisha\nعائشة", fontSize: 11, ...style.darkLabel },
    size: 1.2,
    ...style.cat02,
  },
  32: {
    label: { text: "Nora\nنور‎‎", fontSize: 11, ...style.darkLabel },
    size: 1.2,
    ...style.cat02,
  },
  33: {
    label: { text: "Hessa\nهسة", fontSize: 11, ...style.darkLabel },
    size: 1.2,
    ...style.cat02,
  },
  34: {
    label: { text: "Sheikha\nشيخة‎", fontSize: 11, ...style.darkLabel },
    size: 1.2,
    ...style.cat02,
  },
  35: {
    label: { text: "一雄\nKazuo", fontSize: 11, ...style.darkLabel },
    size: 1.2,
    ...style.cat04,
  },
  36: {
    label: { text: "健治\nKenji", fontSize: 11, ...style.darkLabel },
    size: 1.2,
    ...style.cat04,
  },
  37: {
    label: { text: "春人\nHaruto", fontSize: 11, ...style.darkLabel },
    size: 1.2,
    ...style.cat04,
  },
  38: {
    label: { text: "明\nAkira", fontSize: 11, ...style.darkLabel },
    size: 1.2,
    ...style.cat04,
  },
  39: {
    label: { text: "暁美\nAkemi", fontSize: 11, ...style.darkLabel },
    size: 1.2,
    ...style.cat04,
  },
  40: {
    label: { text: "菖蒲\nAyame", fontSize: 11, ...style.darkLabel },
    size: 1.2,
    ...style.cat04,
  },
  41: {
    label: { text: "恵美\nEmi", fontSize: 11, ...style.darkLabel },
    size: 1.2,
    ...style.cat04,
  },
  42: {
    label: { text: "美恵子\nMieko", fontSize: 11, ...style.darkLabel },
    size: 1.2,
    ...style.cat04,
  },
  43: {
    label: { text: "美樹\nMiki", fontSize: 11, ...style.darkLabel },
    size: 1.2,
    ...style.cat04,
  },
  44: {
    label: { text: "里菜\nRina", fontSize: 11, ...style.darkLabel },
    size: 1.2,
    ...style.cat04,
  },
  45: {
    label: { text: "伟\nWei", fontSize: 11, ...style.darkLabel },
    size: 1.2,
    ...style.cat06,
  },
  46: {
    label: { text: "杰\nJie", fontSize: 11, ...style.darkLabel },
    size: 1.2,
    ...style.cat06,
  },
  47: {
    label: { text: "郝\nHao", fontSize: 11, ...style.darkLabel },
    size: 1.2,
    ...style.cat06,
  },
  48: {
    label: { text: "意\nYi", fontSize: 11, ...style.darkLabel },
    size: 1.2,
    ...style.cat06,
  },
  49: {
    label: { text: "君\nJun", fontSize: 11, ...style.darkLabel },
    size: 1.2,
    ...style.cat06,
  },
  50: {
    label: { text: "静\nJing", fontSize: 11, ...style.darkLabel },
    size: 1.2,
    ...style.cat06,
  },
  51: {
    label: { text: "营\nYing", fontSize: 11, ...style.darkLabel },
    size: 1.2,
    ...style.cat06,
  },
  52: {
    label: { text: "艳\nYan", fontSize: 11, ...style.darkLabel },
    size: 1.2,
    ...style.cat06,
  },
  53: {
    label: { text: "理\nLi", fontSize: 11, ...style.darkLabel },
    size: 1.2,
    ...style.cat06,
  },
  54: {
    label: { text: "晓燕\nXiaoyan", fontSize: 11, ...style.darkLabel },
    size: 1.2,
    ...style.cat06,
  },
  chinese: {
    ...style.labelOnlyNode,
    label: { text: "China", fontSize: 26, backgroundColor: style.labelOnlyNode.color },
  },
  korean: {
    ...style.labelOnlyNode,
    label: { text: "South Korea", fontSize: 26, backgroundColor: style.labelOnlyNode.color },
  },
  hebrew: {
    ...style.labelOnlyNode,
    label: { text: "Israel", fontSize: 26, backgroundColor: style.labelOnlyNode.color },
  },
  japanese: {
    ...style.labelOnlyNode,
    label: { text: "Japan", fontSize: 26, backgroundColor: style.labelOnlyNode.color },
  },
  arabic: {
    ...style.labelOnlyNode,
    label: { text: "Saudi Arabia", fontSize: 26, backgroundColor: style.labelOnlyNode.color },
  },
};

const positions = {
  5: {
    x: -585.4736092775761,
    y: -488.70260259325715,
  },
  6: {
    x: -412.0194305792724,
    y: -662.156781291561,
  },
  7: {
    x: -379.37692213316353,
    y: -456.06009414714833,
  },
  8: {
    x: -343.1924227779332,
    y: -527.0761727181678,
  },
  9: {
    x: -355.6607515262913,
    y: -605.7981022385798,
  },
  10: {
    x: -529.114930224595,
    y: -432.3439235402761,
  },
  11: {
    x: -450.3930007041829,
    y: -419.87559479191805,
  },
  12: {
    x: -597.9419380259342,
    y: -567.4245321136692,
  },
  13: {
    x: -490.74136009968447,
    y: -674.6251100399189,
  },
  14: {
    x: -561.7574386707038,
    y: -638.4406106846886,
  },
  15: {
    x: -413.0465889161247,
    y: -183.0727210692921,
  },
  16: {
    x: -449.5827505267669,
    y: 47.60752464031262,
  },
  17: {
    x: -555.6148212978375,
    y: -160.492131375456,
  },
  18: {
    x: -487.9991442790216,
    y: -194.9440396013383,
  },
  19: {
    x: -347.5151652820688,
    y: -54.46006060438552,
  },
  20: {
    x: -359.3864838141151,
    y: -129.41261596728245,
  },
  21: {
    x: -524.5353058896638,
    y: 35.73620610826637,
  },
  22: {
    x: -578.1954109916735,
    y: -17.923898993743222,
  },
  23: {
    x: -590.0667295237197,
    y: -92.87645435664015,
  },
  24: {
    x: -381.96707350795106,
    y: 13.15561641443037,
  },
  25: {
    x: 4.815101004718429,
    y: -639.3422499226049,
  },
  26: {
    x: 75.83117957573782,
    y: -675.5267492778353,
  },
  27: {
    x: 223.38011689748907,
    y: -527.977811956084,
  },
  28: {
    x: 154.5531090961499,
    y: -663.0584205294772,
  },
  29: {
    x: 116.17953897123937,
    y: -423.9256106826012,
  },
  30: {
    x: 210.91178814913098,
    y: -606.699741476496,
  },
  31: {
    x: -18.90106960215377,
    y: -489.60424183117345,
  },
  32: {
    x: 187.1956175422588,
    y: -456.96173338506463,
  },
  33: {
    x: 37.457609450827306,
    y: -433.2455627781924,
  },
  34: {
    x: -31.369398350511858,
    y: -568.3261713515856,
  },
  35: {
    x: -272.77072452377973,
    y: -394.8137424932173,
  },
  36: {
    x: -242.11201493351174,
    y: -201.2422683796807,
  },
  37: {
    x: -295.0455808948752,
    y: -254.17583434104415,
  },
  38: {
    x: -101.47410678133855,
    y: -223.5171247507762,
  },
  39: {
    x: -79.19925041024311,
    y: -364.1550329029494,
  },
  40: {
    x: -168.17429107456118,
    y: -189.5316833674107,
  },
  41: {
    x: -306.7561659071452,
    y: -328.1135581999947,
  },
  42: {
    x: -132.13281637160657,
    y: -417.0885988643128,
  },
  43: {
    x: -204.45258580072772,
    y: -423.94532058709456,
  },
  44: {
    x: -67.48866539797308,
    y: -290.21730904399885,
  },
  45: {
    x: 17.905599371634196,
    y: -162.43431578579515,
  },
  46: {
    x: 48.564308961902185,
    y: 31.137158327741474,
  },
  47: {
    x: -4.369256999461243,
    y: -21.796407633621982,
  },
  48: {
    x: 189.20221711407538,
    y: 8.862301956645979,
  },
  49: {
    x: 211.47707348517082,
    y: -131.77560619552722,
  },
  50: {
    x: 122.50203282085272,
    y: 42.847743340011476,
  },
  51: {
    x: -16.079842011731273,
    y: -95.73413149257254,
  },
  52: {
    x: 158.54350752380736,
    y: -184.70917215689065,
  },
  53: {
    x: 84.6057836648568,
    y: -196.41975716916062,
  },
  54: {
    x: 223.18765849744085,
    y: -57.837882336576655,
  },
  chinese: {
    x: 96.67338322553144,
    y: -258.96545020013417,
  },
  korean: {
    x: -488.962914337488,
    y: -729.2418766340576,
  },
  hebrew: {
    x: -489.11555876558225,
    y: -255.86988414271673,
  },
  japanese: {
    x: -193.35820228821308,
    y: -487.5008806553019,
  },
  arabic: {
    x: 78.16508134445075,
    y: -729.7020851132238,
  },
};

export { items, positions };
<!doctype html>
<html>
  <body>
    <div id="regraph" style="height: 100vh"></div>
    <script type="module" src="./code.jsx"></script>
  </body>
</html>

Terms of use

These terms do not alter or supersede any existing agreements between you (or your employer) and us.

By accessing or using any Content you agree to be bound by these Terms of Use. Please review these terms carefully before using the website.

The contents of this website, including but not limited to any text, code samples, API references, schemas, interactive tools, and other materials (collectively, the 'Content'), are made available for informational and internal evaluation purposes only. All intellectual property rights in the Content are reserved. No licence is granted to use the Content for any commercial purpose, or to copy, distribute, modify, reverse-engineer, or incorporate any part of the Content into any product or service, without our prior written consent.

This Content is provided “as is” and “as available,” without any representations, warranties, or guarantees of any kind, whether express or implied, including but not limited to implied warranties of merchantability, fitness for a particular purpose, non-infringement, or accuracy. To the fullest extent permitted by applicable law, we expressly exclude and disclaim all implied warranties, conditions, and other terms that might otherwise be implied.

We disclaim all liability for any loss or damage, whether direct, indirect, incidental, consequential, or otherwise, arising from any reliance placed on the Content or from your use of it, to the fullest extent permitted by applicable law. By continuing to access or use the Content, you acknowledge and agree to these terms.