MPAndroidChart Flutter version

Overview

MPFlutterChart

flutter charts just like MPAndroidChart

The minimum version currently supported is 1.7.3. If you use flutter with lower version, checkout and use 'localPosition-support' branch, this branch support for flutter version which XXXDetails and PointerXXXEvent not support wiget local postion

Thanks for MPAndroidChart, when translate this library to flutter I learned a lot about matrix use in animation.

todos

1.potential bugs fix

Get Start

1.add dependencies

    dependencies:
        mp_chart: ^0.2.2

2.download example and see how to use

More Examples

LineCharts







BarCharts







PieCharts



OtherCharts





ScrollingCharts





EvenMoreCharts



License

Copyright 2019 SunPointed

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Comments
  • horizontal zoom not working as individual

    horizontal zoom not working as individual

    horizontal zoom not working as individual even when pinchZoomEnabled: false it is zooming proportional when I try to zoom horizontal. But vertical zooming working individual.

    opened by keskink 14
  • flutter版本用1.5.4出现错误。

    flutter版本用1.5.4出现错误。

    运行测试例子,flutter版本用1.5.4,出现错误,如下: Error: The method 'groupBars' isn't defined for the class 'BarChart'. Error: The getter 'localPosition' isn't defined for the class 'PointerDownEvent'. Error: The getter 'localPosition' isn't defined for the class 'TapDownDetails'.等等。 请问能否支持flutter1.5.4版本?

    opened by inprise1980 9
  • Chart can't move when inside a PageView

    Chart can't move when inside a PageView

    If a chart is inside a PageView, swiping horizontally does not move the chart but instead moving the PageView. Steps to reproduce: 1: Create a chart inside a PageView. This PageView should have more than 2 pages. 2: Pinch the chart to zoom in 3: Drag the chart to move but can't. If you drag vertically then switch to horizontally, the chart can move normally. However, If you try to move it horizontally first, it will not work.

    opened by khanhnguyen-96 4
  • textColor not chaning any legent label colors. (still continue this issue.)

    textColor not chaning any legent label colors. (still continue this issue.)

    textColor not chaning any legent label colors.

    I try too many different method for change legent text color for dark mode. Now legend color is blakc. it can not shown in dark mode.

    Regards

    opened by keskink 4
  • TextPainter.paint called when text geometry was not yet calculated.

    TextPainter.paint called when text geometry was not yet calculated.

    Hello everyone , I now create line chart. sorry that I am not strong English. I have some problem which I don't know why my console call "TextPainter.paint called when text geometry was not yet calculated." while i was tapping the chart ,the marker view didn't show also. Does anyone know what to do for fixing? This is my Code.

    class CreateTest{

    CreateTest(); Widget returnLineChart() { var desc = Description()..enabled = false; var dataPoint = List(); List dataSets = List(); dataPoint.add(Entry(x: 1, y: 2)); dataPoint.add(Entry(x: 2, y: 3)); dataPoint.add(Entry(x: 3, y: 4)); dataPoint.add(Entry(x: 4, y: 5)); dataPoint.add(Entry(x: 5, y: 6)); dataPoint.add(Entry(x: 6, y: 7)); dataPoint.add(Entry(x: 7, y: 8)); dataPoint.add(Entry(x: 8, y: 9)); dataPoint.add(Entry(x: 9, y: 1)); LineDataSet set1; set1 = LineDataSet(dataPoint, "DataSet 1"); set1.setDrawIcons(false); set1.enableDashedLine(10, 5, 0); set1.setColor1(ColorUtils.BLACK); set1.setCircleColor(ColorUtils.BLACK); set1.setHighLightColor(ColorUtils.PURPLE); set1.setLineWidth(1); set1.setCircleRadius(3); set1.setDrawCircleHole(false); set1.setFormLineWidth(1); set1.setFormLineDashEffect(DashPathEffect(10, 5, 0)); set1.setFormSize(15); set1.setValueTextSize(9); set1.enableDashedHighlightLine(10, 5, 0); set1.setDrawFilled(true); set1.setFillColor(ColorUtils.FADE_RED_END); dataSets.add(set1); var controller = LineChartController( axisLeftSettingFunction: (axisLeft, controller) { axisLeft ..drawLimitLineBehindData = true ..enableGridDashedLine(10, 10, 0) ..enableAxisLineDashedLine(5, 5, 0) ..setAxisMaximum(10) ..setAxisMinimum(1); }, axisRightSettingFunction: (axisRight, controller) { axisRight.enabled = (false); }, legendSettingFunction: (legend, controller) { legend.shape = (LegendForm.LINE); }, xAxisSettingFunction: (xAxis, controller) { xAxis ..drawLimitLineBehindData = true ..enableAxisLineDashedLine(5, 5, 0) ..enableGridDashedLine(10, 10, 0); }, drawGridBackground: false, backgroundColor: ColorUtils.WHITE, dragXEnabled: true, dragYEnabled: true, scaleXEnabled: true, scaleYEnabled: true, pinchZoomEnabled: true, description: desc); controller.setViewPortOffsets(16, 16, 16, 16); controller.data = LineData.fromList(dataSets); return LineChart(controller); }

    }

    opened by izzabellerina 4
  • [bug] problem in autoScale

    [bug] problem in autoScale

    i create to custom autoScale for combind follow Candle data

    https://streamable.com/wfqkw

      @override
      void onMoveUpdate(double x, double y) {
        double xmin=controller.getValuesByTouchPoint(controller.viewPortHandler.contentLeft(),controller.viewPortHandler.contentBottom(), AxisDependency.RIGHT).x;
        double xmax=controller.getValuesByTouchPoint(controller.viewPortHandler.contentRight(),controller.viewPortHandler.contentBottom(), AxisDependency.RIGHT).x;
    
        double ymin=controller.getValuesByTouchPoint(controller.viewPortHandler.contentRight(),controller.viewPortHandler.contentBottom(), AxisDependency.RIGHT).y;
        double ymax=controller.getValuesByTouchPoint(controller.viewPortHandler.contentRight(),controller.viewPortHandler.contentTop(), AxisDependency.RIGHT).y;
        double candle_y_max=0;
        double candle_y_min=double.maxFinite;
    
        for(int i=xmin.toInt();i<xmax;i++){
          if(i>=0 && i< entries.length){
            if(candle_y_min>entries[i].shadowLow){
              candle_y_min=entries[i].shadowLow;
            }
            if(candle_y_max<entries[i].shadowHigh){
              candle_y_max=entries[i].shadowHigh;
            }
          }
    
        }
        double space=0.20;
        controller.moveViewTo(xmin,(candle_y_min+((ymax-ymin)/2))-space, AxisDependency.RIGHT);
        controller.setVisibleYRange(0.0,(candle_y_max-candle_y_min)+(space),AxisDependency.RIGHT);
        
      }
    
    opened by m2faridi 4
  • LongPress events?

    LongPress events?

    Please consider adding onLongPressStart, onLongPressMoveUpdate, and onLongPressEnd events to OnTouchEventListener.

    Because I want to implement like this: On simple drag => move the chart On long press drag => move the highlight marker

    opened by crizant 3
  • Pie Chart Center Text fontFamily and fontWeight bug fix and new options centerTextColor and centerTextSize

    Pie Chart Center Text fontFamily and fontWeight bug fix and new options centerTextColor and centerTextSize

    • Pie Chart Center Text fontFamily and fontWeight were not working, fixed the bug, now below code should set the font PieChartController(centerTextTypeface: TypeFace(fontFamily: 'Roboto', fontWeight: FontWeight.bold));

    • Pie Chart Center Text added new options to customize centerTextColor and centerTextSize, current version was always painting text in Black with 12 font size. After this change if values are provided using PieChartController these will be used, if these are null then current implementation will work with backward compatibility PieChartController(centerText: '2020',centerTextColor: AppColors.blue, centerTextSize: 20); Change details

    @SunPointed If you like the changes, feel free to pull

    opened by absar 2
  • moveViewToX does not work

    moveViewToX does not work

    opened by typ0520 2
  • Transparence does not work

    Transparence does not work

    I want to combine 2 Horizontal Bar Chart and Scatter Plot Chart. Although I use Stack to overlap together, 2 charts are put on one background but don't have transparent field => Chart 1 cannot be displayed. I set drawGridBackground: false but it doesn't work. Please give me a solution, thank you.

    opened by dunght196 2
  • Linechart  setGradientColors not working...

    Linechart setGradientColors not working...

    I am using linechart in one of my application. I want to show multiple gradient colors. I have used setGradientColors() as follow;

    LineDataSet set1 = LineDataSet(vals, Strings.emptyString); set1.setColor1(Colors.black); set1.setDrawValues(false); set1.setDrawFilled(true); List<GradientColor> gradientColors = []; gradientColors.add(GradientColor(Colors.red, Colors.green)); gradientColors.add(GradientColor(Colors.yellow, Colors.blue)); gradientColors.add(GradientColor(Colors.amber, Colors.pink)); gradientColors.add(GradientColor(Colors.purple, Colors.cyan)); gradientColors.add(GradientColor(Colors.red, Colors.yellow)); set1.setGradientColors(gradientColors); set1.setLineWidth(1); set1.setDrawCircles(false);

    But its not working and linechart shows only one color as following;

    Screenshot 2022-01-20 at 9 29 09 PM

    @SunPointed So, pls help to find proper solution. Thanks in advance.

    opened by nbsathawara 0
  •  The method 'then' isn't defined for the class 'FutureOr<dynamic>'

    The method 'then' isn't defined for the class 'FutureOr'

    Try correcting the name to the name of an existing method, or defining a method named 'then'. .then((value) { ^^^^ /C:/flutter/.pub-cache/hosted/pub.dartlang.org/mp_chart-0.3.1/lib/mp/core/utils/painter_utils.dart:15:34: Error: The getter 'text' isn't defined for the class 'InlineSpan'.

    • 'InlineSpan' is from 'package:flutter/src/painting/inline_span.dart' ('/C:/flutter/packages/flutter/lib/src/painting/inline_span.dart'). Try correcting the name to the name of an existing getter, or defining a getter or field named 'text'. var preText = painter.text.text;
    opened by safu2011 5
  • Is this lib discontinued ?

    Is this lib discontinued ?

    As this lib has no update since 30th October 2020 : https://pub.dev/packages/mp_chart

    So, is there any update after this ?

    because , in our current running project its conflicting with other libs.

    Please provide updates.

    opened by mehtahardikr 2
  • Problems encountered when running the sample project(运行示例项目碰到的问题)

    Problems encountered when running the sample project(运行示例项目碰到的问题)

    Q1:../lib/mp/chart/chart.dart:51:12: Error: The method 'then' isn't defined for the class 'FutureOr<dynamic>'. Try correcting the name to the name of an existing method, or defining a method named 'then'. .then((value) {

    A1:change ‘../lib/mp/chart/chart.dart:51’ before: ImageGallerySaver.saveImage(Uint8List.fromList(imgFile.readAsBytesSync())) .then((value) { imgFile.delete(); }); after: var result = ImageGallerySaver.saveImage(Uint8List.fromList(imgFile.readAsBytesSync())); if(result is Future<dynamic>){ result.then((value) => imgFile.delete()); }

    Q2:`../lib/mp/core/utils/painter_utils.dart:15:34: Error: The getter 'text' isn't defined for the class 'InlineSpan'.

    • 'InlineSpan' is from 'package:flutter/src/painting/inline_span.dart' ('/E:/flutter/packages/flutter/lib/src/painting/inline_span.dart'). Try correcting the name to the name of an existing getter, or defining a getter or field named 'text'. var preText = painter.text.text;A2:change '../lib/mp/core/utils/painter_utils.dart:15' before:var preText = painter.text.text;after:var preText = (painter.text as TextSpan).text;`

    If you have other questions, you can try to leave me a message

    opened by Alrey-xxl 1
Owner
null
Animated radial and pie charts for Flutter

Flutter Circular Chart A library for creating animated circular chart widgets with Flutter, inspired by Zero to One with Flutter. Overview Create easi

Victor Choueiri 387 Dec 26, 2022
Beautiful sparkline charts for Flutter

flutter_sparkline Beautiful sparkline charts for Flutter. Installation Install the latest version from pub. Quick Start Import the package, create a S

Victor Choueiri 255 Dec 21, 2022
Elegant OHLC Candlestick and Trade Volume charts for @Flutter

flutter_candlesticks Elegant OHLC Candlestick and Trade Volume charts for Flutter Usage Install for Flutter with pub. Property Description data Requir

Trent Piercy 402 Dec 21, 2022
A powerful Flutter chart library, currently supporting Line Chart, Bar Chart, Pie Chart, Scatter Chart and Radar Chart.

FL Chart ?? A library to draw fantastic charts in Flutter ?? Chart Types LineChart BarChart PieChart Read More Read More Read More ScatterChart RadarC

Iman khoshabi 5.2k Dec 27, 2022
A beautiful bezier line chart widget for flutter that is highly interactive and configurable.

Bezier Chart A beautiful bezier line chart widget for flutter that is highly interactive and configurable. Features Multi bezier lines Allow numbers a

Aeyrium 428 Dec 21, 2022
A Flutter widget to use Apache ECharts (incubating) in a reactive way.

中文 [![pub](https://img.shields.io/pub/v/flutter_echarts.svg)](https://pub.dev/packages/flutter_echarts) A Flutter widget to use Apache ECharts in a re

LIN Chen 629 Dec 29, 2022
A Flutter data visualization library based on Grammar of Graphics.

Graphic is now under a total refactoring. The prior available version code is here: v0.3.0 . A Flutter data visualization library based on Grammar of

LIN Chen 906 Jan 3, 2023
Flutter cryptocurrency UI dashboard.

?? ?? Crypto Dashboard Flutter UI Kit ?? ?? ?? ⭐️ ⭐️ ??‍?? Free Flutter UI Kits based on designs on UpLabs ?? . Watch Youtube Speed code Tutorial Here

Olayemii Garuba 69 Nov 20, 2022
A scrollable time chart in Flutter.

time_chart An amazing time chart in Flutter. Chart Types TimeChart AmountChart Getting Started 1 - Depend on it Add it to your package's pubspec.yaml

Minseong Kim 26 Oct 28, 2022
[reborned barcode_scan] A flutter plugin for reading 2D barcodes and QR codes.

Reborned ?? Original barcode_scan was discontinued, so barcode_scan2 was borned with sound null safety support ?? barcode_scan2 A flutter plugin for s

Masayuki Ono (mono) 61 Jan 6, 2023
A library to draw fantastic bar charts race in Flutter

bar_chart_race The first library to draw fantastic bar charts race in Flutter Usage Let's get started add the dependencies to your app: dependencies:

Mimene Younes 6 Jun 24, 2022
This project is used to introduce the use of flutter canvas, include draw chart, clip image's path and draw progress indicator.

flutter_canvas This project is used to introduce the use of flutter canvas, include draw chart, clip image's path and draw progress indicator. draw ch

YouXianMing 9 Oct 27, 2022
Maybe this is the best k chart in Flutter.Support drag,scale,long press,fling.And easy to use.

k_chart Maybe this is the best k chart in Flutter.Support drag,scale,long press,fling.And easy to use. display image gif Getting Started Install depen

OpenFlutter 342 Jan 9, 2023
Sleek circular slider for Flutter

Sleek circular slider/progress bar & spinner for Flutter A highly customizable circular slider/progress bar & spinner for Flutter. Getting Started Ins

Mat Nuckowski 476 Dec 16, 2022
Flutter chart library contains depth charts supporting various indicators and zooming

flutter_k_chart 介绍 一个仿火币的flutter图表库包含深度图,支持各种指标及放大缩小、平移等操作 webdemo演示 Demo v0.1.0:下载 APK 演示 简单用例 1.在 pubspec.yaml 中添加依赖 本项目数据来自火币openApi,火币的接口可能需要翻墙,接口

gwh 259 Dec 30, 2022
A flutter package which makes it easier to plot different types of charts with lots of customization, made purely in dart

multi_charts It is a library that provides different types of charts to plot data points. Currently it supports only Radar Chart, but will support mor

Intkhab Ahmed 28 Nov 9, 2022
Flutter package for creating simple yet modern looking charts

A package for creating simple yet modern looking charts. Five chart types Bar Gauge Line Pie Radar Canvas + DOM modern_charts combines Canvas and DOM

Man Hoang 68 Nov 4, 2022
Animated line chart for flutter

fl_animated_linechart An animated chart library for flutter. Support for datetime axis Multiple y axis, supporting different units Highlight selection

null 51 Sep 25, 2022
Flutter GraphView is used to display data in graph structures. It can display Tree layout, Directed and Layered graph. Useful for Family Tree, Hierarchy View.

GraphView Get it from | Flutter GraphView is used to display data in graph structures. It can display Tree layout, Directed and Layered graph. Useful

Nabil Mosharraf 326 Jan 6, 2023