Release 1.1.2
In release 1.1.1 we added support for rotating label and custom overlays to match their connectors, which we thought was a cool feature. After configuring it in our Flowchart builder starter app, though, we decided to make a small update.
Consider this screenshot and have a look at the labels:

...they are all faithfully rotated to match the slope of the connector at the points at which they are located, but that results in some of them being upside down - which is not perhaps the best UX. So, we've updated the label rotation code to support the concept of "strict" vs "legible" rotation. If you just set labelsRotatable:true you will now get "legible" rotation - the label is never rotated so that it is upside down, or difficult to read. In practice this means that any rotation between 90 degrees and 270 degrees is flipped:
- React
- Vue
- Angular
- Svelte
import { DiagramComponent } from "@visuallyjs/browser-ui-react"
import "@visuallyjs/browser-ui/css/visuallyjs.css";
export default function App() {
const data = ...
const options = {
edges: {
showLabels: true,
labelsRotatable: true,
targetMarker: "PlainArrow"
}
}
return <div style={{width:"100%", height:"500px"}}>
<DiagramComponent data={data} options={options}/>
</div>
}
<script setup>
const options = {
edges: {
showLabels: true,
labelsRotatable: true,
targetMarker: "PlainArrow"
}
}
const data = ...
</script>
<template>
<div class="my-container">
<DiagramComponent :data="data" :options="options"></DiagramComponent>
</div>
</template>
import { VisuallyJsModule } from "@visuallyjs/browser-ui-angular";
import {Component} from "@angular/core";
@Component({
template:`<div style="width:100%;height:500px">
<vjs-diagram [data]="data" [options]="options"/>
</div>`
export class MyComponent {
data = ...
options = {
edges: {
showLabels: true,
labelsRotatable: true,
targetMarker: "PlainArrow"
}
}
}
<script>
import { DiagramComponent } from "@visuallyjs/browser-ui-svelte"
const data = ...
const options = {
edges: {
showLabels: true,
labelsRotatable: true,
targetMarker: "PlainArrow"
}
}
</script>
<div class="my-container">
<DiagramComponent data={data} options={options}/>
</div>
Contrast the above with what you get when you specify "strict" rotation:
- React
- Vue
- Angular
- Svelte
import { DiagramComponent } from "@visuallyjs/browser-ui-react"
import "@visuallyjs/browser-ui/css/visuallyjs.css";
export default function App() {
const data = ...
const options = {
edges: {
showLabels: true,
labelsRotatable: "strict",
targetMarker: "PlainArrow"
}
}
return <div style={{width:"100%", height:"500px"}}>
<DiagramComponent data={data} options={options}/>
</div>
}
<script setup>
const options = {
edges: {
showLabels: true,
labelsRotatable: "strict",
targetMarker: "PlainArrow"
}
}
const data = ...
</script>
<template>
<div class="my-container">
<DiagramComponent :data="data" :options="options"></DiagramComponent>
</div>
</template>
import { VisuallyJsModule } from "@visuallyjs/browser-ui-angular";
import {Component} from "@angular/core";
@Component({
template:`<div style="width:100%;height:500px">
<vjs-diagram [data]="data" [options]="options"/>
</div>`
export class MyComponent {
data = ...
options = {
edges: {
showLabels: true,
labelsRotatable: "strict",
targetMarker: "PlainArrow"
}
}
}
<script>
import { DiagramComponent } from "@visuallyjs/browser-ui-svelte"
const data = ...
const options = {
edges: {
showLabels: true,
labelsRotatable: "strict",
targetMarker: "PlainArrow"
}
}
</script>
<div class="my-container">
<DiagramComponent data={data} options={options}/>
</div>
These changes have, of course, also been applied to the edges defined in a view for an App. First we see the default - "legible" - setting:
- React
- Vue
- Angular
- Svelte
- Javascript
import { SurfaceComponent } from "@visuallyjs/browser-ui-react"
export default function MyComponent() {
const viewOptions = {
edges: {
default: {
label: "{{label}}",
labelsRotatable: true,
targetMarker: "PlainArrow"
}
}
}
return <SurfaceComponent viewOptions={viewOptions}/>
}
<script setup>
function viewOptions() {
return {
edges: {
default: {
label: "{{label}}",
labelsRotatable: true,
targetMarker: "PlainArrow"
}
}
}
}
</script>
<template>
<SurfaceComponent :viewOptions="viewOptions()" />
</template>
import { Component, ViewChild } from '@angular/core';
import { SurfaceComponent } from '@visuallyjs/browser-ui-angular';
@Component({
selector: 'app-root',
template: ` <vjs-surface [viewOptions]="viewOptions"></vjs-surface> `
})
export class AppComponent {
viewOptions = {
edges: {
default: {
label: "{{label}}",
labelsRotatable: true,
targetMarker: "PlainArrow"
}
}
};
}
<script>
import { SurfaceComponent } from "@visuallyjs/browser-ui-svelte"
const viewOptions = {
edges: {
default: {
label: "{{label}}",
labelsRotatable: true,
targetMarker: "PlainArrow"
}
}
}
</script>
<SurfaceComponent {viewOptions}/>
import { newInstance } from "@visuallyjs/browser-ui"
const model = newInstance()
const surface = model.render({
view: {
edges: {
default: {
label: "{{label}}",
labelsRotatable: true,
targetMarker: "PlainArrow"
}
}
}
})
and this is how it looks when you specify "strict" rotation:
- React
- Vue
- Angular
- Svelte
- Javascript
import { SurfaceComponent } from "@visuallyjs/browser-ui-react"
export default function MyComponent() {
const viewOptions = {
edges: {
default: {
label: "{{label}}",
labelsRotatable: "strict",
targetMarker: "PlainArrow"
}
}
}
return <SurfaceComponent viewOptions={viewOptions}/>
}
<script setup>
function viewOptions() {
return {
edges: {
default: {
label: "{{label}}",
labelsRotatable: "strict",
targetMarker: "PlainArrow"
}
}
}
}
</script>
<template>
<SurfaceComponent :viewOptions="viewOptions()" />
</template>
import { Component, ViewChild } from '@angular/core';
import { SurfaceComponent } from '@visuallyjs/browser-ui-angular';
@Component({
selector: 'app-root',
template: ` <vjs-surface [viewOptions]="viewOptions"></vjs-surface> `
})
export class AppComponent {
viewOptions = {
edges: {
default: {
label: "{{label}}",
labelsRotatable: "strict",
targetMarker: "PlainArrow"
}
}
};
}
<script>
import { SurfaceComponent } from "@visuallyjs/browser-ui-svelte"
const viewOptions = {
edges: {
default: {
label: "{{label}}",
labelsRotatable: "strict",
targetMarker: "PlainArrow"
}
}
}
</script>
<SurfaceComponent {viewOptions}/>
import { newInstance } from "@visuallyjs/browser-ui"
const model = newInstance()
const surface = model.render({
view: {
edges: {
default: {
label: "{{label}}",
labelsRotatable: "strict",
targetMarker: "PlainArrow"
}
}
}
})
Try VisuallyJs
VisuallyJs offers an extensive list of starter apps, diagrams, charts and dashboards to quick start your development, in React, Angular, Vue, Svelte and Typescript/Javascript.
























