ravish raja
ravish raja

Reputation: 19

Worldmap Panel Grafana

My data:

enter image description here

New York    10
Paris        8
Mumbai      15
Tokya        7
Sydney       8
London      11

How will I plot the above data using WorldMap Panel in grafana. I want to show the values corresponding to there location.

Upvotes: 0

Views: 414

Answers (1)

jack
jack

Reputation: 77

See:

CREATE TABLE `worldmap` (
      `id` int(11) NOT NULL AUTO_INCREMENT,
      `country_code` varchar(3) NOT NULL,
      `value` INT NOT NULL,
      `timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
      PRIMARY KEY (`id`)
    ) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=latin1;
    and with data like this:

    INSERT INTO `testdata`.`worldmap`
    (`country_code`,
    `value`,
    `timestamp`)
    VALUES
    ('IE',
    3.0,
    now());
    and this query (although it is probably better to do a GROUP BY and sum here rather than using Grafana’s aggregation):

    SELECT
      UNIX_TIMESTAMP(`timestamp`) as time_sec,
      `value` as value,
      country_code as metric
    FROM worldmap
    WHERE $__timeFilter(`timestamp`)
    ORDER BY `timestamp` ASC

Upvotes: 0

Related Questions