波动图PanAndZoomBehavior不会放大手势的中心

编程入门 行业动态 更新时间:2024-10-15 14:17:34
本文介绍了波动图PanAndZoomBehavior不会放大手势的中心的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我在Flutter应用程序中使用了 github/google/charts 。效果很好。但是,当我放大图表时,放大发生在错误的地方!它开始扩展并保持左静态。效果是手指缩放下的图表幻灯片不在缩放点上。有没有办法像放大图库中的图片一样进行缩放?

我的图表代码

小部件build(BuildContext context){ 返回新图表。LineChart( _chartSeriesFromChartData(seriesList),动画:false, defaultRenderer:chart.LineRendererConfig(includeArea:true,includePoints:true), primaryMeasureAxis:charts.NumericAxisSpec(tickProviderSpec:charts.BasicNumericTickProviderSpec(desiredTickCount:8)),行为:[ZoomBehaviour()] $ p>

解决方案

您可以在代码中使用以下代码:

行为:[新图表。PanAndZoomBehavior()],

,或者如果您想按图表中的项目进行选择您可以使用:

行为:[new chart.SeriesLegend()],

,如果要使用其中两个,则可以使用:

行为:[new chart.SeriesLegend (),新图表。PanAndZoomBehavior()],

祝你好运编码

I used github/google/charts inside my flutter app. It works great. But when i zoom on chart, the zoom happens but in the wrong place! It starts expanding keeping the left static. The effect is the chart slide under your finger zooming not in the point you are zooming to. Is there a way to zoom like you zoom on a picture on gallery?

code of my chart

Widget build(BuildContext context) { return new charts.LineChart( _chartSeriesFromChartData(seriesList), animate: false, defaultRenderer: charts.LineRendererConfig(includeArea: true, includePoints: true), primaryMeasureAxis: charts.NumericAxisSpec(tickProviderSpec: charts.BasicNumericTickProviderSpec(desiredTickCount: 8)), behaviors: [ZoomBehaviour()], )

解决方案

you can use code like this in your code:

behaviors: [new charts.PanAndZoomBehavior()],

or if you want selection by item in our charts you can use:

behaviors: [new charts.SeriesLegend()],

and if you want use two of them maybe you can use:

behaviors: [new charts.SeriesLegend(), new charts.PanAndZoomBehavior()],

good luck happy coding

更多推荐

波动图PanAndZoomBehavior不会放大手势的中心

本文发布于:2023-11-30 03:04:49,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1648509.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:手势   中心   PanAndZoomBehavior

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!