<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Label Multiple lines in Tools</title>
    <link>https://community.cisco.com/t5/tools/label-multiple-lines/m-p/4449405#M614</link>
    <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 26 Aug 2021 20:05:14 GMT</pubDate>
    <dc:creator>Garcia Holness</dc:creator>
    <dc:date>2021-08-26T20:05:14Z</dc:date>
    <item>
      <title>Label Multiple lines</title>
      <link>https://community.cisco.com/t5/tools/label-multiple-lines/m-p/3521879#M262</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, is it possible to have a multiline label?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'd like to have device type, ip address, hostname etc. as label on multiple lines.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edit: Would also like to be able to apply labels to the links as well as where the link terminates for interface numbers. Anyone know how this is done?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 12 Apr 2016 09:22:37 GMT</pubDate>
      <guid>https://community.cisco.com/t5/tools/label-multiple-lines/m-p/3521879#M262</guid>
      <dc:creator>brianpetes</dc:creator>
      <dc:date>2016-04-12T09:22:37Z</dc:date>
    </item>
    <item>
      <title>Re: Label Multiple lines</title>
      <link>https://community.cisco.com/t5/tools/label-multiple-lines/m-p/3521880#M263</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="color: #212121; font-family: arial, sans-serif; font-size: 16px;"&gt;the moderator Aikepaer Abuduweili set an example that I think helps you&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN lang="en"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN lang="en"&gt;&lt;A href="http://codepen.io/NEXTSUPPORT/pen/LNgYER" title="http://codepen.io/NEXTSUPPORT/pen/LNgYER"&gt;http://codepen.io/NEXTSUPPORT/pen/LNgYER&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 Apr 2016 21:07:23 GMT</pubDate>
      <guid>https://community.cisco.com/t5/tools/label-multiple-lines/m-p/3521880#M263</guid>
      <dc:creator>nivaldojunior_931</dc:creator>
      <dc:date>2016-04-28T21:07:23Z</dc:date>
    </item>
    <item>
      <title>Re: Label Multiple lines</title>
      <link>https://community.cisco.com/t5/tools/label-multiple-lines/m-p/3521881#M264</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm looking to do what the original question is asking, and I don't think this example addresses it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In context of the example posted, I believe we are talking about SJC-1, NYC-5, etc additionally having a line (or many) underneath containing additional node information. Not adding and displaying link information (though I found that helpful as well).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Anyone have a solution to displaying a multiple-line node label?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 31 Oct 2017 21:53:25 GMT</pubDate>
      <guid>https://community.cisco.com/t5/tools/label-multiple-lines/m-p/3521881#M264</guid>
      <dc:creator>zjpeterson</dc:creator>
      <dc:date>2017-10-31T21:53:25Z</dc:date>
    </item>
    <item>
      <title>Re: Label Multiple lines</title>
      <link>https://community.cisco.com/t5/tools/label-multiple-lines/m-p/3521882#M265</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Zach,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Fistfull I am not an exert on js, html5 to etc. I am using next for one of my projects. I have created an example for you.&amp;nbsp; There may be more useful solutions. I hope this will be start point for solution to your problem. I don't know your purposes but in my opinion add more labels to link will increase the viewbility of your topology. Instead adding these attributes to link tooltip will be more usefull&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://codepen.io/deniza/pen/VrNQvv" title="https://codepen.io/deniza/pen/VrNQvv"&gt;https://codepen.io/deniza/pen/VrNQvv&lt;/A&gt;&lt;/P&gt;&lt;P&gt;First you should descripe a process to write labels as text on a position relative to the link. As seen in the example of &lt;SPAN style="color: #212121; font-family: arial, sans-serif; font-size: 16px;"&gt;Aikepaer Abuduweili&lt;/SPAN&gt; with the source and target label you should define for each of the labels you want to add. In my example I have tried to write sourcedesc prop of the link.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (this.sourcedesc()) {&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; el = this.view('sourcedesc');&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; point = line.start;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; el.set('x', point.x+10);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; el.set('y', point.y+10);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; el.set('text', this.sourcedesc());&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; el.set('transform', 'rotate(' + angle + ' ' + point.x + ',' + point.y + ')');&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; el.setStyle('font-size', 12 * stageScale);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;&lt;P&gt;the problem with that is to calculate the x and y which will be beginning position of the text. You should some how find a way calculate it. In &lt;SPAN style="color: #212121; font-family: arial, sans-serif; font-size: 16px;"&gt;Aikepaer Abuduweili&lt;/SPAN&gt; example, he tries to describe a new line relative to the link and use its coordinates as text coordinates of text.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;for entering this method link should have an attiribute of sourcedesc,&lt;/P&gt;&lt;P&gt;for that you should define in linkConfig ;&lt;/P&gt;&lt;P&gt;sourcedesc: 'model.sourcedesc',&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and also you have to add this attribute to props in the link instance class;&lt;/P&gt;&lt;P&gt; sourcedesc: null,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and for the last the element desciption,&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; el = this.view('sourcedesc'), needs the element in the view.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;adding below definition to the view part of link instance class.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; name: 'sourcedesc',&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; type: 'nx.graphic.Text',&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; props: {&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'class': 'sourcedesc',&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'alignment-baseline': 'text-after-edge',&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'text-anchor': 'start'&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 05 Dec 2017 20:05:02 GMT</pubDate>
      <guid>https://community.cisco.com/t5/tools/label-multiple-lines/m-p/3521882#M265</guid>
      <dc:creator>Deniz AYDIN</dc:creator>
      <dc:date>2017-12-05T20:05:02Z</dc:date>
    </item>
    <item>
      <title>Re: Label Multiple lines</title>
      <link>https://community.cisco.com/t5/tools/label-multiple-lines/m-p/4449405#M614</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 26 Aug 2021 20:05:14 GMT</pubDate>
      <guid>https://community.cisco.com/t5/tools/label-multiple-lines/m-p/4449405#M614</guid>
      <dc:creator>Garcia Holness</dc:creator>
      <dc:date>2021-08-26T20:05:14Z</dc:date>
    </item>
    <item>
      <title>Re: Label Multiple lines</title>
      <link>https://community.cisco.com/t5/tools/label-multiple-lines/m-p/4460169#M617</link>
      <description>&lt;P&gt;You can break the labels into multi line with below code&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;nx.define("ExtendedNode", nx.graphic.Topology.Node, {
	methods: {
		init: function(args){
		this.inherited(args);
		},
		calcLabelPosition: function(force){
			if(this.model().get("name").length &amp;gt; 10){
				var labelView = this.view("label");
				var string_name = this.model().get("name").trim().split(" ");
				var html = '';
				for(var z = 0; z &amp;lt; string_name.length; z++){
				html += "&amp;lt;tspan x='0' dy='1.2em'&amp;gt;"+string_name[z]+"&amp;lt;/tspan&amp;gt;";
				}
				labelView.set('html',html);
			}
			else{
				this.inherited(force);
			}
		}
	}
});


//initialize a topology component
var topo = new nx.graphic.Topology({
	width: 800,
	height: 600,
	showIcon: true,
	nodeConfig: {
		label: 'model.name'
	},
	linkConfig: {
		linkType: 'parallel'
	},
	nodeInstanceClass: 'ExtendedNode'
});&lt;/PRE&gt;&lt;P&gt;In addition, please calculate and set the offset of labels accordingly&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="label_image.png" style="width: 999px;"&gt;&lt;img src="https://community.cisco.com/t5/image/serverpage/image-id/129806i728C927EE71F8F59/image-size/large?v=v2&amp;amp;px=999" role="button" title="label_image.png" alt="label_image.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 06 Sep 2021 08:37:24 GMT</pubDate>
      <guid>https://community.cisco.com/t5/tools/label-multiple-lines/m-p/4460169#M617</guid>
      <dc:creator>er.waseem123</dc:creator>
      <dc:date>2021-09-06T08:37:24Z</dc:date>
    </item>
  </channel>
</rss>

