Circular sector plotting

Support questions about the Network Weather Map plugin

Moderators: Moderators, Developers

Post Reply
Author
Message
User avatar
feathers1664
Posts: 9
Joined: Tue Oct 30, 2007 7:13 am
Location: United Kingdom

Circular sector plotting

#1 Post by feathers1664 » Fri Mar 28, 2008 12:14 pm

I want to graph multiple nodes in a circular fashion to a central point. I would ideally like them to be equally placed.

Does anyone know of a way of calculating the circumference points if you specify the sector count?

Ie. A circle with just 4 sectors would have lines at 0,90,180 and 270 degrees. How can work out the x,y position of these plots on a circumference given the circle radius?

I've seen an example map by Tybio but I think he uses a script to generate his.

Many thanks!

User avatar
Howie
Cacti Guru User
Posts: 5330
Joined: Thu Sep 16, 2004 5:53 am
Location: United Kingdom
Contact:

Re: Circular sector plotting

#2 Post by Howie » Fri Mar 28, 2008 1:13 pm

feathers1664 wrote:I want to graph multiple nodes in a circular fashion to a central point. I would ideally like them to be equally placed.

Does anyone know of a way of calculating the circumference points if you specify the sector count?

Ie. A circle with just 4 sectors would have lines at 0,90,180 and 270 degrees. How can work out the x,y position of these plots on a circumference given the circle radius?

I've seen an example map by Tybio but I think he uses a script to generate his.

Many thanks!

Code: Select all

angle= (360/number-of-things) * number-of-this-thing
X = center_x + distance*cos(angle)
Y = center_y - distance*sin(angle)
I think I remembered my high-school trig OK there...
Weathermap 0.98 is out! & QuickTree 1.0. Superlinks is over there now (and built-in to Cacti 1.x).
Some Other Cacti tweaks, including strip-graphs, icons and snmp/netflow stuff.
(Let me know if you have UK DevOps or Network Ops opportunities, too!)

User avatar
Howie
Cacti Guru User
Posts: 5330
Joined: Thu Sep 16, 2004 5:53 am
Location: United Kingdom
Contact:

#3 Post by Howie » Tue Aug 26, 2008 1:56 pm

I just added this as a new feature in 0.96 - you can position a node relative to another by specifying an angle and radius, and also offset the end of a link the same way. This allows you to generate those fan-like maps a lot easier - you still need to work out the angle to distribute them evenly though.

like this (c1 is the centre node, 210 degrees and 90 pixels out is rrr2, the link goes from there to 20 pixels away from c1, also 210 degrees around):

Code: Select all

NODE c1
    POSITION 100 100
    LABEL c1

NODE rrr2
    POSITION c1 210r90

LINK rrc2
    NODES rrr2 c1:210r20
I also added another variation of the compass-points offset that includes a percentage. I keep finding I want to do 90% NW, so that the link-ends are hidden under the node, when I use large node icons.

Code: Select all

LINK aaa1
    NODES centre:NW90 c3
Weathermap 0.98 is out! & QuickTree 1.0. Superlinks is over there now (and built-in to Cacti 1.x).
Some Other Cacti tweaks, including strip-graphs, icons and snmp/netflow stuff.
(Let me know if you have UK DevOps or Network Ops opportunities, too!)

anmomin1
Posts: 49
Joined: Mon May 29, 2017 4:14 pm

Re: Circular sector plotting

#4 Post by anmomin1 » Wed Oct 03, 2018 11:57 am

HI Howie,

I am still trying to figure this spiral and round graphic..
I followed instructions provide .,..
If I need to get 100 routers around the cloud..

according to what you've mentioned:
angle= (360/number-of-things) * number-of-this-thing
X = center_x + distance*cos(angle)
Y = center_y - distance*sin(angle)


360/100*number-of-this-thing (what is number of this thing)

I was able to get the idea with below code:
# TEMPLATE-only NODEs:
NODE DEFAULT
MAXVALUE 100


# TEMPLATE-only LINKs:
LINK DEFAULT
BANDWIDTH 100M


# regular NODEs:
NODE c1
LABEL c1
POSITION 337 283

NODE rrr2
LABEL rrr2
POSITION c1 385r200

NODE rrr4
LABEL Node
POSITION c1 90r200

NODE rrr1
LABEL rrrr1
POSITION c1 45r200

NODE rrr3
LABEL rrr3
POSITION c1 360r200

NODE node03836
LABEL Node
POSITION c1 180r200

NODE node03979
LABEL Node
POSITION c1 270r200


# regular LINKs:
LINK c1-rrr3
NODES c1 rrr3



# That's All Folks!


But I need to guess angle value for next router. I thought with your calculation I can just add that number to angel for next node.

Also about link you did some logic if you can please explain that would be great.

Thanks.
Attachments
circular-wm.png
circular-wm.png (15.51 KiB) Viewed 931 times

User avatar
Howie
Cacti Guru User
Posts: 5330
Joined: Thu Sep 16, 2004 5:53 am
Location: United Kingdom
Contact:

Re: Circular sector plotting

#5 Post by Howie » Wed Oct 03, 2018 1:47 pm

No need to guess... there are 360 degrees in a circle. If you have 10 routers, the angle to add on is 36 each time to make them evenly spaced.

If you are using the polar coordinates (36r200) then you can make them relative to a centre point (another node). No need to worry about sin and cos - that's what the polar coordinates are doing for you.

Code: Select all

NODE centre
   POSITION 300 300
   LABEL c1

NODE r1
   POSITION c1 36r200
   LABEL r1

NODE r2
   POSITION c1 72r200

etc

If you really do have 100 off of one core, it'll be messy anyway though!
Weathermap 0.98 is out! & QuickTree 1.0. Superlinks is over there now (and built-in to Cacti 1.x).
Some Other Cacti tweaks, including strip-graphs, icons and snmp/netflow stuff.
(Let me know if you have UK DevOps or Network Ops opportunities, too!)

anmomin1
Posts: 49
Joined: Mon May 29, 2017 4:14 pm

Re: Circular sector plotting

#6 Post by anmomin1 » Wed Oct 03, 2018 8:22 pm

Thanks Howie..
Glad to see people are still following thread.. and glad to connect with you again...
I got spiral graph now.. but curious if label on link position can be changed so it will be visible..
Also Device name that we will be using will be little longer,, other than change font size of node what would be other solution?


Howie wrote:No need to guess... there are 360 degrees in a circle. If you have 10 routers, the angle to add on is 36 each time to make them evenly spaced.

If you are using the polar coordinates (36r200) then you can make them relative to a centre point (another node). No need to worry about sin and cos - that's what the polar coordinates are doing for you.

Code: Select all

NODE centre
   POSITION 300 300
   LABEL c1

NODE r1
   POSITION c1 36r200
   LABEL r1

NODE r2
   POSITION c1 72r200

etc

If you really do have 100 off of one core, it'll be messy anyway though!

anmomin1
Posts: 49
Joined: Mon May 29, 2017 4:14 pm

Re: Circular sector plotting

#7 Post by anmomin1 » Wed Oct 03, 2018 8:39 pm

I forgot to attached file,..
Attachments
wm-spiral.png
wm-spiral.png (466.59 KiB) Viewed 918 times
Last edited by anmomin1 on Wed Oct 03, 2018 11:05 pm, edited 1 time in total.

anmomin1
Posts: 49
Joined: Mon May 29, 2017 4:14 pm

Re: Circular sector plotting

#8 Post by anmomin1 » Wed Oct 03, 2018 8:41 pm

I found following graph.. for switch...
and saw link label are nicely done...
Attachments
spiral-nice.png
spiral-nice.png (257.4 KiB) Viewed 922 times

User avatar
Howie
Cacti Guru User
Posts: 5330
Joined: Thu Sep 16, 2004 5:53 am
Location: United Kingdom
Contact:

Re: Circular sector plotting

#9 Post by Howie » Thu Oct 04, 2018 2:11 am

"BWSTYLE angled" will do that for you but you have to switch to using a freetype font.
Weathermap 0.98 is out! & QuickTree 1.0. Superlinks is over there now (and built-in to Cacti 1.x).
Some Other Cacti tweaks, including strip-graphs, icons and snmp/netflow stuff.
(Let me know if you have UK DevOps or Network Ops opportunities, too!)

anmomin1
Posts: 49
Joined: Mon May 29, 2017 4:14 pm

Re: Circular sector plotting

#10 Post by anmomin1 » Thu Oct 04, 2018 9:30 pm

I tried following with no luck :(

LINK DMVPN10-rrr4
INFOURL /cacti/graph.php?rra_id=all&local_graph_id=754
OVERLIBGRAPH /cacti/graph_image.php?local_graph_id=754&rra_id=0&graph_nolegend=true&graph_height=100&graph_width=300
TARGET /var/www/cacti/rra/26/797.rrd
NODES DMVPN10:360r50 rrr4
BWSTYLE angled
FONTDEFINE 10 VeraSeBd 16

I followed instructions from below link:
https://network-weathermap.com/manual/0 ... FONTDEFINE

Tried:
FONTDEFINE VeraSeBd.ttf
Getting following error:
Unrecognised config on line 383: FONTDEFINE VeraSeBd.ttf

FONTDEFINE ./VeraSeBd.ttf
Unrecognised config on line 383: FONTDEFINE ./VeraSeBd.ttf


If I use following:

FONTDEFINE 10 VeraSeBd 16
FONTDEFINE 10 ./VeraSeBd 16
FONTDEFINE 10 VeraSeBd.ttf 16
(i don't see Unrecognised Error)
09/27/2018 02:59:53 PM - WEATHERMAP: Poller[0] WARNING: [Map 6] DMVPN10.conf: Angled text doesn't work with non-FreeType fonts [WMWARN02]
09/27/2018 02:59:53 PM - WEATHERMAP: Poller[0] WARNING: [Map 6] DMVPN10.conf: Angled text doesn't work with non-FreeType fonts [WMWARN02]

User avatar
Howie
Cacti Guru User
Posts: 5330
Joined: Thu Sep 16, 2004 5:53 am
Location: United Kingdom
Contact:

Re: Circular sector plotting

#11 Post by Howie » Fri Oct 05, 2018 3:28 am

The reason the second one works is that it is (mostly) correct! :-)

I will update the manual, because it doesn't say this, but FONTDEFINE must be in the top 'global' section of the file, before any nodes or links. You can see this in the example config files though.

HOWEVER... you are defining font number 10 3 times. Only the last one will be used. You also need to *use* the font. For what you are doing, you need BWFONT 10 in either the LINK section or in LINK DEFAULT (for all the links). This is why you still get an error about angled text - you aren't actually using the font you defined.
Weathermap 0.98 is out! & QuickTree 1.0. Superlinks is over there now (and built-in to Cacti 1.x).
Some Other Cacti tweaks, including strip-graphs, icons and snmp/netflow stuff.
(Let me know if you have UK DevOps or Network Ops opportunities, too!)

anmomin1
Posts: 49
Joined: Mon May 29, 2017 4:14 pm

Re: Circular sector plotting

#12 Post by anmomin1 » Fri Oct 05, 2018 1:44 pm

Thanks Howie for your response.. Yup would be nice if you can please include that in manual :D
Couple of things I am still trying to figure out...
How can I get rid of now label white background. to be transparent. The way other person got in his graph.



After I change my Background (bw_gardient_1024 I lost Traffic load icon,,, I see my config has following:
KEYPOS DEFAULT -1 -1 Traffic Load
KEYTEXTCOLOR 0 0 0
KEYOUTLINECOLOR 0 0 0
KEYBGCOLOR 255 255 255
BGCOLOR 255 255 255
TITLECOLOR 0 0 0
TIMECOLOR 0 0 0
SCALE DEFAULT 0 0 192 192 192
SCALE DEFAULT 0 1 255 255 255
SCALE DEFAULT 1 10 140 0 255
SCALE DEFAULT 10 25 32 32 255
SCALE DEFAULT 25 40 0 192 255
SCALE DEFAULT 40 55 0 240 0
SCALE DEFAULT 55 70 240 240 0
SCALE DEFAULT 70 85 255 192 0
SCALE DEFAULT 85 100 255 0 0
Howie wrote:The reason the second one works is that it is (mostly) correct! :-)

I will update the manual, because it doesn't say this, but FONTDEFINE must be in the top 'global' section of the file, before any nodes or links. You can see this in the example config files though.

HOWEVER... you are defining font number 10 3 times. Only the last one will be used. You also need to *use* the font. For what you are doing, you need BWFONT 10 in either the LINK section or in LINK DEFAULT (for all the links). This is why you still get an error about angled text - you aren't actually using the font you defined.

User avatar
Howie
Cacti Guru User
Posts: 5330
Joined: Thu Sep 16, 2004 5:53 am
Location: United Kingdom
Contact:

Re: Circular sector plotting

#13 Post by Howie » Sat Oct 06, 2018 2:03 am

Code: Select all

KEYPOS DEFAULT -1 -1 Traffic Load
You disabled the key. Set it to a position that is on the page (greater than 1 for x and y)

For the labels,

Code: Select all

BWBOXCOLOR none
BWOUTLINECOLOR none
in the link (or LINK DEFAULT), will do that for you. Be careful what colours you use for your scale so that you can still see the text!
Weathermap 0.98 is out! & QuickTree 1.0. Superlinks is over there now (and built-in to Cacti 1.x).
Some Other Cacti tweaks, including strip-graphs, icons and snmp/netflow stuff.
(Let me know if you have UK DevOps or Network Ops opportunities, too!)

Post Reply