패키지, 저장소 및 앱 카테고리 검색

패키지 상세v0.1.0

flutter_sparkline

Flutter용 아름다운 스파크라인 차트입니다.

30일 다운로드
426
좋아요
72
Pub 점수
30

패키지 설치

flutter pub add flutter_sparkline

패키지 개요

공개 정보를 바탕으로 생성한 선택 가이드입니다.

Flutter Sparkline은 Flutter 애플리케이션에서 컴팩트하고 시각적으로 매력적인 스파크라인 차트를 렌더링하기 위한 가벼운 패키지입니다. 개발자가 텍스트나 UI 요소 내에 작은 간단한 선 그래프를 직접 표시할 수 있게 해주며, 최소한의 공간에서 시간에 따른 추세를 보여주는 데 이상적입니다. 사용자 정의 가능한 색상, 선 두께 및 데이터 포인트 스타일링을 지원하여 대시보드, 보고서 및 분석 인터페이스에 적합합니다. 깔끔한 API와 효율적인 성능 덕분에 기존 Flutter 프로젝트에 쉽게 통합됩니다.

사용 사례

  • 대시보드에서 트렌드 데이터 표시
  • 테이블 내 지표 시각화
  • 앱 분석 UI 개선
  • 단순한 형식으로 과거 데이터 표시
  • 목록 항목에 마이크로 차트 통합

주요 기능

  • 미니멀리스트, 고영향 시각화
  • 사용자 정의 가능한 선 색상 및 너비
  • 부드러운 곡선 렌더링
  • 동적 데이터 업데이트를 지원합니다
  • 경량이고 빠른 성능

적합한 대상

  • 제한된 공간에서의 데이터 시각화
  • 모바일 앱 분석
  • 실시간 메트릭 표시
  • 세밀한 추세 지표가 필요한 UI
  • 복잡함 없이 간단한 차트를 원하는 개발자

고려 사항

  • 행 기반 스파크라인에만 제한됨
  • 툴팁과 같은 상호작용 기능 없음
  • 대규모 데이터 세트에 적합하지 않습니다
  • 데이터 스케일링을 수동으로 처리해야 함
  • 작고 분리된 데이터 시리즈와 함께 사용할 때 가장 좋습니다

원본 README

연결된 소스 저장소의 README 원문 스냅샷입니다. 최신 내용은 저장소에서 확인하세요.

pub package

flutter_sparkline

Beautiful sparkline charts for Flutter.

screenshot

Installation

Install the latest version from pub.

Quick Start

Import the package, create a Sparkline, and pass it your data.

import 'package:flutter/material.dart';
import 'package:flutter_sparkline/flutter_sparkline.dart';

void main() {
  var data = [0.0, 1.0, 1.5, 2.0, 0.0, 0.0, -0.5, -1.0, -0.5, 0.0, 0.0];
  runApp(
    new MaterialApp(
      home: new Scaffold(
        body: new Center(
          child: new Container(
            width: 300.0,
            height: 100.0,
            child: new Sparkline(
              data: data,
            ),
          ),
        ),
      ),
    ),
  );
}

base example screenshot

Customization

Sparkline
Property Default
lineWidth 2.0
lineColor Colors.lightBlue
lineGradient null

Example:

new Sparkline(
  data: data,
  lineWidth: 5.0,
  lineColor: Colors.purple,
);

lineopts example screenshot

new Sparkline(
  data: data,
  lineWidth: 10.0,
  lineGradient: new LinearGradient(
    begin: Alignment.topCenter,
    end: Alignment.bottomCenter,
    colors: [Colors.purple[800], Colors.purple[200]],
  ),
);

lineopts example screenshot


Points
Property Default
pointsMode PointsMode.none
pointSize 4.0
pointColor Colors.lightBlue[800]
PointsMode Description
none (default) Do not draw individual points.
all Draw all the points in the data set.
last Draw only the last point in the data set.

Example:

new Sparkline(
  data: data,
  pointsMode: PointsMode.all,
  pointSize: 8.0,
  pointColor: Colors.amber,
);

all points example screenshot

new Sparkline(
  data: data,
  pointsMode: PointsMode.last,
  pointSize: 8.0,
  pointColor: Colors.amber,
);

last point example screenshot


Fill
Property Default
fillMode FillMode.none
fillColor Colors.lightBlue[200]
fillGradient null
FillMode Description
none (default) Do not fill, draw only the sparkline.
above Fill the area above the sparkline.
below Fill the area below the sparkline.

Example:

new Sparkline(
  data: data,
  fillMode: FillMode.below,
  fillColor: Colors.red[200],
);

fill below example screenshot

new Sparkline(
  data: data,
  fillMode: FillMode.above,
  fillColor: Colors.red[200],
);

fill above example screenshot

new Sparkline(
  data: data,
  fillMode: FillMode.below,
  fillGradient: new LinearGradient(
    begin: Alignment.topCenter,
    end: Alignment.bottomCenter,
    colors: [Colors.red[800], Colors.red[200]],
  ),
);

fill above example screenshot


Todo:
  • [x] simple sparkline
  • [x] custom line width
  • [x] custom line color
  • [x] optional rounded corners
  • [x] fill
  • [x] embiggen individual points/change color
  • [x] different points modes [all/last/none]
  • [ ] animate between two sparklines
  • [ ] animate drawing a single sparkline
  • [ ] gesture detector to select closest point to tap
  • [ ] baseline
  • [x] different fill modes [above/below/none]
  • [x] fix edge points overflowing by offsetting by lineWidth
  • [ ] better corner rounding
  • [ ] axis labels
  • [x] gradient shader on line paint
  • [x] gradient shader on fill paint
  • [ ] multiple overlapping sparklines on a shared axis
  • [ ] tests

카테고리

소스 저장소

이 패키지를 사용하는 프로젝트

아직 데이터가 없습니다.