pir8radio
Posts: 15
Joined: Fri Jan 14, 2022 8:33 pm

I need help... Google to Hichcharts

Fri Jan 14, 2022 8:39 pm

Hi, need a hand.. i feed google geo charts an array with my country/count.. i want to directly replace this map with a highcharts map... My goal is to make it look like this one: https://www.highcharts.com/demo/maps/map-bubble here is my current production map: https://explorer.notallmine.net/peers-charts/ here is my code with my server side variables: https://github.com/pir8radio/signum-exp ... harts.html

here is my array country, quantity:

Code: Select all

     
      var data = google.visualization.arrayToDataTable([
        ['Country', 'Peers'],
        {% for country in countries %}['{{ country.country_code }}', {{ country.cnt }}],{% endfor %}
      ]);


can someone help me out with a direct replacement example code? thanks in advance.

pir8radio
Posts: 15
Joined: Fri Jan 14, 2022 8:33 pm

Re: I need help... Google to Hichcharts

Sun Jan 16, 2022 6:09 pm

must not be possible.. guess ill stick with google.

magdalena
Posts: 514
Joined: Tue Aug 24, 2021 1:32 pm

Re: I need help... Google to Hichcharts

Mon Jan 17, 2022 11:37 am

Hi pir8radio,

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

I'm not sure where are you get data from, but all you need to do is to provide them and configure the chart as you want. The following example demo shows using your data format with Map bubble series. For more information check the links below.

Demo:
https://jsfiddle.net/BlackLabel/z6j82obv/

Docs:
https://www.highcharts.com/docs/maps/map-collection
https://www.highcharts.com/docs/working ... data-intro

​If you have further inquiries, you may reach out to me at any time,
Regards!
Magdalena Gut
Highcharts support engineer

pir8radio
Posts: 15
Joined: Fri Jan 14, 2022 8:33 pm

Re: I need help... Google to Hichcharts

Thu Jan 20, 2022 4:37 am

wow... i am a moron... that was super easy... lol... glad you are here to help!!! thank you!

pir8radio
Posts: 15
Joined: Fri Jan 14, 2022 8:33 pm

Re: I need help... Google to Hichcharts

Thu Jan 20, 2022 2:48 pm

i sent you a PM if you could assist with one more little conversion then i think i will have a good grasp on what you are doing with the array.. :-) Please

pir8radio
Posts: 15
Joined: Fri Jan 14, 2022 8:33 pm

Re: I need help... Google to Hichcharts

Thu Jan 20, 2022 8:24 pm

hi, i'm still having issues understanding how you are getting the array into map... can you give me an example for the pie chart shown here: https://explorer.signum.network/peers-charts/ as you can see on the test site, the map works! https://explorer.notallmine.net/peers-charts/ thank you again for the additional help...

the data format is the same as the map example...

google.charts.load('current', {'packages':['corechart']});
google.charts.setOnLoadCallback(drawChart);

function drawChart() {

var data = google.visualization.arrayToDataTable([
['Version', 'Count'],
['v3.2.1', 236],['v3.2.2', 3],
]);

var options = {
title: 'Versions (Online)'
};

var chart = new google.visualization.PieChart(document.getElementById('piechart-versions'));

chart.draw(data, options);
}

pir8radio
Posts: 15
Joined: Fri Jan 14, 2022 8:33 pm

Re: I need help... Google to Hichcharts

Fri Jan 21, 2022 2:42 pm

uh oh this one more difficult? :-) I just need one more non map example to know what im doing lol...

magdalena
Posts: 514
Joined: Tue Aug 24, 2021 1:32 pm

Re: I need help... Google to Hichcharts

Fri Jan 21, 2022 7:57 pm

Hi,

We are trying to answer the questions in the order they were asked so that everyone has an equal response time to their issue.
If you are our licensed customer with a valid Advantage plan, you can contact us on Skype via live text chat, see more info here: https://www.highcharts.com/blog/support/

The answer is actually very easy :)

In the case of the map series, the data responds to the country areas on the map thanks to the special key. The list of Highcharts map collection and corresponding keys is accessible in this article: https://www.highcharts.com/docs/maps/map-collection (I would recommend reading the whole article in order to get the full picture).

With regards to your data, you are using the international standard country code iso-a2.

The pie chart is more intuitive, you don't need any key code. When you pass data like above, the string is a point.name (name of the slice) and y is a value.

Pie chart Demo:
https://jsfiddle.net/BlackLabel/b4rd12py/

API References:
https://api.highcharts.com/highmaps/series.map.data
https://api.highcharts.com/highcharts/series.pie.data

Thank you for your patience, feel free to ask any further questions!
Regards!
Magdalena Gut
Highcharts support engineer

pir8radio
Posts: 15
Joined: Fri Jan 14, 2022 8:33 pm

Re: I need help... Google to Hichcharts

Fri Jan 21, 2022 9:41 pm

let me give you a big hug! thank you for the help.. this is probably the best chart build i have seen yet... good job guys.. I can believe I was messing this up.. its clear as day now.. lol. sorry to waste your time..

magdalena
Posts: 514
Joined: Tue Aug 24, 2021 1:32 pm

Re: I need help... Google to Hichcharts

Mon Jan 24, 2022 9:13 am

You're welcome and thank you for your feedback. We really appreciate it! In case of any further questions, feel free to contact us again!
Magdalena Gut
Highcharts support engineer

Return to “Highcharts Maps”