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

flutter_echarts 표지
패키지 상세v2.5.0

flutter_echarts

Apache ECharts를 기반으로 한 데이터 시각화 차트 라이브러리로, WebGL 3D, GIS 지도 등 고급 차트를 만들 수 있습니다.

AndroidiOSmacOS
30일 다운로드
5.5천
좋아요
578
Pub 점수
130

패키지 설치

flutter pub add flutter_echarts

패키지 개요

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

flutter_echarts는 Apache ECharts를 기반으로 한 강력한 데이터 시각화 라이브러리입니다. WebGL 3D 시각화 및 상호작용 가능한 GIS 지도와 같은 고급 차트를 생성할 수 있게 해줍니다. 이 패키지는 Android, iOS, macOS 등 여러 플랫폼을 지원하며, Flutter 앱 내에서 풍부하고 동적인 차트 기능을 제공합니다. 간단한 pub 명령어를 통해 원활하게 통합되므로, 고성능이고 기능이 풍부한 데이터 표현이 필요한 애플리케이션에 적합합니다.

사용 사례

  • 인터랙티브 대시보드
  • 지리공간 데이터 매핑
  • 3D 데이터 시각화
  • 실시간 분석 표시
  • 모바일 앱에서의 복잡한 차트 렌더링

주요 기능

  • WebGL 3D 차트를 지원합니다
  • 내장 GIS 지도 통합
  • 고성능 렌더링
  • 크로스 플랫폼 호환성
  • 풍부한 차트 유형

적합한 대상

  • 데이터 집약형 애플리케이션
  • 분석 플랫폼
  • 모바일 지식정보시스템 도구
  • 공학 및 과학 앱
  • 엔터프라이즈 대시보드 개발

고려 사항

  • ECharts 구성에 대한 이해 필요
  • 통합된 자산으로 인해 앱 크기가 증가할 수 있습니다
  • 성능은 기기 하드웨어에 따라 달라집니다
  • 제한된 네이티브 플러터 위젯 통합
  • 초보자를 위한 학습 곡선이 더 가파릅니다

원본 README

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

Archiving Note

After many years, this project, as a transitional solution using Webview, has completed its historical mission and is therefore being archived. We recommend Graphic or other native chart libraries as alternatives.

中文

*A Flutter widget to use [Apache ECharts](https://github.com/apache/incubator-echarts) in a reactive way.*

Features

Reactive Updating

The most exciting feature of Flutter widgets and React components is that the view can update reactively when data changes. Thanks to ECharts' data driven architecture, flutter_echarts implements a reactive way to connect charts with data. The charts automatically re-render when data in the option property changes.

Two Way Communication

The onMessage and extraScript properties provide a way to set two-way event communication between Flutter and JavaScript.

Configurable Extensions

ECharts has a lot of extensions. The extensions property allows you to inject the extension scripts as raw strings. In this way, you can copy these scripts to your source code without being confusing by assets dirs.

Installing

Add this to your package's pubspec.yaml file:

dependencies:
  flutter_echarts: #latest version

Now in your Dart code, you can use:

import 'package:flutter_echarts/flutter_echarts.dart';  

Details see pub.dev.

Usage

The flutter_echarts package itself is very simple to use, just like a common statelessWidget:

Details about the option object is in the Echarts docs or Echarts examples.

Container(
  child: Echarts(
  option: '''
    {
      xAxis: {
        type: 'category',
        data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
      },
      yAxis: {
        type: 'value'
      },
      series: [{
        data: [820, 932, 901, 934, 1290, 1330, 1320],
        type: 'line'
      }]
    }
  ''',
  ),
  width: 300,
  height: 250,
)

See the full flutter_echarts_example.

bar boxplot effectScatter funnel gague geo graph heatmap kline line liquid map parallel pie radar scatter wordCloud bar3D line3D sankey scatter3D surface3D themeRiver overlap

Widget Properties

option

String

( required )

ECharts is mainly configured by passing a string value to the JavaScript option property.

You can use jsonEncode() function in dart:convert to convert data in Dart object form:

source: ${jsonEncode(_data1)},

Because JavaScript don't have ''', you can use this operator to reduce some escape operators for quotas:

Echarts(
  option: '''
  
    // option string
    
  ''',
),

To use images in option properties, we suggest the Base64 Data URL :

image: 'data:image/png;base64,iVBORw0KG...',

extraScript

String

JavaScript which will execute after the Echarts.init() and before any chart.setOption(). The widget has a Javascript channel named Messager, so you can use this identifier to send messages from JavaScript to Flutter:

extraScript: '''
  chart.on('click', (params) => {
    if(params.componentType === 'series') {
        Messager.postMessage('anything');
    }
  });
''',

onMessage

void Function(String)?

Function to handle the message sent by Messager.postMessage() in extraScript .

extensions

List<String>

List of strings are from Echarts extensions, such as themes, components, WebGL, and languages. You can download them from the official ECharts extension list. Insert extensions as raw strings:

const liquidPlugin = r'''

  // copy from liquid.min.js

''';

theme

String

You can download built-in ECharts themes or build your own custom themes with the ECharts theme builder. Copy the theme script into the extensions param and register the theme name with this param.

captureAllGestures

bool

( default: false )

Setting captureAllGestures to true is useful when handling 3D rotation and data zoom bars. Note that setting prevents containers like ListViews from reacting to gestures on the charts.

If true, captureHorizontalGestures and captureVerticalGestures are forced true.

captureHorizontalGestures

bool

( default: false )

Only capture horizontal gestures.

captureVerticalGestures

bool

( default: false )

Only capture vertical gestures.

onLoad

void Function(WebViewController)?

The callback when first time the chart is loaded and rendered. You can get the webview controller from this function to do your magic.

reloadAfterInit

bool

( default: false )

If you have trouble in rendering charts in "Movable Widgets"(ListView, SliverView, PageVIew...) on iOS, try setting reloadAfterInit to true .

onWebResourceError

void Function(WebViewController, Exception)?

Handle the web resource error.

Blog

Reactive Echarts Flutter Widget

A performance optimization of Flutter WebView


If you have any suggestions or requests, please open an issue.

The gallery GIF is from chenjiandongx

카테고리

의존성

의존성 목록 1 개

소스 저장소

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