Skip to content

Graph with no data will set itself to time series mode #5

@leamingrad

Description

@leamingrad

pyFlot decides whether to set its variables into timeseries mode using the following function:

def _get_axis_mode(self, axis):
    "will get the axis mode for the current series"
    if all([isinstance(getattr(s, axis), TimeVariable) for s in self._series]):
        return 'time'
    return None

However, if no data has been provided (for example if you want to use pyFlot as a shortcut to instantiate an empty graph and then fill it using ajax), this will set the x axis to be a time series variable.

Probably quickest to replace the above with something along the lines of:

def _get_axis_mode(self, axis):
    "will get the axis mode for the current series"
    series_list = [isinstance(getattr(s, axis), TimeVariable) for s in self._series]
    if all(series_list) and series_list:
        return 'time'
    return None

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions