w7a8n1y4a
Posts: 3
Joined: Fri Dec 11, 2020 5:46 pm

Url for point network graph

Hi can't get the key using the method (this.series.options.point.key), maybe someone has a solution?
https://jsfiddle.net/zbwa1ys8/
User avatar
sebastian.h
Posts: 1734
Joined: Fri Aug 07, 2020 7:08 am

Re: Url for point network graph

Hi,

Welcome to our forum and thanks for contacting us with your question.

For this object to get to the key you have to enter this.series.data[0].key
https://jsfiddle.net/BlackLabel/p1Lkg706/

You can also try to save the date as a set of arrays differently and refer to them in keys
http://jsfiddle.net/BlackLabel/u0b2xjs6/

Let me know if that was what you were looking for.
Kindly regards.
Sebastian Hajdus
Highcharts Developer
w7a8n1y4a
Posts: 3
Joined: Fri Dec 11, 2020 5:46 pm

Re: Url for point network graph

Yes, things are definitely clearer now. Your data organization is much better than mine! But still the question arises, how to call a specific url for each vertex of the graph, perhaps there is a method that was passed to me? Here's an example from the API for a chart:
https://jsfiddle.net/gh/get/library/pur ... click-url/
If you use your first example, then you need to somehow get the key number, which is functionality that you couldn't find in the first approximation!
dominik.c
Posts: 2081
Joined: Fri Aug 07, 2020 7:07 am

Re: Url for point network graph

Hello w7a8n1y4a!

My colleague is currently not available, so I will take care of your issue. :)

We can do it like in the demo you've provided to us. We only need to change the names of the nodes, so it'll work exactly like in your demo. Check it out and tell me if it meets your expectations: https://jsfiddle.net/BlackLabel/neLcr2ox/

Best regards!
Dominik Chudy
Highcharts Developer
w7a8n1y4a
Posts: 3
Joined: Fri Dec 11, 2020 5:46 pm

Re: Url for point network graph

Yes, thank you so much it fully solved my problem !!!
User avatar
sebastian.h
Posts: 1734
Joined: Fri Aug 07, 2020 7:08 am

Re: Url for point network graph

That's great to hear!

In case of any further questions, feel free to contact us again.
Sebastian Hajdus
Highcharts Developer
majao
Posts: 5
Joined: Sat May 14, 2022 4:09 pm

Re: Url for point network graph

sebastian.h wrote: Mon Dec 14, 2020 11:22 am
I am a beginner in Highchart
I have tried to reconstruct the above example, but I only get the URL of the first node because of the [0].
Have I misunderstood something? I would expect the individual URL of each node to be output.
Thanks for help
majao
mateusz.b
Posts: 2006
Joined: Tue Jul 13, 2021 11:34 am

Re: Url for point network graph

Hi majao,

Welcome to our forum and thanks for contacting us with your question!

By above example do you mean this chart?
https://jsfiddle.net/BlackLabel/neLcr2ox/

The click event is called for each point individually, you can refer to specific point with this and thus you don't need to use for example [0] index. The demo seems to work correctly, so please recreate your issue in it.

Regards!
Mateusz Bernacik
Highcharts Developer
majao
Posts: 5
Joined: Sat May 14, 2022 4:09 pm

Re: Url for point network graph

Hi
Many thanks for the quick support!

I was able to understand the example, but it relies on the URL (or the decisive part of it) being identical to the name of the node. But how do I do it if this is not the case, something like this:

data:

from: 'United_States',
to: 'Canada',
url: 'https://website.com/index.html'

from: 'Canada',
to: 'Russia',
url: 'https://another-website.net/index.php'

from: 'Russia',
to: 'Deutschland',
url: '../../internal_resource/example.html'

...
...

Is there perhaps also a code example for this?
That would be great for me
Thanks a lot
M.
mateusz.b
Posts: 2006
Joined: Tue Jul 13, 2021 11:34 am

Re: Url for point network graph

Hi majao,

In that case I think that you should use nodes array to define specific options for individual nodes.
Demo:https://jsfiddle.net/BlackLabel/bnyx48q6/
API reference:https://api.highcharts.com/highcharts/s ... raph.nodes

Let me know if it was what you were looking for.
Regards!
Mateusz Bernacik
Highcharts Developer
majao
Posts: 5
Joined: Sat May 14, 2022 4:09 pm

Re: Url for point network graph

Hi Mateusz
Thank you for the demo
It is exactly what I need.

The last question, to be fully happy: Is there also a way to assign individual colours to each item? :D
Thanks a lot again
majao
mateusz.b
Posts: 2006
Joined: Tue Jul 13, 2021 11:34 am

Re: Url for point network graph

Hi majao,

If by each item you mean each node, then you can do using color property:
https://jsfiddle.net/BlackLabel/ayhurwxg/

Let me know if it was what you were looking for.
Regards!
Mateusz Bernacik
Highcharts Developer
majao
Posts: 5
Joined: Sat May 14, 2022 4:09 pm

Re: Url for point network graph

perfect!

The very last question:
Can I also set the size (radius) of every single node in the same way?
I have tried this, but it did not work:

radius: 35,
id: 'Canada',
url: 'url.net'

Next week I will have time to take a closer look at Highcharts and study the documentation. Then hopefully I won't have to ask such beginner questions anymore, ... I promise
mateusz.b
Posts: 2006
Joined: Tue Jul 13, 2021 11:34 am

Re: Url for point network graph

majao,

No worries, we are here to help you so feel free to ask any questions.

Radius of the node can be adjusted with marker.radius property.
Demo: https://jsfiddle.net/BlackLabel/42fmzot0/

Let me know if it was what you were looking for.
Regards!
Mateusz Bernacik
Highcharts Developer
majao
Posts: 5
Joined: Sat May 14, 2022 4:09 pm

Re: Url for point network graph

Hi Matheusz
Everything works and I'm slowly finding my way ...

Is it also possible to output the nodes not via SVG, but via CSS, so that I can give them class names to style them?
And because of the links, a problem has arisen: Not all nodes are linked. How do I write a condition so that no error message is displayed if there is no URL?

Thanks again
M.

Return to “Highcharts Usage”