How to use the grafanalib.core.RGBA function in grafanalib

To help you get started, we’ve selected a few grafanalib examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github weaveworks / grafanalib / grafanalib / core.py View on Github external
return '{}px'.format(self.num)


@attr.s
class Percent(object):
    num = attr.ib(default=100, validator=instance_of(Number))

    def to_json_data(self):
        return '{}%'.format(self.num)


GREY1 = RGBA(216, 200, 27, 0.27)
GREY2 = RGBA(234, 112, 112, 0.22)
BLUE_RGBA = RGBA(31, 118, 189, 0.18)
BLUE_RGB = RGB(31, 120, 193)
GREEN = RGBA(50, 172, 45, 0.97)
ORANGE = RGBA(237, 129, 40, 0.89)
RED = RGBA(245, 54, 54, 0.9)
BLANK = RGBA(0, 0, 0, 0.0)

INDIVIDUAL = 'individual'
CUMULATIVE = 'cumulative'

NULL_CONNECTED = 'connected'
NULL_AS_ZERO = 'null as zero'
NULL_AS_NULL = 'null'

FLOT = 'flot'

ABSOLUTE_TYPE = 'absolute'
DASHBOARD_TYPE = 'dashboard'
GRAPH_TYPE = 'graph'
github weaveworks / grafanalib / grafanalib / zabbix.py View on Github external
:param showEvents: defines event type to query (Ok, Problems, All)
    :param showTriggers: defines trigger type to query
        (all, acknowledged, unacknowledged)
    :param sortTriggersBy: defines trigger sort policy
    :param span: defines span number for panel
    :param statusField: defines if status field should be shown
    :param transparent: defines if panel should be transparent
    :param triggerSeverity: defines colors for trigger severity,
    :param triggers: trigger query

    """
    dataSource = attr.ib()
    title = attr.ib()

    ackEventColor = attr.ib(default=attr.Factory(lambda: BLANK),
                            validator=instance_of(RGBA))
    ageField = attr.ib(default=True, validator=instance_of(bool))
    customLastChangeFormat = attr.ib(default=False,
                                     validator=instance_of(bool))
    description = attr.ib(default="", validator=instance_of(str))
    fontSize = attr.ib(default=attr.Factory(Percent),
                       validator=instance_of(Percent))
    height = attr.ib(default=DEFAULT_ROW_HEIGHT, validator=instance_of(Pixels))
    hideHostsInMaintenance = attr.ib(default=False,
                                     validator=instance_of(bool))
    hostField = attr.ib(default=True, validator=instance_of(bool))
    hostTechNameField = attr.ib(default=False, validator=instance_of(bool))
    id = attr.ib(default=None)
    infoField = attr.ib(default=True, validator=instance_of(bool))
    lastChangeField = attr.ib(default=True, validator=instance_of(bool))

    lastChangeFormat = attr.ib(default="")
github weaveworks / grafanalib / grafanalib / core.py View on Github external
@attr.s
class Percent(object):
    num = attr.ib(default=100, validator=instance_of(Number))

    def to_json_data(self):
        return '{}%'.format(self.num)


GREY1 = RGBA(216, 200, 27, 0.27)
GREY2 = RGBA(234, 112, 112, 0.22)
BLUE_RGBA = RGBA(31, 118, 189, 0.18)
BLUE_RGB = RGB(31, 120, 193)
GREEN = RGBA(50, 172, 45, 0.97)
ORANGE = RGBA(237, 129, 40, 0.89)
RED = RGBA(245, 54, 54, 0.9)
BLANK = RGBA(0, 0, 0, 0.0)

INDIVIDUAL = 'individual'
CUMULATIVE = 'cumulative'

NULL_CONNECTED = 'connected'
NULL_AS_ZERO = 'null as zero'
NULL_AS_NULL = 'null'

FLOT = 'flot'

ABSOLUTE_TYPE = 'absolute'
DASHBOARD_TYPE = 'dashboard'
GRAPH_TYPE = 'graph'
SINGLESTAT_TYPE = 'singlestat'
github weaveworks / grafanalib / grafanalib / core.py View on Github external
@attr.s
class Percent(object):
    num = attr.ib(default=100, validator=instance_of(Number))

    def to_json_data(self):
        return '{}%'.format(self.num)


GREY1 = RGBA(216, 200, 27, 0.27)
GREY2 = RGBA(234, 112, 112, 0.22)
BLUE_RGBA = RGBA(31, 118, 189, 0.18)
BLUE_RGB = RGB(31, 120, 193)
GREEN = RGBA(50, 172, 45, 0.97)
ORANGE = RGBA(237, 129, 40, 0.89)
RED = RGBA(245, 54, 54, 0.9)
BLANK = RGBA(0, 0, 0, 0.0)

INDIVIDUAL = 'individual'
CUMULATIVE = 'cumulative'

NULL_CONNECTED = 'connected'
NULL_AS_ZERO = 'null as zero'
NULL_AS_NULL = 'null'

FLOT = 'flot'

ABSOLUTE_TYPE = 'absolute'
DASHBOARD_TYPE = 'dashboard'
GRAPH_TYPE = 'graph'
SINGLESTAT_TYPE = 'singlestat'
TABLE_TYPE = 'table'
github weaveworks / grafanalib / grafanalib / core.py View on Github external
def to_json_data(self):
        return '{}px'.format(self.num)


@attr.s
class Percent(object):
    num = attr.ib(default=100, validator=instance_of(Number))

    def to_json_data(self):
        return '{}%'.format(self.num)


GREY1 = RGBA(216, 200, 27, 0.27)
GREY2 = RGBA(234, 112, 112, 0.22)
BLUE_RGBA = RGBA(31, 118, 189, 0.18)
BLUE_RGB = RGB(31, 120, 193)
GREEN = RGBA(50, 172, 45, 0.97)
ORANGE = RGBA(237, 129, 40, 0.89)
RED = RGBA(245, 54, 54, 0.9)
BLANK = RGBA(0, 0, 0, 0.0)

INDIVIDUAL = 'individual'
CUMULATIVE = 'cumulative'

NULL_CONNECTED = 'connected'
NULL_AS_ZERO = 'null as zero'
NULL_AS_NULL = 'null'

FLOT = 'flot'

ABSOLUTE_TYPE = 'absolute'
github weaveworks / grafanalib / grafanalib / core.py View on Github external
class Pixels(object):
    num = attr.ib(validator=instance_of(int))

    def to_json_data(self):
        return '{}px'.format(self.num)


@attr.s
class Percent(object):
    num = attr.ib(default=100, validator=instance_of(Number))

    def to_json_data(self):
        return '{}%'.format(self.num)


GREY1 = RGBA(216, 200, 27, 0.27)
GREY2 = RGBA(234, 112, 112, 0.22)
BLUE_RGBA = RGBA(31, 118, 189, 0.18)
BLUE_RGB = RGB(31, 120, 193)
GREEN = RGBA(50, 172, 45, 0.97)
ORANGE = RGBA(237, 129, 40, 0.89)
RED = RGBA(245, 54, 54, 0.9)
BLANK = RGBA(0, 0, 0, 0.0)

INDIVIDUAL = 'individual'
CUMULATIVE = 'cumulative'

NULL_CONNECTED = 'connected'
NULL_AS_ZERO = 'null as zero'
NULL_AS_NULL = 'null'

FLOT = 'flot'
github weaveworks / grafanalib / grafanalib / zabbix.py View on Github external
hideHostsInMaintenance = attr.ib(default=False,
                                     validator=instance_of(bool))
    hostField = attr.ib(default=True, validator=instance_of(bool))
    hostTechNameField = attr.ib(default=False, validator=instance_of(bool))
    id = attr.ib(default=None)
    infoField = attr.ib(default=True, validator=instance_of(bool))
    lastChangeField = attr.ib(default=True, validator=instance_of(bool))

    lastChangeFormat = attr.ib(default="")
    limit = attr.ib(default=10, validator=instance_of(int))
    links = attr.ib(default=attr.Factory(list),
                    validator=is_list_of(DashboardLink))
    markAckEvents = attr.ib(default=False, validator=instance_of(bool))
    minSpan = attr.ib(default=None)
    okEventColor = attr.ib(default=attr.Factory(lambda: GREEN),
                           validator=instance_of(RGBA))
    pageSize = attr.ib(default=10, validator=instance_of(int))
    repeat = attr.ib(default=None)
    scroll = attr.ib(default=True, validator=instance_of(bool))
    severityField = attr.ib(default=False, validator=instance_of(bool))
    showEvents = attr.ib(default=attr.Factory(lambda: ZABBIX_EVENT_PROBLEMS))
    showTriggers = attr.ib(default=ZABBIX_TRIGGERS_SHOW_ALL)
    sortTriggersBy = attr.ib(
        default=attr.Factory(lambda: ZABBIX_SORT_TRIGGERS_BY_CHANGE),
    )
    span = attr.ib(default=None)
    statusField = attr.ib(default=False, validator=instance_of(bool))
    transparent = attr.ib(default=False, validator=instance_of(bool))
    triggerSeverity = attr.ib(
        default=ZABBIX_SEVERITY_COLORS,
        converter=convertZabbixSeverityColors,
    )
github weaveworks / grafanalib / grafanalib / core.py View on Github external
VTYPE_CURR = "current"
VTYPE_TOTAL = "total"
VTYPE_NAME = "name"
VTYPE_FIRST = "first"
VTYPE_DELTA = "delta"
VTYPE_RANGE = "range"
VTYPE_DEFAULT = VTYPE_AVG


@attr.s
class Grid(object):

    threshold1 = attr.ib(default=None)
    threshold1Color = attr.ib(
        default=attr.Factory(lambda: GREY1),
        validator=instance_of(RGBA),
    )
    threshold2 = attr.ib(default=None)
    threshold2Color = attr.ib(
        default=attr.Factory(lambda: GREY2),
        validator=instance_of(RGBA),
    )

    def to_json_data(self):
        return {
            'threshold1': self.threshold1,
            'threshold1Color': self.threshold1Color,
            'threshold2': self.threshold2,
            'threshold2Color': self.threshold2Color,
        }
github weaveworks / grafanalib / grafanalib / core.py View on Github external
num = attr.ib(validator=instance_of(int))

    def to_json_data(self):
        return '{}px'.format(self.num)


@attr.s
class Percent(object):
    num = attr.ib(default=100, validator=instance_of(Number))

    def to_json_data(self):
        return '{}%'.format(self.num)


GREY1 = RGBA(216, 200, 27, 0.27)
GREY2 = RGBA(234, 112, 112, 0.22)
BLUE_RGBA = RGBA(31, 118, 189, 0.18)
BLUE_RGB = RGB(31, 120, 193)
GREEN = RGBA(50, 172, 45, 0.97)
ORANGE = RGBA(237, 129, 40, 0.89)
RED = RGBA(245, 54, 54, 0.9)
BLANK = RGBA(0, 0, 0, 0.0)

INDIVIDUAL = 'individual'
CUMULATIVE = 'cumulative'

NULL_CONNECTED = 'connected'
NULL_AS_ZERO = 'null as zero'
NULL_AS_NULL = 'null'

FLOT = 'flot'