From 1a0a0e847df5fa9c9b8ca9a69f3d77028ac5133d Mon Sep 17 00:00:00 2001 From: Vinit Bhat <99.bhatvinit@gmail.com> Date: Fri, 29 Sep 2023 20:43:20 +0530 Subject: [PATCH] added tooltipSort to TimeSeries Panel (#631) --- CHANGELOG.rst | 1 + grafanalib/core.py | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index b9c80561..8aa74ed8 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -20,6 +20,7 @@ Changelog * added axisSoftMin and axisSoftMax options for TimeSeries * Added support for Azure Data Explorer datasource plugin (https://github.com/grafana/azure-data-explorer-datasource) * Added ``sortBy`` parameter to Table panel +* Added ``tooltipSort`` parameter to TimeSeries panel .. _`Bar_Chart`: https://grafana.com/docs/grafana/latest/panels-visualizations/visualizations/bar-chart/ .. _`RateMetricAgg`: https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-metrics-rate-aggregation.html diff --git a/grafanalib/core.py b/grafanalib/core.py index f9c3409e..cf7826a1 100644 --- a/grafanalib/core.py +++ b/grafanalib/core.py @@ -2262,6 +2262,8 @@ class TimeSeries(Panel): :param thresholds: single stat thresholds :param tooltipMode: When you hover your cursor over the visualization, Grafana can display tooltips single (Default), multi, none + :param tooltipSort: To sort the tooltips + none (Default), asc, desc :param unit: units :param thresholdsStyleMode: thresholds style mode off (Default), area, line, line+area :param valueMin: Minimum value for Panel @@ -2319,6 +2321,7 @@ class TimeSeries(Panel): showPoints = attr.ib(default='auto', validator=instance_of(str)) stacking = attr.ib(factory=dict, validator=instance_of(dict)) tooltipMode = attr.ib(default='single', validator=instance_of(str)) + tooltipSort = attr.ib(default='none', validator=instance_of(str)) unit = attr.ib(default='', validator=instance_of(str)) thresholdsStyleMode = attr.ib(default='off', validator=instance_of(str)) @@ -2379,7 +2382,8 @@ def to_json_data(self): 'calcs': self.legendCalcs }, 'tooltip': { - 'mode': self.tooltipMode + 'mode': self.tooltipMode, + 'sort': self.tooltipSort } }, 'type': TIMESERIES_TYPE,