Line Chart
LineChart draws one field of its events against another.
import dachshund
from dachshund.widgets import LineChart
with dachshund.row():
dachshund.add(LineChart("throughput", x="requests", y="latency"))
dachshund.emit("throughput", requests=120, latency=96)
dachshund.widgets.chart.line.LineChart
dataclass
LineChart(name, *, source='', title=None, actions=list(), action_args=dict(), x, y='value')
Bases: Widget
A line of one field against another.
An event without x isn't drawn. To draw against when events happened,
see TimeSeriesChart.
Example
with dachshund.row():
dachshund.add(LineChart("throughput", x="requests", y="latency"))
dachshund.emit("throughput", requests=120, latency=96)
Options
x(str) - The field placing a point. Required.y(str | list[str]) - The field drawn, or one line per field. Defaults to"value".
x
instance-attribute
x
y
class-attribute
instance-attribute
y = 'value'
type
class-attribute
type = 'line'
op
class-attribute
op = 'append'
script
class-attribute
script = Path(__file__).parent / 'charts.js'
style
class-attribute
style = Path(__file__).parent / 'charts.css'
rollup_safe
class-attribute
rollup_safe = True
series
property
series
The fields this chart draws, a line each.
render
render(events)
Build the columns uPlot draws its series from.
Source code in dachshund/widgets/chart/line.py
57 58 59 60 61 62 63 64 65 66 67 | |
update
update(event)
Build the row a new event appends, a value per series.
Returns None when the event has no readable x to place it at.
Source code in dachshund/widgets/chart/line.py
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 | |
at
at(event)
Where along the x axis the event's own reading puts it.
Returns None when the event carries no usable reading.
Source code in dachshund/widgets/chart/line.py
85 86 87 88 89 90 | |