我的数据:
New York 10
Paris 8
Mumbai 15
Tokya 7
Sydney 8
London 11
我将如何使用grafana中的WorldMap面板绘制上述数据。 我想显示与该位置相对应的值。
最佳答案
参见:
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
关于mysql - 世界地图面板 Grafana,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52946843/