Giter Site home page Giter Site logo

mpflutterchart's People

Contributors

absar avatar crizant avatar jackyhieu1211-hn avatar miyakeryo avatar phamnhuvu-dev avatar qwales1 avatar sidhijakpat avatar spenceacc avatar sunpointed avatar terrylucas avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mpflutterchart's Issues

Line chart gradient fill

In MPAndroidChart it is possible to draw gradient fill in line charts, would you please add this feature too?

LineChart can't hide grid lines

Hello,
I have a problem with hiding grid lines. Here is my widget. Could you help me with this?

_controller.xAxis.enabled=false;
_controller.axisLeft.enabled=false;
_controller.axisRight.enabled=false;
_controller.xAxis.drawGridLines=false;
_controller.axisLeft.drawGridLines=false;
_controller.axisRight.drawGridLines=false;

`
class DynamicLineChart extends StatefulWidget {
List _chartEntryList;
DynamicLineChartConfiguration _configuration;

DynamicLineChart(this._chartEntryList,this._configuration);

@OverRide
State createState() =>_DynamicLineChartState();
}

class _DynamicLineChartState extends State {
LineChartController _controller;

DynamicLineChartConfiguration get _configuration=>widget._configuration;
List get _chartEntryList=>widget._chartEntryList;

@OverRide
void initState() {
var desc = Description()..enabled = false;
_controller = LineChartController(
noDataText: _configuration.noDataText,
drawGridBackground: _configuration.drawGridBackgroud,
dragXEnabled: true,
dragYEnabled: true,
scaleXEnabled: true,
scaleYEnabled: true,
selectionListener: _configuration.selectionListener,
pinchZoomEnabled: true,
drawBorders: true,
backgroundColor: Colors.white,
customViewPortEnabled: true,
description: desc);
_controller.doneBeforePainterInit();
_controller.data = LineData();
super.initState();
}

@OverRide
Widget build(BuildContext context) {
_setEntryList(_chartEntryList);
return LineChart(_controller);
}

void _setEntryList(List values) {
if(values==null || values.length==0) return;
LineDataSet set = new LineDataSet(values, "TODO -> Total: ${values.length}");
set.setLineWidth(_configuration.lineWidth);
set.setCircleRadius(_configuration.circleRadius);
set.setColor1(_configuration.lineColor);
set.setCircleColor(_configuration.circleColor);
set.setHighLightColor(_configuration.highLightColor);
set.setValueTextSize(_configuration.valueTextSize);
set.setValueTextColor(_configuration.valueTextColor);
set.setMode(_configuration.mode);
_controller.data.clearValues();
_controller.data.addDataSet(set);
_controller.setVisibleXRangeMaximum(_configuration.visibleXRangeMaximum);
_controller.moveViewTo(_controller.data.getEntryCount().toDouble(), 0, AxisDependency.LEFT);
_controller.autoScaleMinMaxEnabled=false;
_controller.xAxis.enabled=false;
_controller.axisLeft.enabled=false;
_controller.axisRight.enabled=false;
_controller.xAxis.drawGridLines=false;
_controller.axisLeft.drawGridLines=false;
_controller.axisRight.drawGridLines=false;
_controller.axisLeft.gridColor=Colors.white;
}
}
`

还是柱状图点击显示问题

问题如issues30
我用的是分支localPosition-support这个版本,不是新版,这个版本是因为我用的flutter版本为1.5.4,所以前几个月前让你帮忙弄的分支。
这个版本有解决方法吗?

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

Gradient in the line from linechart

How can I made a gradient for the line in linechart? (not the fill) in Android is with the paint and shader but I dont know how to set the same in flutter, thanks!

0.1.2版本引入后报错

引用0.1.2包,导入相关类,运行项目,成功。
把项目关闭,idea关闭后再打开,运行工程,结果出现下面这个错误。
把0.1.2注释后,运行项目,成功。
这现象出现过几次,但不确定是否属于我个人的问题。
开发工具:idea。
系统:mac 10.15.2
[✓] Flutter (Channel stable, v1.12.13+hotfix.5, on Mac OS X 10.15.2 19C57, locale zh-Hans-CN)

[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
[✓] Xcode - develop for iOS and macOS (Xcode 11.3)
[✓] Android Studio (version 3.5)
[✓] IntelliJ IDEA Ultimate Edition (version 2017.2)
[✓] IntelliJ IDEA Community Edition (version 2019.3.1)
[✓] VS Code (version 1.41.1)
[✓] Connected device (1 available)

• No issues found!

错误信息:

Error output from Xcode build:

** BUILD FAILED **

Xcode's output:

In file included from /Users/kazeik/Documents/flutter/.pub-cache/hosted/pub.flutter-io.cn/fluttertoast-3.1.3/ios/Classes/FluttertoastPlugin.m:2:
/Users/kazeik/Documents/flutter/.pub-cache/hosted/pub.flutter-io.cn/fluttertoast-3.1.3/ios/Classes/UIView+Toast.h:328:19: warning: empty paragraph passed to '@param' command [-Wdocumentation]
@param sharedStyle
~~~~~~~~~~~~~~~~~^
/Users/kazeik/Documents/flutter/.pub-cache/hosted/pub.flutter-io.cn/fluttertoast-3.1.3/ios/Classes/UIView+Toast.h:343:25: warning: empty paragraph passed to '@param' command [-Wdocumentation]
@param allowTapToDismiss
~~~~~~~~~~~~~~~~~~~~~~~^
/Users/kazeik/Documents/flutter/.pub-cache/hosted/pub.flutter-io.cn/fluttertoast-3.1.3/ios/Classes/UIView+Toast.h:343:9: warning: parameter 'allowTapToDismiss' not found in the function declaration [-Wdocumentation]
@param allowTapToDismiss
^~~~~~~~~~~~~~~~~
/Users/kazeik/Documents/flutter/.pub-cache/hosted/pub.flutter-io.cn/fluttertoast-3.1.3/ios/Classes/UIView+Toast.h:343:9: note: did you mean 'tapToDismissEnabled'?
@param allowTapToDismiss
^~~~~~~~~~~~~~~~~
tapToDismissEnabled
/Users/kazeik/Documents/flutter/.pub-cache/hosted/pub.flutter-io.cn/fluttertoast-3.1.3/ios/Classes/UIView+Toast.h:362:20: warning: empty paragraph passed to '@param' command [-Wdocumentation]
@param queueEnabled
~~~~~~~~~~~~~~~~~~^
/Users/kazeik/Documents/flutter/.pub-cache/hosted/pub.flutter-io.cn/fluttertoast-3.1.3/ios/Classes/FluttertoastPlugin.m:19:23: warning: unused variable 'viewController' [-Wunused-variable]
UIViewController *viewController =
^
/Users/kazeik/Documents/flutter/.pub-cache/hosted/pub.flutter-io.cn/fluttertoast-3.1.3/ios/Classes/FluttertoastPlugin.m:70:21: warning: unused variable 'topPadding' [-Wunused-variable]
CGFloat topPadding = window.safeAreaInsets.top;
^
/Users/kazeik/Documents/flutter/.pub-cache/hosted/pub.flutter-io.cn/fluttertoast-3.1.3/ios/Classes/FluttertoastPlugin.m:71:21: warning: unused variable 'bottomPadding' [-Wunused-variable]
CGFloat bottomPadding = window.safeAreaInsets.bottom;
^
/Users/kazeik/Documents/flutter/.pub-cache/hosted/pub.flutter-io.cn/fluttertoast-3.1.3/ios/Classes/FluttertoastPlugin.m:48:19: warning: unused variable 'size' [-Wunused-variable]
NSNumber *size = call.arguments[@"size"];
^
8 warnings generated.
/Users/kazeik/Documents/flutter/.pub-cache/hosted/pub.flutter-io.cn/image_gallery_saver-1.2.2/ios/Classes/ImageGallerySaverPlugin.m:2:9: fatal error: 'image_gallery_saver/image_gallery_saver-Swift.h' file not found
#import <image_gallery_saver/image_gallery_saver-Swift.h>
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
note: Using new build system
note: Planning build
note: Constructing build description
warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 4.3, but the range of supported deployment target versions is 8.0 to 13.2.99. (in target 'FMDB' from project 'Pods')

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);
}

}

Sync the zooming and scrolling of two charts?

I'm trying to implement two charts with same number of data entries: one line chart and one bar chart.

And if one chart is zoomed and scrolled, the other chart is zoomed and scrolled to the same date range as well.

For example:
RPReplay_Final1581315894

Is it possible?

HorizontalBarChart Exception

Open the HorizontalBarChart in the example causes an error.

Run build apk

Launching lib/main.dart on SM G965N in debug mode...
Running Gradle task 'assembleDebug'...
E/flutter (25850): [ERROR:flutter/lib/ui/ui_dart_state.cc(157)] Unhandled Exception: Stack Overflow
E/flutter (25850): #0 new TextStyle (dart:ui/text.dart:607:3)
E/flutter (25850): #1 TextSpan.build (package:flutter/src/painting/text_span.dart:485:26342)
E/flutter (25850): #2 TextPainter.layout (package:flutter/src/painting/text_painter.dart:544:13)
E/flutter (25850): #3 Legend.getMaximumEntryWidth (package:mp_chart/mp/core/legend/legend.dart:275:50)
E/flutter (25850): #4 Legend.calculateDimensions (package:mp_chart/mp/core/legend/legend.dart:358:21)
E/flutter (25850): #5 LegendRenderer.computeLegend (package:mp_chart/mp/core/render/legend_renderer.dart:180:13)
E/flutter (25850): #6 HorizontalBarChartPainter.calculateOffsets (package:mp_chart/mp/painter/horizontal_bar_chart_painter.dart:147:40)
E/flutter (25850): #7 BarLineChartBasePainter.autoScale (package:mp_chart/mp/painter/bar_line_chart_painter.dart:362:5)
E/flutter (25850): #8 BarLineChartBasePainter.compute (package:mp_chart/mp/painter/bar_line_chart_painter.dart:477:7)
E/flutter (25850): #9 HorizontalBarChartPainter.calculateOffsets (package:mp_chart/mp/painter/horizontal_bar_chart_painter.dart:150:5)
E/flutter (25850): #10 BarLineChartBasePainter.autoScale (package:mp_chart/mp/painter/bar_line_chart_painter.dart:362:5)
E/flutter (25850): #11 BarLineChartBasePainter.compute (package:mp_chart/mp/painter/bar_line_chart_painter.dart:477:7)
E/flutter (25850): #12 HorizontalBarChartPainter.calculateOffsets (package:mp_chart/mp/painter/horizontal_bar_chart_painter.dart:150:5)
E/flutter (25850): #13 BarLineChartBasePainter.autoScale (package:mp_chart/mp/painter/bar_line_chart_painter.dart:362:5)
E/flutter (25850): #14 BarLineChartBasePainter.compute (package:mp_chart/mp/painter/bar_line_chart_painter.dart:477:7)
E/flutter (25850): #15 HorizontalBarChartPainter.calculateOffsets (package:mp_chart/mp/painter/horizontal_bar_chart_painter.dart:150:5)
E/flutter (25850): #16 BarLineChartBasePainter.autoScale (package:mp_chart/mp/painter/bar_line_chart_painter.dart:362:5)
E/flutter (25850): #17 BarLineChartBasePainter.compute (package:mp_chart/mp/painter/bar_line_chart_painter.dart:477:7)
E/flutter (25850): #18 HorizontalBarChartPainter.calculateOffsets (package:mp_chart/mp/painter/horizontal_bar_chart_painter.dart:150:5)
E/flutter (25850): #19 BarLineChartBasePainter.autoScale (package:mp_chart/mp/painter/bar_line_chart_painter.dart:362:5)
E/flutter (25850): #20 BarLineChartBasePainter.compute (package:mp_chart/mp/painter/bar_line_chart_painter.dart:477:7)
E/flutter (25850): #21 HorizontalBarChartPainter.calculateOffsets (package:mp_chart/mp/painter/horizontal_bar_chart_painter.dart:150:5)
E/flutter (25850): #22 BarLineChartBasePainter.autoScale (package:mp_chart/mp/painter/bar_line_chart_painter.dart:362:5)
E/flutter (25850): #23 BarLineChartBasePainter.compute (package:mp_chart/mp/painter/bar_line_chart_painter.dart:477:7)
E/flutter (25850): #24 HorizontalBarChartPainter.calculateOffsets (package:mp_chart/mp/painter/horizontal_bar_chart_painter.dart:150:5)
E/flutter (25850): #25 BarLineChartBasePainter.autoScale (package:mp_chart/mp/painter/bar_line_chart_painter.dart:362:5)
E/flutter (25850): #26 BarLineChartBasePainter.compute (package:mp_chart/mp/painter/bar_line_chart_painter.dart:477:7)
E/flutter (25850): #27 HorizontalBarChartPainter.calculateOffsets (package:mp_chart/mp/painter/horizontal_bar_chart_painter.dart:150:5)
E/flutter (25850): #28 BarLineChartBasePainter.autoScale (package:mp_chart/mp/painter/bar_line_chart_painter.dart:362:5)
E/flutter (25850): #29 BarLineChartBasePainter.compute (package:mp_chart/mp/painter/bar_line_chart_painter.dart:477:7)
E/flutter (25850): #30 HorizontalBarChartPainter.calculateOffsets (package:mp_chart/mp/painter/horizontal_bar_chart_painter.dart:150:5)
E/flutter (25850): #31 BarLineChartBasePainter.autoScale (package:mp_chart/mp/painter/bar_line_chart_painter.dart:362:5)
E/flutter (25850): #32 BarLineChartBasePainter.compute (package:mp_chart/mp/painter/bar_line_chart_painter.dart:477:7)
E/flutter (25850): #33 HorizontalBarChartPainter.calculateOffsets (package:mp_chart/mp/painter/horizontal_bar_chart_painter.dart:150:5)
E/flutter (25850): #34 BarLineChartBasePainter.autoScale (package:mp_chart/mp/painter/bar_line_chart_painter.dart:362:5)
E/flutter (25850): #35 BarLineChartBasePainter.compute (package:mp_chart/mp/painter/bar_line_chart_painter.dart:477:7)
E/flutter (25850): #36 HorizontalBarChartPainter.calculateOffsets (package:mp_chart/mp/painter/horizontal_bar_chart_painter.dart:150:5)
E/flutter (25850): #37 BarLineChartBasePainter.autoScale (package:mp_chart
✓ Built build/app/outputs/apk/debug/app-debug.apk.
Installing build/app/outputs/apk/app.apk...
Syncing files to device SM G965N...

Click 'Horizontal' or 'Stacked 2'

════════ Exception caught by rendering library ═════════════════════════════════════════════════════
The following StackOverflowError was thrown during paint():
Stack Overflow

The relevant error-causing widget was:
HorizontalBarChart file:///my_path/MPFlutterChart-master/mp_chart/example/lib/demo/bar_chart/horizontal.dart:207:20
When the exception was thrown, this was the stack:
#0 new TextStyle (dart:ui/text.dart:607:3)
#1 TextSpan.build (package:flutter/src/painting/text_span.dart:485:26342)
#2 TextPainter.layout (package:flutter/src/painting/text_painter.dart:544:13)
#3 Legend.getMaximumEntryWidth (package:mp_chart/mp/core/legend/legend.dart:275:50)
#4 Legend.calculateDimensions (package:mp_chart/mp/core/legend/legend.dart:358:21)
...
The following RenderObject was being processed when the exception was fired: RenderCustomPaint#8324c
... parentData: (can use size)
... constraints: BoxConstraints(w=600.9, h=733.4)
... size: Size(600.9, 733.4)
RenderObject: RenderCustomPaint#8324c
parentData: (can use size)
constraints: BoxConstraints(w=600.9, h=733.4)
size: Size(600.9, 733.4)
════════════════════════════════════════════════════════════════════════════════════════════════════

════════ (2) Exception caught by rendering library ═════════════════════════════════════════════════
Stack Overflow
The relevant error-causing widget was:
HorizontalBarChart file:///my_path/MPFlutterChart-master/mp_chart/example/lib/demo/bar_chart/horizontal.dart:207:20
════════════════════════════════════════════════════════════════════════════════════════════════════

LineChart中,x轴是否支持字符串类型?

在LineChart图中,例子中数据是通过List values = List();values.add(Entry(x: i.toDouble(), y: val)); 进行数据填充,Entry中,x与y都是double类型,如果x轴要显示字符串,为“1月”、“2月”、“3月”或是时间如“00:00:10”、"00:00:15"之类的,要如何处理?

OnDrawListener is not working?

I implemented a OnDrawListener like this:

class _DrawListener implements OnDrawListener {
  void onEntryAdded(Entry entry) {
    print('entry added');
  }
  void onEntryMoved(Entry entry) {
    print('entry moved');
  }
  void onDrawFinished(DataSet<Entry> dataSet) {
    print('draw finished');
  }
}

Then set it to my CombinedChartController:

_controller = CombinedChartController(
  // ... other properties
  drawListener: _DrawListener(),
);

Seems the callbacks never get executed.

The limit label y position is not correct

When we set label position to LimitLabelPosition.LEFT_CENTER and LimitLabelPosition.RIGHT_CENTER, the y position is not aligned center.

I have created a pull request #43 to fix this issue.

Before:
Simulator Screen Shot - iPhone Xs - 2020-02-07 at 15 46 11

After:
Simulator Screen Shot - iPhone Xs - 2020-02-07 at 15 45 45

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版本?

mpAndroidChart通过lineChart.moveViewToX方法移动view到最新数据,mp_flutter_chart要如何实现?

在lineChart中,动态加点,view右移图表到最新数据。在mpAndroidChart中,可以通过lineChart.moveViewToX方法移动,如下
data.addEntry(new Entry(x, y), 0);
data.notifyDataChanged();
lineChart.notifyDataSetChanged();
lineChart.setVisibleXRangeMaximum(60);
lineChart.moveViewToX(data.getEntryCount());
在mp_flutter_chart中没找到lineChart.moveViewToX的方法,请问要如何实现?

OnTouchEventListener gives wrong x and y values

If the valueType of an OnTouchEventListener is set to CHART, the x and y value in events should be the chart value of the touch point, right?

But it is not. Not I have to use valueType LOCAL then controller.getValuesByTouchPoint() to get the value I tapped.

柱状图点击显示问题

目前,点击柱状图的某个柱,顶部会显示标签,内容为x轴值,y轴值, 如"1,3.12"、“2,4.1” ,1为x轴,3.12为y轴值,请问如何设置成只显示y轴值,如"3.12",不显示x轴的值?

Change zoom level

Hi! Thanks for this library!
How can I change zoom level from code? I was reading that is changing viewport, but i cant.
Thank you!

[Bug] posation y in chart

position y in ChartCombined chart not correct
double y=controller.getValuesByTouchPoint(controller.viewPortHandler.contentRight(),controller.viewPortHandler.contentBottom(), AxisDependency.RIGHT).y

How to make the radar-chart position to top by own?

Problem

I tried almost of the setter in RadarChartControllerとfix the chart position but dosn`t effect.
There is any way to specified the chart position?
and erase the title-label.

What I tried

RadarChartController(
  ...
  legendSettingFunction: (legend, controller) {
    legend
      ...
      ..yOffset = (0);
  }
  ...
}

Use yOffset can specified the position, but cant move until the top.
I think this is caused by the title-label of the radar-chart.
Does anyone know how to solve this problem?

barcharts crash on zoom with a lot of data

thanks for this great library port!

When a set a lot of data in barcharts and apply zoom in/out the app stop with the error below. im using the demo app in my iOS device iPhone 7.

stack trace in xcode:
2019-09-30 23:41:26.337733-0300 Runner[1930:141345] flutter: Another exception was thrown: Unsupported operation: Result of truncating division is Infinity or NaN

Info background color?

Currently the "No chart data available" screen is white in background.
Would you please apply the value of backgroundColor to it, or add an option infoBackgroundColor, so that we can customize the style of it?

螢幕截圖 2020-02-07 下午11 23 51

[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);
    
  }

On viewport update listener

This is an extension of #29 and #48. But the on touch listener only receives events when the finger is touching the screen.

  1. When we scroll fast, the chart will continue to scroll for a little distance after the finger is not in contact with the screen.
  2. If we programmatically modify the viewport, for example calling painter.zoom(), the on touch listener will not be notified.

It would be nice if there's a listener which is called once the chart is translated and scaled.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.