mirror of
https://github.com/Textualize/textual.git
synced 2025-10-17 02:38:12 +03:00
* Sparkline widget proof of concept. * Address review comment. Related comments: https://github.com/Textualize/textual/pull/2631\#discussion_r1202894414 * Blend background colours. * Add widget sparkline. * Add snapshot tests. * Add documentation. * Update roadmap. * Address review feedback. Relevant comments: https://github.com/Textualize/textual/pull/2631\#discussion_r1210394532, https://github.com/Textualize/textual/pull/2631\#discussion_r1210442013 * Improve docs. Relevant comments: https://github.com/Textualize/textual/pull/2631\#issuecomment-1568529074 * Update snapshot app titles. * Don't init summary function with None Related comments: https://github.com/Textualize/textual/pull/2631\#discussion_r1211666076 * Apply suggestions from code review Co-authored-by: Dave Pearson <davep@davep.org> * Improve wording. * Improve wording. * Simplify example. --------- Co-authored-by: Dave Pearson <davep@davep.org>
20 lines
441 B
Python
20 lines
441 B
Python
from textual.app import App, ComposeResult
|
|
from textual.widgets._sparkline import Sparkline
|
|
|
|
data = [1, 2, 2, 1, 1, 4, 3, 1, 1, 8, 8, 2] # (1)!
|
|
|
|
|
|
class SparklineBasicApp(App[None]):
|
|
CSS_PATH = "sparkline_basic.css"
|
|
|
|
def compose(self) -> ComposeResult:
|
|
yield Sparkline( # (2)!
|
|
data, # (3)!
|
|
summary_function=max, # (4)!
|
|
)
|
|
|
|
|
|
app = SparklineBasicApp()
|
|
if __name__ == "__main__":
|
|
app.run()
|